You can collect metrics about your Redis instance with the OpenTelemetry collector. The collector is a component of OpenTelemetry that collects, processes, and exports telemetry data to New Relic (or any observability backend). The Redis receiver is designed to retrieve Redis INFO data from a single Redis instance, build metrics from that data, and send them to the next consumer at a configurable interval.
After going through the installation steps, you'll view this metric data in pre-built dashboards, create alert policies, and create custom queries and charts.
In order to start collecting Redis metrics, you need to sign up for a free New Relic account.
Once you've signed up, make sure you've set up:
- The redis receiver component, as the collector requires access to Redis through an endpoint. Minimum version recommended is v0.83.0.
- The OpenTelemetry collector following OpenTelemetry docs
You will need to install OpenTelemetry Collector Contrib Distro. If you're using another distribution, confirm that your chosen distribution has the following components:
If your distribution does not have these components, then the config file in the next step does not apply.
Update or create a new file called
config.yaml. Insert the following snippet into your new file:
receivers:redis:endpoint: "<YOUR_REDIS_HOSTNAME>:<REDIS_PORT>"metrics:# Enable redis.maxmemory optional metricredis.maxmemory:enabled: trueprocessors:# This is needed since redis receiver is not currently adding any means to understand to which redis server the metrics are referring toattributes/redis_metrics:include:match_type: regexpmetric_names:# Notice that if with single or without quotes just one backslash is needed 'redis\..*'- "redis\\..*"actions:- action: upsertkey: server.addressvalue: "<YOUR_REDIS_HOSTNAME>"- action: upsertkey: server.portvalue: "<REDIS_PORT>"# resource and resource-detection processors allow decorating the metrics with host attributesresource:attributes:- key: host.idfrom_attribute: host.nameaction: insertresourcedetection:detectors: ["env", "system"]resourcedetection/cloud:detectors: ["gcp", "ec2", "azure"]timeout: 2soverride: falseexporters:otlp:endpoint: https://otlp.nr-data.net:443headers:api-key: <NEW_RELIC_LICENSE_KEY>service:telemetry:logs:pipelines:metrics:receivers: [redis]processors:- resourcedetection- resourcedetection/cloud- resource- attributes/redis_metricsexporters: [otlp]
- Replace the
NEW_RELIC_LICENSE_KEYin the file with your own values. For more info, see the New Relic License key.
- Since no identificator is attached by the OTel receiver to redis metrics, an attribute processor is needed to decorate metrics with
server.portmetadata. The attributes
server.portare needed to be able to query and facet data differentiating between Redis servers and to create New Relic entities.
- Moreover, separate pipelines with different instances of
resource/redis_metricsare needed in case multiple Redis servers are monitored from a single otel collector to decorate each instance with the corresponding metadata.
To look at other configuration options, see:
Run the OpenTelemetry collector (the way to run it may vary depending on the chosen installation method). Example:
/usr/bin/otelcol-contrib --config ./config.yaml
Telemetry data originating from the OpenTelemetry Redis receiver, if properly decorated, generates redis entities. Entities are anything that reports data to New Relic and is identified by an unique entity ID.
Your monitored entities are the drivers of features like Entity Explorer, Workloads, and Lookout. Check this document for more information on how to get benefited from these experiences.
You may use the metrics explorer to check the metrics being ingested. All metrics reported by the redis receiver start by the
The following NRQL queries show examples to help you query the metrics you received:
Listing number of metric updates ingested by metric name:SELECT count(*) FROM Metric WHERE metricName LIKE 'redis.%' and instrumentation.provider='opentelemetry' facet metricName LIMIT max
Querying a specific metric faceted by host:SELECT average(redis.commands.processed) FROM Metric WHERE instrumentation.provider='opentelemetry' FACET host.name TIMESERIES
Listing dimensions available for a given metric:SELECT keyset() FROM Metric WHERE metricName = 'redis.commands.processed'
For a list of all the supported metrics, please refer to the redis receiver metrics reference.
With your Redis data reporting to New Relic, you can install the Redis Open Telemetry dashboard. This gives you a pre-made dashboard experience so you can track and monitor your Redis infrastructure.
If you're looking for help with other collector use cases, see the newrelic-opentelemetry-examples repository.