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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions