Monitoring Redis Server With OpenTelemetry Collector

This article explains how to install and configure OpenTelemetry Collector to monitor Redis Server or Redis Cluster.

What is OpenTelemetry Collector?

OpenTelemetry Collector is a proxy service between your application and a tracing backend. It receives telemetry data, transforms the data, and then exports it to backends that can store the data permanently.

Collector can also work as an agent that pulls telemetry data (for example, metrics) from monitored programs and then exports it to the configured backends. In this article we will use Collector as an agent to collect Redis Server metrics.

Installing OpenTelemetry Collector

OpenTelemetry Collector distributes pre-compiled binaries for Linux, MacOS, and Windows. You can install and configure it within minutes.

To install otel-contrib-collector binary with the associated systemd service on Debian/Ubuntu:

2sudo dpkg -i otel-contrib-collector_0.34.0_amd64.deb


2sudo rpm -ivh otel-contrib-collector-0.34.0-1.x86_64.rpm

You can check the status of the installed service with:

1sudo systemctl status otel-contrib-collector

Configuring OpenTelemetry Collector

By default, you can find the config file at /etc/otel-contrib-collector/config.yaml. It has the following sections:

  • receivers configures how data gets into the Collector.
  • processors specifies what happens with the received data.
  • exporters configures how you send processed data to one or more backends.
  • service pulls the configured receivers, processors, and exporters together into a processing pipeline. Don’t repeat a common mistake by configuring a receiver or an exporter without adding it to a processing pipeline.

You can learn more about Collector configuration at the official documentation .

Monitoring Redis

To start monitoring Redis, you need to replace /etc/otel-contrib-collector/config.yaml with the following config using Uptrace DSN :

 2  otlp:
 3    protocols:
 4      grpc:
 5      http:
 6  hostmetrics:
 7    collection_interval: 10s
 8    scrapers:
 9      cpu:
10      disk:
11      load:
12      filesystem:
13      memory:
14      network:
15      paging:
16  redis:
17    endpoint: localhost:6379
18    collection_interval: 10s
21  otlp:
22    endpoint:
23    headers: { 'uptrace-dsn': '<FIXME>' }
26  resourcedetection:
27    detectors: [system]
28  batch:
29    timeout: 10s
32  pipelines:
33    traces:
34      receivers: [otlp]
35      processors: [batch]
36      exporters: [otlp]
37    metrics:
38      receivers: [otlp, redis, hostmetrics]
39      processors: [batch, resourcedetection]
40      exporters: [otlp]

Don’t forget to restart the service:

1sudo systemctl restart otel-contrib-collector

Checking OpenTelemetry Collector logs can also be a good idea:

1sudo journalctl -u otel-contrib-collector -f

Available metrics

When telemetry data reaches Uptrace, it automatically generates a Redis dashboard from the pre-defined template.

Redis metrics

What’s next

Next, you can use Collector configurator to tweak your config and create custom instruments using OpenTelemetry Metrics API .