Skip to content

StableMetric ExemplarReservoir return empty data points #749

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

Closed
bryce-b opened this issue Apr 11, 2025 · 2 comments · Fixed by #752
Closed

StableMetric ExemplarReservoir return empty data points #749

bryce-b opened this issue Apr 11, 2025 · 2 comments · Fixed by #752
Assignees

Comments

@bryce-b
Copy link
Member

bryce-b commented Apr 11, 2025

Summary

When an exemplar reservoir's collectAndReset method is called, no care is taken to verify which cells are populated, thus empty exemplar datapoints are returned in the array.

public class FixedSizedExemplarReservoir: ExemplarReservoir {

Detail

Image

The storage is initialized with size number of ReservoirCell.

But the buckets have default values, and are only populated when offer measurement is called:

Image Image

If any cell has measurements, the method will return results from all cells, even if they haven't been populated.

@bryce-b
Copy link
Member Author

bryce-b commented Apr 14, 2025

The Java sdk uses the ReservoirCell getAndResetDouble or getAndResetLong for this method, which will return null if attributes is unset.
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/exemplar/ReservoirCell.java#L105

Image

@bryce-b bryce-b closed this as completed Apr 14, 2025
@bryce-b bryce-b reopened this Apr 17, 2025
@bryce-b
Copy link
Member Author

bryce-b commented Apr 17, 2025

mistakenly closed this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant