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

Observable metrics with different attributes reported only once #5561

Closed
dmitryax opened this issue Jun 29, 2024 · 5 comments · Fixed by #5606
Closed

Observable metrics with different attributes reported only once #5561

dmitryax opened this issue Jun 29, 2024 · 5 comments · Fixed by #5606
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dmitryax
Copy link
Member

dmitryax commented Jun 29, 2024

Description

The original issue was reported at open-telemetry/opentelemetry-collector#10444.

Several calls of meter.Int64ObservableGauge submitted for the same metric with different attribute sets result in only one of them being reported, randomly picked.

I found that the collector issue was introduced after the upgrade of the go library v1.22.0 -> v1.23.0 in open-telemetry/opentelemetry-collector#9486.

I suspect the regression was introduced in #4820, but I haven't verified it.

@dmitryax dmitryax added the bug Something isn't working label Jun 29, 2024
@dmitryax
Copy link
Member Author

dmitryax commented Jul 3, 2024

Confirmed that the issue is caused by #4820. I'll work on a fix

@dmitryax
Copy link
Member Author

dmitryax commented Jul 8, 2024

I didn't find a clean way to cache callbacks. I fixed the original issue in the collector by registering callbacks separately open-telemetry/opentelemetry-collector#10550

cc @dashpole

@dashpole
Copy link
Contributor

I believe this is WAI. I've opened #5606 to update comments I missed in the initial PR.

The previous behavior created a memory leak for people using the API, and I don't believe there is a way to address that without caching.

@dashpole
Copy link
Contributor

This could be fixed if OTel had bound instruments, since the attributes would be pre-defined instead of defined inside the callback. We would then be able to cache one callback for each bound (with attributes) instrument.

@dmitryax
Copy link
Member Author

This could be fixed if OTel had bound instruments, since the attributes would be pre-defined instead of defined inside the callback. We would then be able to cache one callback for each bound (with attributes) instrument.

That is how I envisioned it before looking into the existing API.

MrAlias added a commit that referenced this issue Jul 12, 2024
…ith callbacks (#5606)

In #4820, I only
added a comment describing the behavior to `Int64ObservableCounter`, but
forgot other instruments. This adds the comment to all observable
instruments.

Fixes #5561

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
@MrAlias MrAlias added this to the v1.29.0 milestone Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants