-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Impossible to create Instrument with the same name from the different MeterProvider #3161
Comments
as discussed in #3357 (review) this issue is also blocked by open-telemetry/opentelemetry-specification#2890 |
@fatsheep9146 this issue should not be blocked. The referenced issue is merged in the specification and we should implement a solution that address it. Let me know if you are still able to work on this. |
Yes, I am working on this. =D @MrAlias |
Where is How are we supposed to serve metrics to prometheus now ? |
I think you can see this example as reference. @eddycharly |
@fatsheep9146 thanks, I did the same as in https://github.com/open-telemetry/opentelemetry-go/tree/main/example/prometheus. I now see crazy metrics like |
Could you paste your code? @eddycharly |
Basically the same as in the example, my metric is created like this:
|
The code initialising otel is here https://github.com/eddycharly/kyverno/blob/a8a496c8b231e1587797dc4af464ce747a524384/pkg/metrics/metrics.go#L169-L203 |
First of all, the best practice to create a counter which is monotonically is not include the "total " suffix when you call So I suggest you change your code into
Then finally you can get the metric name |
@fatsheep9146 the suggested changes didn't fix the issue, I still observe metrics like this:
|
@fatsheep9146 it looks like it's fixed on |
Offending code (should have been out of the for loop) opentelemetry-go/exporters/prometheus/exporter.go Lines 207 to 210 in 2fe8861
|
@eddycharly |
Any idea when the next release containing the fix might come out ? |
I think the milestone is tracked here. https://github.com/open-telemetry/opentelemetry-go/milestone/34 |
Thank you so much 🙏 |
Description
More that year have passed since I wrote about this in Slack and it is still here.
I am trying to use Meter API, count some data and collect it with Prometheus. It is possible situation, when you need the same Instrument name with the different prefixes.
I guess that Meter name is the prefix, but not. And If I will try to create two Meters and for each one create Instrument with the same name than I will get an error.
Environment
Steps To Reproduce
Expected behavior
I expect that I could create different Meters which isolate their Instruments (like namespace) and Instruments with the same name will not conflict between themselves in case if it was created with different Meters.
The text was updated successfully, but these errors were encountered: