Skip to content

[redisreceiver] Fix duration unit inconsistencies to comply with OTel guidelines #40826

@shmsr

Description

@shmsr

Component(s)

receiver/redis

What happened?

Description

The Redis receiver has multiple duration metrics that don't comply with OpenTelemetry semantic conventions for units. According to OTel guidelines: "When instruments are measuring durations, seconds (i.e. s) SHOULD be used."

Affected metrics:

  • redis.cmd.usec - uses us instead of s
  • redis.latest_fork - uses us instead of s
  • redis.db.avg_ttl - uses ms instead of s

Was checking out this PR when I saw @dmitryax's comment here and I found out some issues that we need to fix.

Steps to Reproduce

NA

Expected Result

All duration metrics should use seconds (s) as the unit according to OTel guidelines:

  • redis.cmd.usec should report command execution time in seconds
  • redis.latest_fork should report fork duration in seconds
  • redis.db.avg_ttl should report average TTL in seconds

Actual Result

Duration metrics report in non-standard units that don't follow OTel conventions:

  • redis.cmd.usec reports in microseconds (us)
  • redis.latest_fork reports in microseconds (us)
  • redis.db.avg_ttl reports in milliseconds (ms)

From metadata.yml:

  redis.cmd.usec:
    enabled: false
    description: Total time for all executions of this command
    unit: us
    sum:
      value_type: int
      monotonic: true
      aggregation_temporality: cumulative
    attributes: [cmd]
  redis.latest_fork:
    enabled: true
    description: Duration of the latest fork operation in microseconds
    unit: us
    gauge:
      value_type: int
  redis.db.avg_ttl:
    enabled: true
    description: "Average keyspace keys TTL"
    unit: ms
    gauge:
      value_type: int
    attributes: [db]

Collector version

v0.128.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

Log output

NA

Additional context

NA

Activity

added
bugSomething isn't working
needs triageNew item requiring triage
on Jun 19, 2025
github-actions

github-actions commented on Jun 19, 2025

@github-actions
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

shmsr

shmsr commented on Jun 19, 2025

@shmsr
Author

I'd like to take this one.

VihasMakwana

VihasMakwana commented on Jun 19, 2025

@VihasMakwana
Contributor

Sounds good to me.

github-actions

github-actions commented on Aug 19, 2025

@github-actions
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @shmsr@VihasMakwana

    Issue actions

      [redisreceiver] Fix duration unit inconsistencies to comply with OTel guidelines · Issue #40826 · open-telemetry/opentelemetry-collector-contrib