An Ode to Logging

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Oh, log, a nerdy scribe,
In you, all errors hide.
To write it well - not an easy quest,
Let's see how we can do it best!

True hackers always start with print()
Don't judge! They've got no time this sprint.
But push to prod - a fatal flaw.
Use proper logger - that's the law!

Distinguish noise from fatal crash -
Use Info, Error, Warn, and Trace.
Put a clear level in each line,
To sift through data, neat design!

You log for humans, this is true...
But can a machine read it too?
Structure is key, JSON, timestamp...
Grafana tells you: "You're the champ!"

Events, like books, have start and end.
Use Spans to group them all, my friend.
Then take these Spans and build a tree,
We call it Trace, it's cool agree?

Redact your logs: remove emails,
addresses, PII details.
Or data breach is soon to come,
and trust me, it's not fun :(

In modern distributed world,
Do centralize your logs, my Lord.
Retention policy in place?
Or cloud bill you will embrace!

(No LLMs have been used to write this)

My first experience with Gleam Language

Over the past few months, I saw a growing amount of posts on X about the Gleam language (probably the X algorithm doing its thing), and decided to give it a try. I was not disappointed, with few exceptions.

Snake game in Go using Ebiten

Snake game in Go using Ebiten

Ebiten is an open source game library in Go for building 2D games that can be ran across multiple platforms. Ebiten games work on desktop, web browsers (through WebAssembly), as well as on Mobile and even on Nintendo Switch.

Logging in Go using logrus

Logging is a very essential part of large software, it’s hard to overstate the importance of logging, be it performance metrics logging, error logging, or debug logging for troubleshooting later.

Engineering Management Books

We live in the world where there are so many offerings of information in all possible formats: podcasts, videos, blogs, etc. But reading a good book is something that you’ll never regret.

Writing testable Go code

Writing testable Go code

When I say “testable code”, what I mean is code that can be easily programmatically verified. We can say that code is testable when we don’t have to change the code itself when we’re adding a unit test to it. It doesn’t matter if you’re following test-driven development or not, testable code makes your program more flexible and maintainable, due to its modularity.

Writing REST API Client in Go

API clients are very helpful when you’re shipping your REST APIs to the public. And Go makes it easy, for you as a developer, as well as for your users, thanks to its idiomatic design and type system. But what defines a good API client?

Mounting Google Cloud Storage bucket to Kubernetes Pod

Mounting Google Cloud Storage bucket to Kubernetes Pod

You may ask why doing this if we can use a PersistentVolume? Though there may be multiple scenarios when mounting a GCS bucket to you Kubernetes Pod is a good option:

Google Home Action to manage your Kubernetes cluster

I always wanted to find a good use case of Google Home to make some DevOps tasks funnier. For example voice deployments, system metrics, etc. Since I use Kubernetes a lot, I thought it would be fun to control it via voice commands.

Rate Limiting HTTP Requests in Go based on IP address

If you are running HTTP server and want to rate limit requests to the endpoints, you can use well-maintained tools such as github.com/didip/tollbooth. But if you’re building something very simple, it’s not that hard to implement it on your own.