-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[k8sclusterreceiver] Some metric units don't follow Otel semantic conventions #10553
Comments
Pinging code owners: @dmitryax. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
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 Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been closed as inactive because it has been stale for 120 days with no activity. |
I plan to work on this once we finalize the #4367 For now the plan is to add a feature gate, which when enabled will change metric units. |
I think we can go without a feature gate. It's unlikely that changing units will break many backends |
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Fix Metrics that count objects should use units with brackets {} and not 1. Marking it as bug_fix because of #10553 (comment) Tested with prometheus exporter: Previously: ``` # HELP k8s_deployment_available Total number of available pods (ready for at least minReadySeconds) targeted by this deployment # TYPE k8s_deployment_available gauge k8s_deployment_available 1 # HELP k8s_deployment_desired Number of desired pods in this deployment # TYPE k8s_deployment_desired gauge k8s_deployment_desired 1 ``` Now: ``` # HELP k8s_deployment_available Total number of available pods (ready for at least minReadySeconds) targeted by this deployment # TYPE k8s_deployment_available gauge k8s_deployment_available 1 # HELP k8s_deployment_desired Number of desired pods in this deployment # TYPE k8s_deployment_desired gauge k8s_deployment_desired 1 ``` Atleast for this backend it's not breaking change? **Link to tracking Issue:** 10553 #10553 **Testing:** <Describe what testing was performed and which tests were added.> - updated tests **Documentation:** - generated
Hey! I've looked thru the exposed metrics and we are left with a couple of cases, which I'm not sure what to do. First is the "state" metrics like:
I think in this case unit "1" makes sense. WDYT? And another case, is we have metrics like these:
Where units depend on attribute. I think we will need to refactor these metrics. I am thinking doing something like we do with Node statuses (https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/k8sclusterreceiver/internal/node/nodes.go#L143-L154) move them outside mdatagen and do some custom logic. Thoughts? |
If feasible, that would be the best way to handle this, thank you @dmitryax! |
I've looked thru some mores docs and Otel Metrics API says that Instrument units are optional:
So I think we should allow empty units. I opened PR which allows to set |
Thanks for looking this up. Taking a quick look at opentelemetry-go it seems like the unit is left empty if not specified by the user so I agree we can leave this empty. |
**Description:** <Describe what has changed.> Allows setting empty metric units in mdatagen. Example of using it https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/27091/files **Tracking Issues:** #27089 #10553
**Description:** Change k8s.container.ready, k8s.pod.phase, k8s.pod.status_reason, k8s.namespace.phase units to empty **Link to tracking Issue:** #10553
I think only resourcequota and clusterresourcequota metrics are left with incorrect units. We currently expose "k8s.resource_quota.hard_limit" and "k8s.resource_quota.used" metrics, with resource coming from At the moment unit is the same for each resource and is configured to "1" in How should we fix this? I don't think mdatagen supports setting dynamic units? Any ideas @TylerHelmuth / @dmitryax ? ) |
@povilasv You could use either |
) change resourcequota and clusterquota metrics to use {resource} units. **Link to tracking Issue:** #10553
Updated to use I believe we are done with this task, all metrics seems to follow Otel semantic conventions. @bertysentry feel free to validate and let me know if something isn't right. |
…n-telemetry#27662) change resourcequota and clusterquota metrics to use {resource} units. **Link to tracking Issue:** open-telemetry#10553
…n-telemetry#27662) change resourcequota and clusterquota metrics to use {resource} units. **Link to tracking Issue:** open-telemetry#10553
…open-telemetry#26708) **Description:** Refactor some metric units to follow OTEL Semantic conventions **Link to tracking Issue:** open-telemetry#10553
…en-telemetry#27051) **Description:** Refactor k8s.container.restarts metric unit to be `{restart}` **Link to tracking Issue:** open-telemetry#10553
**Description:** <Describe what has changed.> Allows setting empty metric units in mdatagen. Example of using it https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/27091/files **Tracking Issues:** open-telemetry#27089 open-telemetry#10553
…telemetry#27091) **Description:** Change k8s.container.ready, k8s.pod.phase, k8s.pod.status_reason, k8s.namespace.phase units to empty **Link to tracking Issue:** open-telemetry#10553
…n-telemetry#27662) change resourcequota and clusterquota metrics to use {resource} units. **Link to tracking Issue:** open-telemetry#10553
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 Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I believe this can be closed. |
Describe the bug
Some metrics don't follow Otel semantic conventions
Steps to reproduce
Nothing to reproduce. The problem lies in the specification of the receiver itself.
What did you expect to see?
Metrics that count objects should use units with brackets
{}
and not1
Example:
k8s.container.restarts
==>Unit: "{restarts}"
k8s.cronjob.active_jobs
==>Unit: "{jobs}"
k8s.job.active_pods
==>Unit: "{pods}"
What did you see instead?
Many metrics specify unit
1
to report a count of objects:k8s.container.restarts
k8s.cronjob.active_jobs
k8s.job.active_pods
Unit
1
must be used only for fractions and ratios.What version did you use?
Main branch
What config did you use?
N/A
Environment
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: