Go for Infrastructure
Structured logging
Explain why structured log fields with stable names and types can be filtered exactly, and how to keep secrets and sensitive values out of the log stream.
What you will be able to do
- Design field names and types that every service logs the same way.
- Check each new log line for secrets before it is merged.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Go for Infrastructure
- TLS clientsIntermediate · 5 min
Explain how a Go TLS client builds the certificate chain and checks the host name, and fix chain errors by correcting the server or the trust roots, not by disabling…
- Error wrappingIntermediate · 5 min
Explain how fmt.Errorf with %w builds an error chain and how errors.Is and errors.As read it, so a sentinel error still reaches the handler that picks the status code.
- Prometheus instrumentationIntermediate · 4 min
Explain why each unique label combination adds a Prometheus time series, and choose metric types, names and labels that stay bounded as the system grows.
- OpenTelemetry tracingIntermediate · 5 min
Explain spans, trace context propagation and sampling in OpenTelemetry, so the time one request spends can be followed across services, queues and background jobs, with…
- Profiling with pprofIntermediate · 5 min
Explain what CPU, heap and goroutine profiles show, how to capture them during a problem, and how to read a top list and source lines with go tool pprof.
- Memory escapesIntermediate · 4 min
Explain how escape analysis decides whether a value lives on the stack or the heap, and how to read compiler output and benchmark allocations before changing code.