This example demonstrates how to instrument and monitor Redis operations in Go applications using OpenTelemetry and Uptrace, providing comprehensive observability into your Redis performance and operations.
This integration provides:
- Distributed tracing for Redis operations
- Performance monitoring with latency and throughput metrics
- Error tracking and debugging capabilities
- Visual dashboards for Redis health monitoring
- Production-ready observability stack with Docker
- Go 1.19+
- Docker and Docker Compose
- Basic understanding of Redis and OpenTelemetry
git clone https://github.com/redis/go-redis.git
cd example/otelLaunch Redis and Uptrace services:
docker compose up -dThis starts:
- Redis server on
localhost:6379 - Uptrace APM on
http://localhost:14318
Check that Uptrace is running properly:
docker compose logs uptraceLook for successful startup messages without errors.
Execute the instrumented Redis client:
go run client.goYou should see output similar to:
trace: http://localhost:14318/traces/ee029d8782242c8ed38b16d961093b35
Click the trace URL to view detailed operation traces in Uptrace.
Open the Uptrace UI at http://localhost:14318 to explore:
- Traces: Individual Redis operation details
- Metrics: Performance statistics and trends
- Logs: Application and system logs
- Service Map: Visual representation of dependencies
For production environments, enable comprehensive Redis monitoring by installing the OpenTelemetry Collector:
The OpenTelemetry Collector acts as a telemetry agent that:
- Pulls performance metrics directly from Redis
- Collects system-level statistics
- Forwards data to Uptrace via OTLP protocol
When configured, Uptrace automatically generates a Redis dashboard:
- Connection Statistics: Active connections, connection pool utilization
- Command Performance: Operation latency, throughput, error rates
- Memory Usage: Memory consumption, key distribution
- Replication Health: Master-slave sync status and lag
View service logs:
# All services
docker compose logs
# Specific service
docker compose logs redis
docker compose logs uptrace
