Skip to content
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

Add missing unit in metadata.yaml #23449

Closed
wants to merge 12 commits into from

Conversation

mackjmr
Copy link
Member

@mackjmr mackjmr commented Jun 19, 2023

Description:
Metric unit is required, see: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/cmd/mdatagen/metadata-schema.yaml#L72-L73.

This PR adds the unit to all metrics where this is missing.

I have inferred the unit from the metric name, and would appreciate that someone more familiar with the receivers in question review the chosen units.

Metric unit is required, see: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/cmd/mdatagen/metadata-schema.yaml#L72-L73.

This PR adds the unit to all metrics where this is missing.

I have inferred the unit from the metric name, and would appreciate that someone more familiar with the receivers in question review the chosen units.
receiver/redisreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/redisreceiver/metadata.yaml Outdated Show resolved Hide resolved
@@ -200,14 +201,14 @@ metrics:
redis.memory.fragmentation_ratio:
enabled: true
description: Ratio between used_memory_rss and used_memory
unit: ""
unit: "{ratio}"
Copy link
Member

Choose a reason for hiding this comment

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

Not sure I agree with this one. "ratio" describes the value in a way, but it's not a unit of measurement.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, seeing that ratios are unitless I'm not sure what to put here 🤔 ? I've removed it for now.

Copy link
Member

Choose a reason for hiding this comment

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

👍 I believe "1" is the default unit, but it's ok to just omit it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm working on validation of the metadata.yaml (issue), and one of the checks that I currently have makes sure that the unit is not empty because it is a required field. This is an edge case, as the metric is unitless.
I've made a commit to put the unit to 1 for redis.memory.fragmentation_ratio instead of leaving it empty -- let me know if this is OK ?

Copy link
Member

Choose a reason for hiding this comment

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

I think 1 is the correct unit for ratio

receiver/redisreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/redisreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/redisreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/redisreceiver/metadata.yaml Outdated Show resolved Hide resolved
mackjmr added a commit to mackjmr/opentelemetry-collector-contrib that referenced this pull request Jun 19, 2023
This PR adds the bytes unit to metrics where this is missing. unit is a required field, see https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/cmd/mdatagen/metadata-schema.yaml#L72-L73. The rest of the units (non-breaking) are being addressed in a separate PR: open-telemetry#23449.
mackjmr and others added 6 commits June 19, 2023 17:21
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
@djaglowski
Copy link
Member

@mackjmr, thanks for this PR. In order to pass tests, you'll have to also update the "golden" files for the affected scrapers.

The easiest way to do this is to regenerate the files. You can do this by temporarily inserting a call to golden.WriteMetrics in failing tests that currently have golden.ReadMetrics. (example)

@mackjmr
Copy link
Member Author

mackjmr commented Jun 19, 2023

Thanks for the explanation @djaglowski, I've updated the golden files 👍

@dmitryax
Copy link
Member

@mackjmr, can you please split the PR into one per component and add changelog entries?

@mackjmr
Copy link
Member Author

mackjmr commented Jun 20, 2023

@dmitryax split into 1 PR per component with changelog:

Closing this PR.

@mackjmr mackjmr closed this Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants