text stringlengths 0 2.35k |
|---|
**Jon Calhoun:** \[36:20\] One of the people in Slack had mentioned - I think it was Gabriel - that he actually uses separate packages for developer type logging versus production style logging, just to keep the two separate... And I think one of the main benefits there is that when you go to production, you can basica... |
**Mat Ryer:** Yeah. I've seen it where you'll have like a logger type that supports nil, because in Go, of course, you can write methods that are safe to call on nil; you literally just check the receiver, and if it's nil, it just usually is returned at that point. That's quite nice... But I've also seen it where you e... |
**Ed Welch:** I don't know that I have a good practices suggestion for that. My personal opinion would be to lean towards just the always log this stuff. Basically, turn your debug logging level on and -- actually, I've gotta decide if that's really my opinion... Because it is nuanced, right? There are situations where... |
I know more times than not you don't have debug logging on. There's some information that you want, but you can't get it because the application is running, and likely restarting it resets the error condition, trying to troubleshoot. So, it would be better if you could leave debug logging on, and then just drop it at t... |
**Mat Ryer:** It's not free, is it? |
**Ed Welch:** More interestingly, you're potentially bottlenecking your application, because almost every infrastructure that I see still logs to disk. Usually, like say in Kubernetes, it's the node disk, and node disks aren't terribly fast. So you're more likely than not at some point blocked on your logger, trying to... |
**Break:** \[40:00\] |
**Mat Ryer:** Bill Kennedy, the famous hatted gopher actually showed me an example once where there was a bug in the program and by putting a log line in, because there was a cost to doing that, it changed the behavior of the program. So that act of observing it almost affected it, which is kind of amazing. |
**Ed Welch:** Right. There's some Heisenberg in here, or something... \[laughter\] |
**Mat Ryer:** Yeah... It feels like that, doesn't it? Imagine if you didn't realize that though, and you're logging out, and then it's telling you something that is different to what you see when you then take the log line out. How infuriating is that...? |
**Jon Calhoun:** I think that's the risk of using any language where you have concurrency and other things like that going on, is that it's just -- you always have to take for account that if you're using concurrency, there could be some case where adding anything in there could change the behavior. |
**Mat Ryer:** While I've got you, Jon - it's quiz time! We'll put some music in. I've just made up this segment. |
**Jon Calhoun:** Oh, boy... |
**Jingle:** \[42:40\] to \[42:58\] |
**Mat Ryer:** Jon. Jon Calhoun is joining me from - where are you from, Jon? |
**Jon Calhoun:** Pennsylvania. |
**Mat Ryer:** Pennsylvania. |
**Jon Calhoun:** Can't get more specific than that with you. I don't know what you'll do with that information. |
**Mat Ryer:** Turn up at your house, I might... |
**Jon Calhoun:** It's possible. |
**Mat Ryer:** Yeah, I do want to know your full address now... |
**Jon Calhoun:** Well... |
**Mat Ryer:** No? |
**Jon Calhoun:** Nah. |
**Mat Ryer:** Okay. |
**Ed Welch:** Was that the quiz? |
**Mat Ryer:** Yeah. What's your mother's maiden name, Jon? No, the real quiz is - fmt.println and log.println, where does each of those get printed to? |
**Jon Calhoun:** Where does each get printed to? |
**Mat Ryer:** Yeah. |
**Jon Calhoun:** I assume fmt is os, so that's STDOUT... Or sorry, the fmt one. The log.println - I don't know if it's actually differentiated or not. I would assume it's just os.STDOUT. That would be my guess. |
**Mat Ryer:** Okay. Let's find out. \[sound effect 00:43:49.18\] That sound effect tells us that - no, Jon, unfortunately you're wrong. Log goes to STDERR by default. So that's interesting... |
**Jon Calhoun:** See, I wasn't sure if this was a trick question or not. That's the hard part. With Mat you can never tell. |
**Mat Ryer:** \[laughs\] Yeah, but that's been an odd quiz... |
**Jon Calhoun:** The worst part is in most terminals you can never tell the difference. |
**Mat Ryer:** Yeah, that's true. |
**Jon Calhoun:** Unless you're doing something specific, like piping it to an output file, or something. |
**Mat Ryer:** \[44:13\] This is the question then - where should the logs go to? Do we want them in STDOUT? Should we put only the error level logs in STDERR, and the other logs in STDOUT? What do we think? |
**Jon Calhoun:** I think people have a lot of weird opinions on logging in general. I swear I've talked to somebody who said "If you're printing out a log statement instead of recording a metric, that it should be an error that some engineer has to go fix." |
**Mat Ryer:** Right. |
**Jon Calhoun:** To the point where their app apparently has no logs, it's just all metrics. And I think sometimes how people think about logs vs. metrics - they might kind of be the same thing, they're just differentiating them differently, if that makes sense... |
**Ed Welch:** I could give an opinion that I think is a little bit researched on that... |
**Mat Ryer:** Ed, before you do, we should just be honest with our listeners here... You kind of built Loki, which is Grafana's logging thing. Tell us about Loki just very briefly. Because there's some important context, I think, there. |
**Ed Welch:** I've certainly been a part of Loki. Lots of other smarter folks than me have done the lion's share of the building. |
**Mat Ryer:** It's not what I've heard... I think you're just being modest. |
**Ed Welch:** Actually, it's been about three years that I've been working on Loki now, so I'm kind of trying to think of how I've evolved describing it over time... This may dovetail a little bit into what Jon was saying, but... Loki I tend to describe now as the time series database for string. So I guess before I ta... |
One of the things when I talk about Loki as the time series database for strings is... When we talked about that context you can put in a log line - you can put a lot of information in the log line, right? Within Loki we log for every query, the results of that query and things like throughput and the lines process per... |
The other side of that coin though is that's a long string, and to process that in a system requires parsing it, and doing math on it that's more expensive, it's more data stored on a disk. So to me, the two play very nicely together in the sense of metrics make a really nice roundoup or sort of overall approximation o... |
Where those become a bit interesting is -- so with Loki we have a thing for recording rules where I can generate a metric from those log lines as they come in. So what we'll tend to do is generate roll-ups. So we'll generate a 99% quintile on the query times by tenant. So now maybe I have cardinality of thousands of te... |
So the systems (I think) complement each other really well when you set them up. You can have very high resolution, very high cardinality data, it's just gonna be a lot more expensive to try to query it over time and put those in your logs, and then you can roll that stuff up. Or create metrics, just use the metrics yo... |
\[47:58\] To be honest, once your apps start getting big enough, you probably want specialized tooling for those types of aspects, metrics, logs... And traces, for big distributed systems, being able to view how your information propagates through - a lot easier in a tracing system than it tends to be in searching for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.