Distributed tracing with go-redis, Upstash and OpenTelemetry
Blog post from Upstash
This tutorial explores how to connect to an Upstash Redis database using the go-redis client and monitor application performance through distributed tracing, utilizing tools like OpenTelemetry and Uptrace. It details the functionality of go-redis, a popular Redis client for Golang that supports Redis Server, Sentinel, and Cluster, and describes its use in caching data or rate-limiting API requests. The concept of distributed tracing is explained as a method to track requests across distributed systems, offering insights into system performance and issues. OpenTelemetry is introduced as a vendor-neutral standard for collecting and exporting traces, logs, and metrics, enabling interoperability across various programming languages and environments. The integration of OpenTelemetry with go-redis through the redisotel module is demonstrated, showing how to instrument the Redis client to create spans and record errors, which can then be visualized using Uptrace, an open-source alternative to DataDog. The tutorial concludes by encouraging further exploration of OpenTelemetry's capabilities for monitoring different application aspects, such as using additional instrumentations for frameworks like Gin or Go gRPC.