Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

shmsr
Copy link

@shmsr shmsr commented Jun 20, 2025

Description

Fix unit conversions for duration-based metrics to properly convert from microseconds/milliseconds to seconds

  • Convert redis.cmd.usec to redis.cmd.sec with proper microsecond to second conversion
  • Convert redis.db.avg_ttl from milliseconds to seconds
  • Convert redis.latest_fork from microseconds to seconds
  • Change value types from Int to Double for affected metrics to preserve precision

Link to tracking issue

Fixes #40826

Testing

Documentation

CL added and config.md also updated (not autogenerated)

@shmsr shmsr requested review from dmitryax and a team as code owners June 20, 2025 21:04
Copy link

linux-foundation-easycla bot commented Jun 20, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added the receiver/redis Redis related issues label Jun 20, 2025
@shmsr shmsr changed the title receiver/redisreceiver: Fix duration unit inconsistencies to comply with OTel guidelines [redisreceiver] Fix duration unit inconsistencies to comply with OTel guidelines Jun 21, 2025
@github-actions github-actions bot requested a review from hughesjj June 24, 2025 17:24
@shmsr
Copy link
Author

shmsr commented Jun 27, 2025

@dmitryax / @hughesjj / @edmocosta Did you get a chance to look at this?

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 15, 2025
@shmsr
Copy link
Author

shmsr commented Jul 15, 2025

Following up on this — let me know if you need anything from my side.

@edmocosta edmocosta removed the Stale label Jul 15, 2025
Copy link
Contributor

@hughesjj hughesjj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, few nits and one concern

recordDataPoint(ts, val)
if infoKey == "latest_fork_usec" {
val /= 1e6 // Convert us to s
recordDataPoint(ts, val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: given we're doing recordDataPoint regardless, let's move the call outside of the conditional

attributes: [db]
# below are all disabled by default
redis.replication.replica_offset:
enabled: false
description: "Offset for redis replica"
description: Offset for redis replica
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we add the quotes for all these descriptions back, as they're unrelated to the change? Probably better to have quotes regardless when working with yaml, not that we lint it at all.


| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| us | Gauge | Int |
| s | Gauge | Double |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a wary of changing int into float. Is there any reason we could not floor, truncate, or round-nearest while maintaining an int instead?

@dmitryax I'll defer to you on this one. IIRC there could be some downstream issues in languages using these metrics given the type change.

I'd note the guidelines use SHOULD and not MUST

When instruments are measuring durations, seconds (i.e. s) SHOULD be used.

Copy link
Contributor

github-actions bot commented Aug 6, 2025

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 6, 2025
@atoulme atoulme marked this pull request as draft August 6, 2025 21:34
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/redis Redis related issues Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[redisreceiver] Fix duration unit inconsistencies to comply with OTel guidelines
4 participants