Expert tier: Event-Driven Go with Observability
Build a production-grade Kafka event processor service in Go, instrumented with OpenTelemetry for structured logging, distributed tracing, and Prometheus metrics.
What you'll build
A complete event-driven service that produces and consumes Kafka messages, with:
- Structured logging via
log/slog— contextual, leveled, JSON-formatted - Distributed tracing with OpenTelemetry — trace messages across produce/consume boundaries
- Prometheus metrics — custom counters, histograms, and Go runtime instrumentation
- Graceful shutdown — drain in-flight messages on SIGTERM/SIGINT
- Docker Compose — local Kafka + Redpanda Console + Prometheus + Grafana
- Integration tests with Testcontainers — real Kafka in CI
Prerequisites
Completion of the Advanced tier (PostgreSQL, JWT auth, Docker, CI/CD) or equivalent Go and Docker experience.
Ladder
- Why event-driven — understand the problem domain and architectural motivation
- Kafka fundamentals — topics, partitions, consumer groups, and Go clients
- Producing events — write a typed producer with
segmentio/kafka-go - Consuming events — build a resilient consumer with manual offset management
- Structured logging — add
slogwith JSON output and request-scoped attributes - Distributed tracing — instrument produce and consume with OpenTelemetry spans
- Metrics — expose Prometheus metrics for throughput, latency, and errors
- Graceful shutdown — handle OS signals, flush traces, and close producers cleanly
- Docker Compose — orchestrate Kafka, the processor, and the observability stack
- Testing — integration tests with Testcontainers and isolated consumer groups
Technologies used
- Apache Kafka — distributed event streaming
- segmentio/kafka-go — pure Go Kafka client
- OpenTelemetry Go SDK — tracing and metrics
- log/slog — structured logging (Go 1.21+)
- Testcontainers for Go — disposable Kafka in tests
- Prometheus + Grafana — metrics collection and dashboards
- Docker Compose — local development environment
Ready to begin? Start with Why event-driven →