text
stringlengths
0
1.8k
**Tom Wilkie:** Is that a particularly large user base? It seems very -- I've not heard of that before. Cool.
**Gerhard Lazu:** Right. So not necessarily... I mean, depending on what you mean by large, but it scales really well, because it's the Erlang VM.
**Tom Wilkie:** Because it's Erlang, yeah.
**Gerhard Lazu:** Everything is message passing, you can have clusters natively, it forms a cluster, you start sending messages... I think one of the more popular apps that uses Erlang is WhatsApp, that everybody knows, everybody uses... And RabbitMQ is another messaging queue that also uses the same Erlang VM... And I...
**Tom Wilkie:** By Basho.
**Gerhard Lazu:** And I remember it was like in the same quadrant, right? Acunu Analytics was there...
**Tom Wilkie:** Manu was there, I think he was their managing director for the EU team, and he was at Acunu a long time ago, yeah.
**Gerhard Lazu:** There you go, so it's a small world, isn't it?
**Tom Wilkie:** I think he's now at one of the cryptocurrency companies, but yeah. Unrelated...
**Gerhard Lazu:** So coming back to this Phoenix app - the reason I mentioned that it's a monolithic app, it's important because it's not microservices. You don't have HTTP calls, or gRPC's, there's no such thing. It's a single app, it's a monolithic app, it talks to a database, it has an Ingress NGINX in front, there'...
So the request comes -- and this is very specific, and maybe this will help... The request goes through a CDN, Fastly, it hits a load balancer, which is a managed one, like your ELB, whatever the equivalent of that...
**Tom Wilkie:** Yeah.
**Gerhard Lazu:** Then it goes to Ingress NGINX, and then from Ingress NGINX it gets proxied to the right service pod... You know, I don't have to start decomposing this...
**Tom Wilkie:** Yeah.
**Gerhard Lazu:** And eventually, it hits the database and then it comes back in again. At any one point it could be cached. Sometimes requests are slow... Why? How would we find out with a tool that exists in the Grafana ecosystem world?
**Tom Wilkie:** No, it's a great question. So you already know that requests are slow, so that's kind of interesting. I'm gonna guess, for the sake of this discussion, that you've been told by your users that your requests are slow.
**Gerhard Lazu:** Right.
**Tom Wilkie:** So I would actually say -- first things first, let's kind of confirm that... We wanna instrument the system, we wanna get as many useful metrics as we can out of it. You mentioned an ELB there, for instance. We've put the CloudWatch exporter on there and get the ELB metrics out into Prometheus. Now, you...
**Gerhard Lazu:** I'm sorry, that was a bad example. So I gave an analogy -- it's actually a Linode NodeBalancer. I'm pretty sure you don't integrate with that...
**Tom Wilkie:** Okay.
**Gerhard Lazu:** But it's like a managed HAProxy.
**Tom Wilkie:** I wouldn't underestimate the Prometheus ecosystem. There's probably an exporter for Linode metrics that the importer... And if there isn't, there will be by the time we finish this recording, I imagine.
**Gerhard Lazu:** I hope so.
**Tom Wilkie:** Yeah. So I'd get metrics on the load balancer, because it's always good to start at the very edge.
**Gerhard Lazu:** The CDN is first. What about the CDN?
**Tom Wilkie:** Yeah, I don't know enough about Fastly, and I'm afraid to really comment... But I'm sure there's some way of getting logs or metrics on that.
**Gerhard Lazu:** \[27:55\] Okay. So we've hit something which I wasn't expecting to hit, but let's just go with it. I looked at integrating Fastly logs with the Grafana Cloud. To do that, it only supports HTTPS, because that's what Loki exposes... But we have to validate the HTTPS endpoint that we're going to send log...
So that's the first part - how do we get from Fastly, sending logs to Grafana Cloud? It's not supported. What Fastly is telling us - you will need to have some sort of a proxy that you can authenticate, and then forward those logs to Grafana Cloud, to Loki specifically.
It's okay... Not great. I would like just to send those metrics directly -- sorry, I keep saying metrics. I mean logs... Send the logs to Grafana Cloud. So that would be the first step. Great.
So let's say we understand the part between the CDN and the load balancer. Let's say that we understand that path, and we have some logs to tell us something. What do we do with those logs?
**Tom Wilkie:** So logs in and of themselves are seldom useful. So Loki, in LogQL that I referenced earlier, would be able to turn those into some usable metrics. You'd be able to turn them into request rates, error rates, and latencies, if the log contains latency. And you do that all with Loki. You can even, with the...
And I always say, with metrics - it'll tell you when it happened, it'll tell you how much it happened... Maybe if you've got the granularity, it'll tell you where, which service, or which region it happened in. But it won't actually tell you what happened. It will just tell you that something was slow.
So at that point, we start digging in. And there's a couple of techniques we can use. Firstly, I would instrument everything in the stack. We talked about getting metrics on the CDN, we talked about getting metrics on the load balancer... Your Ingress NGINX is running on Kubernetes, so it's trivial to deploy Promtail a...
Then you've got your application, the Elixir application. Now, I don't know enough about that, but I'm going to assume there's a Prometheus client library out there, so I would instrument that... And I would follow -- whenever I'm instrumenting my own application, I tend to follow a very simple method. If you've heard ...
So I would just try and export a Prometheus histogram from the application with request rate, with error rate, and with duration. And the histogram will capture all three.
Finally, you mentioned the database... Let's just, for argument's sake, assume it's MySQL. They don't tend to actually export very good metrics. There is an exporter for it in Prometheus, and we actually baked that into the Grafana Agent, just to simplify it and make it easier and have less stuff to deploy. So I would ...
So finally, this hasn't really caught on very much, but you see it in a lot of dashboards that my team and I have built - I tend to always kind of traverse the system from top to bottom. I always have request rates on the left, in panels on the left, and durations like latency graphs on the right. Just through a quick ...
**Gerhard Lazu:** Do you have a good dashboard that exemplifies this? Because what you say makes a lot of sense... Is there a good dashboard that we can use as a starting point?
**Tom Wilkie:** \[32:00\] The Cortex ones are the ones that I've probably spent the most amount of time. Again, a bit of work we did with the Prometheus community was this standard called mixins which is a packaging format for Grafana dashboards and Prometheus alerts. So we've built -- there's 40 or 50 mixins now, from...
Actually, the most popular mixin would be the Kubernetes mixin. I would wager that virtually every Kubernetes cluster in the world is running a set of dashboards from the Kubernetes mixin... Which is kind of cool, because I helped write a lot of those, in the very early days at least. It is now a whole community that m...
So dashboards - you would have a row per service and then you'd just do error rate, and request rate, and latency. And this will help you at a very quick glance. When you get used to looking at dashboards in this format - and every service kind of looks the same, is in the same format - that consistency really helps re...
So a very simple technique; it's not universally applicable, but it does help you know "Well, this is coming in my application, or this is coming in my load balancer, or this is coming in my database."
**Gerhard Lazu:** Is there a screenshot of such a dashboard that we can reference in the show notes? That would really, really help.
**Tom Wilkie:** I can just load up one of our internal dashboards and send it over.
**Gerhard Lazu:** Yes, please. That would be great. The other thing is you mentioned mixins. Mixins in what context?
**Tom Wilkie:** I've terribly overloaded the term there, because I just thought it was a cool term. I realize in CSS and in Python mixins has a particular meaning... It bears no resemblance to the kind of language-level primitive. It is just a cool name that we used for packaging up.
We call them monitoring mixins because we used a language called Jsonnet to express a lot of our alerts and dashboards. And Jsonnet is very much about adding together big structures of data, and it kind of looks a bit like a mixin in that respect. But that being said, most of the way people use mixins nowadays doesn't ...
**Gerhard Lazu:** Okay.
**Tom Wilkie:** So it's just a name. There's a GitHub repo and a small website, and the nice thing about the tooling that's been developed and the packaging format is very much -- we encourage people who publish exporters, or people who build applications that are instrumented with Prometheus metrics to also distribute...
**Gerhard Lazu:** That's interesting. So I know I've heard of mixins in the context of Jsonnet, and I tried them when I was using the Kube Prometheus Stack. The one that -- I think it was Frederick... Yes, it was Frederick while he was still at Red Hat. I know that he's not there anymore, but when he was there, he was ...