text stringlengths 0 1.8k |
|---|
[1689.70 --> 1695.22] To do that, it only supports HTTPS, right? Because that's what Loki exposes, but we have to |
[1695.78 --> 1701.78] validate the HTTPS endpoint that we're going to send logs to. The problem is how do you validate |
[1701.78 --> 1707.94] that we own Grafana Cloud Loki? We can't do that. So what I'm saying is there's not a native |
[1707.94 --> 1712.50] integration between Fastly and Grafana Cloud. And I would really like that. Actually, |
[1712.50 --> 1715.62] there's something which we discussed in the previous episode, episode, no, two episodes |
[1715.62 --> 1722.10] ago, episode 10. So that's the first part. How do we get from Fastly sending logs to Grafana Cloud? |
[1722.10 --> 1726.66] It's not supported. What Fastly is telling us, you will need to have some sort of a proxy |
[1726.66 --> 1732.90] that you can authenticate and then forward those logs to Grafana Cloud, to Loki specifically. |
[1733.62 --> 1737.30] It's okay. Not great. I would like just to send those metrics directly. Sorry, |
[1737.30 --> 1743.46] I keep saying metrics. I mean logs. Send the logs to Grafana Cloud. So that will be the first step. |
[1743.46 --> 1749.86] Great. So let's say we understand the part between the CDN and the load balancer. Let's say that we |
[1749.86 --> 1755.14] understand that path and we have some logs to tell us something. What do we do with those logs? |
[1755.14 --> 1761.46] So this is, yeah. I mean, logs in and of themselves aren't seldom useful. So Loki in LogQL that I |
[1761.46 --> 1766.34] referenced earlier would be able to turn those into some usable metrics, right? You'd be able to turn |
[1766.34 --> 1773.38] them into request rates, error rates, and latencies if the log contains a latency. And you do that all |
[1773.38 --> 1777.86] with Loki. And you can even, with the more recent versions of Grafana and Loki, you can build dashboards |
[1777.86 --> 1782.18] out of those. And some of the cool stuff is like behind the scenes, there's a lot of caching going on |
[1782.18 --> 1788.18] so that those dashboard refreshes don't overwhelm the Loki. And I always say with metrics, it'll tell you |
[1788.90 --> 1793.86] when it happened. It'll tell you how much it happened. Maybe if you've got the granularity, |
[1793.86 --> 1798.10] it might tell you where, which service or which region it happened in, but it won't actually tell |
[1798.10 --> 1803.62] you what happened. It will just tell you that something was slow. So at that point, we start |
[1803.62 --> 1809.22] digging in and there's a couple of techniques we can use. So firstly, I would instrument everything |
[1809.22 --> 1812.98] in the stack. We talked about getting metrics from the CDN. We talked about getting metrics from the |
[1812.98 --> 1817.86] load balancer, getting your Ingress Engine X is running on Kubernetes. |
[1817.86 --> 1823.22] So it's trivial to deploy Promptail as a daemon set and get logs from every Kubernetes pod into |
[1823.86 --> 1827.94] Loki. So you've got the Engine X logs, which again, Loki can extract metrics from, |
[1827.94 --> 1834.42] really straightforward. Ward has a fantastic set of dashboards and examples of how to do that already. |
[1834.42 --> 1839.30] Then you've got your application, the Elixir application. Now, I don't know enough about that, |
[1839.30 --> 1843.38] but I'm going to assume there's a Prometheus client library out there. And so I would instrument |
[1843.38 --> 1847.46] that. And I would follow whenever I'm instrumenting my own application, I tend to follow |
[1847.46 --> 1852.66] a very simple method. If you've heard of Brendan Gregg's use method, then somewhat tongue in cheek, |
[1852.66 --> 1857.78] I coined this phrase called the red method, which is request rate, error rate, and request duration. |
[1857.78 --> 1862.18] Right? Red. Everything comes in threes and it's really easy to remember. So I would just try and |
[1862.18 --> 1868.34] export a Prometheus histogram from the application with request rate, with error rate, and with duration. |
[1868.34 --> 1872.74] And the histogram will capture all three. Finally, you mentioned a database. Let's just for argument's |
[1872.74 --> 1877.22] sake, assume it's MySQL. They don't tend to actually export very good metrics. There is an exporter for |
[1877.78 --> 1882.98] it in Prometheus. And we actually bake that into the Grafana agent to just to simplify and make it |
[1882.98 --> 1888.10] easier and have less stuff to deploy. And so I would wire those up and get whatever metrics I can, |
[1888.10 --> 1891.62] but I'd also gather the logs because the database logs tend to be a little bit more interesting. |
[1891.62 --> 1897.06] Mm-hmm . So finally, this hasn't really caught on very much, but you see it in a lot of the dashboards that |
[1897.06 --> 1901.86] my team and I have built. I tend to always kind of traverse the system from top to bottom. |
[1902.42 --> 1909.22] I always have request rates on the left in panels on the left and durations like latency graphs on the |
[1909.22 --> 1914.10] right. Just as a quick glance in the dashboard, you can typically see where the latency is being |
[1914.10 --> 1919.62] introduced. Do you have a good dashboard that exemplifies this? Because what you say makes a lot |
[1919.62 --> 1924.02] of sense. Is there a good dashboard that we can use as a starting point? |
[1924.02 --> 1928.58] Mm-hmm . The Cortex ones are the ones that I've probably spent the most amount of time. |
[1929.38 --> 1935.30] We ship, again, a bit of work we did with the Prometheus community was this standard called |
[1935.30 --> 1940.42] Bixins, right? Which is a packaging format for Grafana dashboards and Prometheus alerts. |
[1940.42 --> 1946.66] Mm-hmm . So we've built, there's 40 or 50 different mixins now from a lot of popular systems, |
[1946.66 --> 1951.94] but one of them is Cortex. And it's just a versioned set of dashboards and alerts that are very flexible, |
[1952.90 --> 1957.54] very easy to extend, which is kind of key, and very easy to kind of keep up to date with upstream. |
[1958.34 --> 1962.34] Actually, the most popular mixin would be the Kubernetes mixin. I would wager that virtually |
[1962.34 --> 1967.38] every Kubernetes cluster in the world is running the set of dashboards from the Kubernetes mixin, |
[1967.38 --> 1971.30] which is kind of cool because I helped write a lot of those in the very early days, at least. |
[1971.30 --> 1976.10] There's now a whole community that maintains and has taken them far beyond anything I could ever |
[1976.10 --> 1983.54] imagine. So dashboards, you'd have a row per service, and then you just do error rate and |
[1983.54 --> 1988.26] request rate and latency. And this will help you at a very quick glance. When you get used to kind of |
[1988.90 --> 1992.66] looking at dashboards in this format, and every service kind of looks the same, is in the same |
[1992.66 --> 1999.22] format, that consistency really helps reduce that cognitive load. You get to kind of pinpoint very |
[1999.22 --> 2003.14] quickly where that latency is being introduced. It's a very simple technique. It's not universally |
[2003.14 --> 2007.78] applicable, but it does help you know, well, this is coming in my application, or this is coming in |
[2007.78 --> 2012.42] my load balancer, or this is coming in my database. Is there a screenshot of such a dashboard that we |
[2012.42 --> 2016.58] can reference in the show notes? That would really, really help. I can just load up one of our internal |
[2016.58 --> 2022.34] dashboards and send it over. Yes, please. That would be great. The other thing is you mentioned mixins. |
[2022.34 --> 2028.26] Mixins in what context? I've terribly overloaded a term there because I just thought it was a cool term. |
[2028.26 --> 2034.82] Like I realize in CSS and in Python, mixins has a particular meaning. It bears no resemblance to |
[2034.82 --> 2040.98] the kind of language level primitive, right? It is just a cool name that we used for packaging up. |
[2040.98 --> 2045.38] We called them monitoring mixins because we use the language called JSON, well, we use a language |
[2045.38 --> 2052.58] called JSON to express a lot of our alerts and dashboards. And JSON is very much about adding together |
[2052.58 --> 2059.14] big structures of data. And it kind of looks a bit like a mixin in that respect. But that being said, |
[2059.14 --> 2065.30] most of the way people use mixins nowadays doesn't use that technique. We just use it as a packaging |
[2065.30 --> 2066.26] format. Okay. |
[2066.26 --> 2071.94] So it's just a name. There's a GitHub repo and a small website. And the nice thing about the tooling |
[2072.50 --> 2078.66] that's been developed and the packaging format is very much we encourage people who publish exporters |
[2078.66 --> 2083.38] or people who build applications that are instrumented with Prometheus metrics to also |
[2083.38 --> 2088.82] distribute a mixin. So Prometheus has a mixin. Etcd has a mixin. The Kubernetes mixins, part of the |
[2088.82 --> 2094.58] Kubernetes project, right? Cortex has a mixin. We just, they live alongside the code. They're version |
[2094.58 --> 2098.74] controlled and maintained in the same way as the code. And suddenly, you know how people talk about |
[2098.74 --> 2102.98] kind of test-driven development. Well, you almost have observability-driven development. |
[2102.98 --> 2109.62] That's interesting. So I know I've heard of mixins in the context of JSON. And I tried them when I was |
[2109.62 --> 2116.50] using the QPrometheus stack. The one that I think it was Frederick. Yes, it was Frederick. While he was |
[2116.50 --> 2121.62] still at Red Hat, I know that he's not there anymore. But when he was there, he was pushing for this QPrometheus |
[2121.62 --> 2128.34] operator. And in the context of the operator, we could get like the whole stack. Working with that, |
[2128.34 --> 2132.74] we used that for changelog was really hard because we had like the JSON. It was like, |
[2132.74 --> 2137.38] it was a specific version of JSON. It was just, there was a Go one. And there was, |
[2137.38 --> 2142.90] I think a Python one or a JavaScript one. I can't remember. But I know the Go one was much faster |
[2142.90 --> 2147.06] to regenerate all the JSON that you needed, all the YAML that you needed, like took a long, |
[2147.06 --> 2151.86] long time basically to get it into Kubernetes. So the mixins that you're talking about, |
[2151.86 --> 2156.18] how would you use them? Let's imagine that you're running on Kubernetes. How would you use those mixins? |
[2156.18 --> 2160.42] This is a really interesting point because the mixins are advanced mode. It's like hard mode, |
[2160.42 --> 2164.26] right? Like the mixins are solving a problem that software developers have. It's like, |
[2164.26 --> 2169.86] how do I package and redistribute and version control and keep up to date? Like, it's not really |
[2169.86 --> 2175.06] an end user format. Like I wouldn't expect that to happen, right? So just to address some of the |
[2175.06 --> 2179.62] initial challenges, it was a, there's a C version and a Go version of JSON it. And they weren't quite |
[2179.62 --> 2184.74] the same. The Go version didn't have formatting, for instance. Go versions caught up and is now what most |
[2184.74 --> 2188.98] people use. That's kind of, we've solved that problem. We've also developed a lot more tooling, |
[2188.98 --> 2193.06] right? So there's MixTool and there's Grizzly and there's Tanker, and there's a whole kind of |
[2193.06 --> 2199.94] ecosystem, JSON it bundler of tools to use to manage these. And the way it works particularly well is if |
[2199.94 --> 2206.18] you're in an organization with kind of sophisticated config management, you know, we have a single repo |
[2206.18 --> 2211.94] that has all of the config that describes pretty much our entire deployment of Grafana Cloud across 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.