text
stringlengths
0
2.35k
• Snapshots are collected asynchronously, allowing for offline analysis and navigation between different snapshots
• Good practices for easier debugging: logging (not too much or too little), focusing on error conditions while writing code, and prioritizing logs for error states over happy flow
• Importance of error logs in debugging
• Value of providing context in error messages
• Role of metrics in monitoring software performance
• Difficulty of using metrics without understanding their context and application-specific characteristics
• Difference between using metrics for debugging versus prioritizing performance issues
• Challenges of debugging in production environments, including lack of direct access to user environments and reliance on logs and metrics
• Reproducing bugs in a staging environment vs production
• Limitations of traditional debugging methods and monitoring tools
• Considerations for debugging in production, including security, privacy regulations, and performance/availability impact
• The importance of log levels in debugging, particularly in large-scale systems with high traffic
• Potential drawbacks to relying on log levels alone, including gaming the system by adjusting verbosity levels based on recent needs rather than long-term importance.
• Importance of careful logging practices as systems scale
• Approaches to debugging, including reproducing issues and examining code
• Criticism of OpenTelemetry, citing complexity and limited benefits over structured logging
• Preference for simple solutions in observability and software engineering
• Advocacy for using the standard library's testing package, citing simplicity and effectiveness
• Discussion of the testing package in Go and its limitations
• Comparison of testing package with traditional testing methods
• Use cases for the testing package and its potential applications
• Unpopular opinion on status updates in project management (via email or tracking system)
• Alternative approaches to requesting status updates from team members
• Importance of clear communication and focused questions in project management
• Comparison of status update messages to debug logs or info-level messages
**Natalie Pistunovich:** So today we are talking about debugging Go, and I have to share that this is actually a re-recording of the episode, because as much as we did our best to have redundancy, and a Babel local recording, and saving, and whatnot, the internet was bad, the audio was bad, everything was bad, so we ar...
I am joined by my co-host, Ian. Hey, Ian. How are you doing?
**Ian Lopshire:** I'm doing well. This one's gonna be interesting for me, because I'm definitely still one of those print people... So we'll see if I learn anything.
**Natalie Pistunovich:** We are also joined by Liran Haimovitch and by Tiago Queiroz. Gentlemen, would you like to introduce yourselves? Liran, you are joining us from one hour in the future; you're joining us one hour away from Berlin, you are in Tel Aviv.
**Liran Haimovitch:** Yeah. So I can definitely relate... Print has its privileges, because debuggers can be so cumbersome, and often hard to use in so many cases, and it's so much easier to just say "I want to know what's happening on this line. Let me add a line, recompile, rebuild, ship it and get to know whatever i...
So my name is Liran Haimovitch, I'm the CTO of Rookout. I spent about a decade doing cybersecurity, and for the past - wow, is it six years now? ...I've been focusing mostly on observability and how to use dynamic instrumentations and other concepts from cybersecurity to make observability, debugging more agile and eas...
**Natalie Pistunovich:** Thank you for joining us. Tiago, you are also here in Berlin.
**Tiago Queiroz:** Yes. Hi, everybody. I'm Tiago. Yeah, I live here in Berlin. I'm originally Brazilian. So I'm a software engineer, I've been working mainly, almost exclusively with Go for more than five years now. Currently, I work for Elastic, on the Elastic Agent and Beats. It's interesting, because lots of our deb...
Yeah, and most of my work experience before Elastic was with startups and microservices. I also worked a lot in the sense of like bringing observability into some places, and I was always advocating for better observability and debugging tools. So yeah, that's a topic that I enjoy a lot, and try to always bring more, l...
**Natalie Pistunovich:** The AI... The AI will be telling you "You broke it because of that."
**Tiago Queiroz:** Yeah.
**Natalie Pistunovich:** So let's talk about some practices that we have today, without the AI. What are some good and bad practices in debugging, that are maybe specific to Go?
**Tiago Queiroz:** I think definitely it's a good practice to always have logs on your application. Make sure you write your application and you have proper log statements.
It's a very broad concept what is proper or enough, and something that you basically learn by doing, by seeing all the applications... But definitely, you should have enough logs for things, especially for like -- if you write a web server, ideally as soon as the HTTP service runs, it should say "Hey, I'm running on th...
\[07:55\] I think the best example - sometimes you run something in staging, on a port, and then in production on another one, but then if you don't set the configuration right, things just don't work, and then if you don't have any log statement, then you think "Hey, I'm actually starting my web server on port 3000, n...
So definitely really think when the application is running or starting what an engineer or even a user that's using your application might need to know if something goes wrong, or just to know about the current state of the application.
**Liran Haimovitch:** So the tricky thing about debugging any language, I would say, is that you're probably debugging the unpredictable... Because if something is predictably broken, then you're probably going to have a log line somewhere saying -- the system is essentially saying "I'm broke. This is why. Just go ahea...
If you are bothering to debug something, then it's unpredictable to you in some way. Maybe because the debugging is super-complex, maybe because there's many dependencies, maybe because you're not that much of an expert in Go or in the application itself... And that's perfectly fine, nobody's perfect, and we all have o...
And speaking of Go in particular, one thing I've found that often confounds people is that Go is not supposed to have exceptions, and yet it somehow kind of does. Now, I'm not trying to argue with anyone about anything, but panics and defers act very similar to exception throwing and catching them. And if you are new t...
But either way, if you're looking at an error flow, if you're looking at an unpredictable outcome, it's always good to think about "Is there any chance something is panicking here? And if it is, how can I test it or how can I make sure nothing is panicking." Because you'll often find that, whether intentionally or unin...
**Natalie Pistunovich:** So what would you say is the difference between debugging locally versus debugging in the cloud?
**Tiago Queiroz:** I think the main difference is debugging locally you can run the debug in slow motion. Actually, I was at GopherCon in a workshop from Bill Kennedy, and he had told this quote that was very interesting: "The function of the debugger is to run your bug in slow motion." Basically, that's the only thing...
**Natalie Pistunovich:** It's a nice quote.
**Tiago Queiroz:** It's actually very interesting... And at the end of the day, that's it, right? When you attach a debugger to an application, usually you only do it locally. You can literally run the code in slow motion, stop and introspect things, right? I find it extremely useful to have debuggers when you do not f...
\[12:05\] Of course, then I'm like, "Okay, \[unintelligible 00:12:04.23\] I usually have a hint of what's happening. When I have no clue, usually \[unintelligible 00:12:11.28\] And I think that's one of the main differences from the cloud - you can actually attach a debugger. You can run things in slow motion. Because ...
**Liran Haimovitch:** Yeah. So debugging in the cloud sucks... It just sucks, because the two techniques we're used to working with for debugging just don't work as well. 99% of the times you can't touch a debugger; when you're running in the cloud, you can't attach a traditional debugger, whether it's because you don'...
And there are other slew of technical problems, but 99% of the time you're not gonna be able to attach that debugger to have the beauty of watching your code move in slow motion, so that you can actually spot the bug as it's moving at lightning speed through your code.
Also, logs, which are nice -- they're definitely better than debuggers, but you can't use it all. But again, when you go to the realm of unpredictability, logs are more often than not -- I wouldn't say enough or not enough, because that's a harsh statement, but they can be challenging to read. They can be challenging t...
And as Ian literally started the call with about "I like to add prints to get a better sense of things", and I think prints, when your code is running in the cloud - that takes a while. You have to add the code, then you have to either build it locally, or push it through the remote, and then you have \[unintelligible ...
So you can still debug with prints, but changing them becomes very painful and slow... Which is part of the reason that the new form of debuggers, the live debuggers have kind of spun up, which are super-useful... And we actually released Go support last year. I think that's something that makes cloud debugging so much...
**Ian Lopshire:** Yeah, I wanna hear more about that cloud debugging... I've not heard of that. It's kind of blowing my mind... Can you just elaborate a little bit?
**Liran Haimovitch:** \[15:46\] Sure. So at Rookout what we aim to do is provide you with developer observability in general, but first and foremost a debugger-like experience, without any debugger involved, essentially. What we ask you to do is install our agent or SDKs. For Go it's just a Go module. And that Go modul...
We slow the application for a millisecond or two when we capture that snapshot, and then you can read it, take a look at it offline, at your leisure. You can go back and forth between different snapshots, so you can see how the code is running, supposedly in slow motion, except the code ran really fast, as it was execu...
**Break:** \[17:12\]
**Natalie Pistunovich:** So you mentioned that you can do this cloud debugging with the snapshots of how things are when you place those breakpoints; as a way of doing that in the cloud it is quite easy, or easier. What general some good practices that you have to make debugging easier? What can you do to help yourself...
**Liran Haimovitch:** So obviously, logging. As Tiago mentioned, logs are awesome. You shouldn't skimp on logging. You should also keep in mind that there is such a thing as too much logs, especially when you get your bill from your log aggregator... So do watch out for that. But that's an entire topic, about optimizin...
The other thing, which touches back to a point I've mentioned, is when you're writing code, focus on the error conditions. I think I read somewhere that when you write code, about 20% of your code deals with the happy flow, deals with what should happen, and then 80% of your code deals with what shouldn't happen; with ...
While it's definitely useful to write a log line saying you've entered a function - maybe it's an important function, maybe it's gonna be useful someday - that log line is far more likely to be noise and far more likely to end up in the bin of those logs that are costing you way too much money, and it's time to turn th...