Monitoring Golang Redis Performance and Errors

This document explains how to monitor Go Redis client performace using OpenTelemetry.

What is OpenTelemetry?

OpenTelemetryopen in new window is an open-source observability framework for OpenTelemetry tracingopen in new window (including logs and errors) and OpenTelemetry metricsopen in new window.

OpenTelemetry aims to simplify and standardize the process of instrumenting and observing software, making it easier to gain insights into the performance, behavior, and health of distributed systems.

OpenTelemetry is designed to be vendor-agnostic and works across multiple programming languages, frameworks, and environments. It offers a range of language-specific SDKs and instrumentation libraries that make it easier to integrate telemetry collection into your applications.

OpenTelemetry also provides exporters and integrations to send telemetry data to various OpenTelemetry backendopen in new window systems and observability platforms, including popular tools like Prometheus, Grafana, Jaeger, Zipkin, Elasticsearch, and more.

OpenTelemetry instrumentation

go-redis comes with an OpenTelemetry Redisopen in new window instrumentation called redisotelopen in new window that is distributed as a separate module:

go get

To instrument Redis client, you need to add the hook provided by redisotel. The same methods can be used to instrument redis.Client, redis.ClusterClient, and redis.Ring.

import (

rdb := redis.NewClient(&redis.Options{...})

// Enable tracing instrumentation.
if err := redisotel.InstrumentTracing(rdb); err != nil {

// Enable metrics instrumentation.
if err := redisotel.InstrumentMetrics(rdb); err != nil {

To make tracing work, you must pass the active trace contextopen in new window to go-redis commands, for example:

ctx := req.Context()
val, err := rdb.Get(ctx, "key").Result()


Uptrace is an open source APMopen in new window that supports distributed tracing, metrics, and logs. You can use it to monitor applications and set up automatic alerts to receive notifications via email, Slack, Telegram, and more.

You can install Uptraceopen in new window by downloading a DEB/RPM package or a pre-compiled binary.

As expected, redisotel creates spansopen in new window for processed Redis commands and records any errors as they occur. Here is how the collected information is displayed at Uptraceopen in new window:

Redis trace

You can find a runnable example at GitHubopen in new window.


OpenTelemetry can also integrate with Prometheus, a popular monitoring and alerting system, to collect and export telemetry data.

By integrating OpenTelemetry with Prometheus, you can leverage the powerful monitoring and alerting capabilities of Prometheus while benefiting from the flexibility and standardization provided by OpenTelemetry. This integration enables you to collect, store, visualize, and analyze metrics from your applications and systems, gaining valuable insights into their performance and behavior.

You can send OpenTelemetry metrics to Prometheus using OpenTelemetry Prometheus exporteropen in new window.


By monitoring Redis performance, you can ensure that your Redis infrastructure operates smoothly, performs optimally, and meets the demands of your applications and users. It allows you to proactively address issues, optimize resource utilization, and maintain the reliability and responsiveness of your Redis deployment.