-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
write_prometheus plugin: Use the unit
field to create metric names.
#4220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I did review, I looked only at how the code works, and did not think about how it maps the units. Here are late comments on latter.
.name = "system.processes.created", | ||
.type = METRIC_TYPE_COUNTER, | ||
.want = "system_processes_created_total", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw. _created
suffix has special meaning in OpenMetrics and Prometheus clients, see:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think about this too much to be honest. I simply grabbed the table from https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus and implemented it. I think it's a good start to iterate from.
I don't know how common it is for metric names to end in _created
. If this is a problem, I'm sure we can deal with it when it pops up.
Sounds reasonable. Items could be left unresolved as reminders, or you can resolve them if you do not think that necessary. |
Reference: https://opentelemetry.io/docs/specs/otel/compatibility/prometheus_and_openmetrics/#metric-metadata-1
ChangeLog: Write Prometheus plugin: Units are appended to metric family names if available.