Description
Component(s)
receiver/redis
What happened?
Description
I noticed that three metrics, redis.db.avg_ttl
, redis.db.expires
, and redis.db.keys
were not longer being exported by the opentelemetry collector. Here is the output of the redis info
command when those metrics were not being exported:
...
# Keyspace
db1:keys=257,expires=245,avg_ttl=563071651
db3:keys=1,expires=0,avg_ttl=0
On a hunch, I connected and ran select 0; set foo bar ex 500
, and the metrics started being picked up and exported again. Here is the info
output when working:
# Keyspace
db0:keys=1,expires=1,avg_ttl=475547
db1:keys=258,expires=246,avg_ttl=552953557
db3:keys=1,expires=0,avg_ttl=0
Steps to Reproduce
Reproduced on: Redis 7.2.7 and 7.2.6, opentelemetry-collector-contrib 0.117.0 and 0.120.1.
Set up a redis instance and opentelemetry-collector with receivers: redis: ...
configured. Connect to redis and set
keys in db1-db15, but not in db0.
Expected Result
Metrics are exported for other databases even if db0 is unused.
Collector version
0.120.1
Environment information
Ubuntu 24.04, running opentelemetry collector via podman
using ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-amd64
OpenTelemetry Collector configuration
extensions:
basicauth/grafana_cloud:
client_auth:
username: ${env:GRAFANA_USER}
password: ${env:GRAFANA_PASSWORD}
receivers:
redis:
endpoint: "localhost:6380"
username: ${env:REDIS_METRICS_USER}
password: ${env:REDIS_METRICS_PASSWORD}
exporters:
otlphttp/grafana_cloud:
endpoint: "https://otlp-gateway-prod-eu-west-2.grafana.net/otlp"
auth:
authenticator: basicauth/grafana_cloud
processors:
batch:
# https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor
resourcedetection:
# Enriches telemetry data with resource information from the host
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourcedetectionprocessor
detectors: ["env", "system"]
override: false
transform/drop_unneeded_resource_attributes:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor
error_mode: ignore
trace_statements:
- context: resource
statements:
- delete_key(attributes, "k8s.pod.start_time")
- delete_key(attributes, "os.description")
- delete_key(attributes, "os.type")
- delete_key(attributes, "process.command_args")
- delete_key(attributes, "process.executable.path")
- delete_key(attributes, "process.pid")
- delete_key(attributes, "process.runtime.description")
- delete_key(attributes, "process.runtime.name")
- delete_key(attributes, "process.runtime.version")
metric_statements:
- context: resource
statements:
- delete_key(attributes, "k8s.pod.start_time")
- delete_key(attributes, "os.description")
- delete_key(attributes, "os.type")
- delete_key(attributes, "process.command_args")
- delete_key(attributes, "process.executable.path")
- delete_key(attributes, "process.pid")
- delete_key(attributes, "process.runtime.description")
- delete_key(attributes, "process.runtime.name")
- delete_key(attributes, "process.runtime.version")
log_statements:
- context: resource
statements:
- delete_key(attributes, "k8s.pod.start_time")
- delete_key(attributes, "os.description")
- delete_key(attributes, "os.type")
- delete_key(attributes, "process.command_args")
- delete_key(attributes, "process.executable.path")
- delete_key(attributes, "process.pid")
- delete_key(attributes, "process.runtime.description")
- delete_key(attributes, "process.runtime.name")
- delete_key(attributes, "process.runtime.version")
transform/add_resource_attributes_as_metric_attributes:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor
error_mode: ignore
metric_statements:
- context: datapoint
statements:
- set(attributes["deployment.environment"], resource.attributes["deployment.environment"])
- set(attributes["service.version"], resource.attributes["service.version"])
service:
extensions: [basicauth/grafana_cloud]
pipelines:
metrics:
receivers: [redis]
processors: [resourcedetection, transform/drop_unneeded_resource_attributes, transform/add_resource_attributes_as_metric_attributes, batch]
exporters: [otlphttp/grafana_cloud]
Log output
No relevant log output.
Additional context
No response
Activity