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

[TC Review - Metrics] Duplicate registration logic #3042

Closed
Tracked by #2889
jsuereth opened this issue Nov 16, 2022 · 4 comments · Fixed by #4361
Closed
Tracked by #2889

[TC Review - Metrics] Duplicate registration logic #3042

jsuereth opened this issue Nov 16, 2022 · 4 comments · Fixed by #4361
Assignees
Labels
bug Something isn't working metrics

Comments

@jsuereth
Copy link

jsuereth commented Nov 16, 2022

The warning for duplicate instrument registration is incorrect. It should check for duplicate instruments with same name and different unit/description etc (distinct) rather than all fields being the same
Relevant spec
Relevant code

The specification verbage is a bit odd here, but from a user standpoint, we want to achieve the following:

  • Metric name is the identifying part of an instrument. Description + Unit can actually change without breaking compatibility of the metric itself.
  • The warning is meant to tell users when description or unit diverge between registrations of the same instrument.
  • Calling create_counter multiple times from multiple locations for the same type of metric (e.g. http.server.duration) should be ok, e.g. if you're instrumenting different HTTP server libraries.

In Java we went so far as to distinguish conflicts resulting from View-based renames during instrument registration. The reason we did them all in a big bundle is an implementation detail.

Specifically, in python I'm worried that:

  • Instrument Identity (for error reporting) is based on name, unit and description rather than just name. It's ok for identity to be this, by specification, but the error reporting should STILL report on conflicts by name.
  • The error message should be outlined when there is a conflict in unit/description. Today it outputs on a (viable) use case.
@jsuereth jsuereth added the bug Something isn't working label Nov 16, 2022
@lzchen lzchen added the metrics label Nov 17, 2022
@nstawski
Copy link
Contributor

I would like to take this issue.

@davidji99
Copy link

Hmm, this seems to still be an issue even on 1.27.0?

@xrmx
Copy link
Contributor

xrmx commented Dec 10, 2024

@jsuereth Currently we are just printing warnings (in the wrong case), once fixed should the call to create an instrument with different unit or description when from another one with the same name already registered fail?

@xrmx
Copy link
Contributor

xrmx commented Dec 11, 2024

@jsuereth Currently we are just printing warnings (in the wrong case), once fixed should the call to create an instrument with different unit or description when from another one with the same name already registered fail?

Looking at other languages implementations this looks like more of a nice to have warning since I'm not finding this check anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working metrics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants