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

Metrics: data points are not cleared on collection #19

Open
inge4pres opened this issue Feb 13, 2025 · 0 comments
Open

Metrics: data points are not cleared on collection #19

inge4pres opened this issue Feb 13, 2025 · 0 comments
Assignees
Labels
bug Something isn't working metrics

Comments

@inge4pres
Copy link
Collaborator

inge4pres commented Feb 13, 2025

Describe the current state

With the changes proposed in #14 we switch from aggregating data when the instruments are recording a data point to aggregating when collection happens by a MetricReader.

That said, we haven't added a way to discard the data points that are collected from the reader.
e.g. in Counter measurementsData

https://github.com/zig-o11y/opentelemetry-sdk/pull/14/files#diff-888687124bb8e8a88554f63e9b1ff30937ac5aa7f7298b874a3f462d6c568679R210-R219

we fetch all the data points from the measurements arraylist, but then we don't remove them from the arraylist, letting it ever growing.

This is similar in all other instruments.

Describe the desired state

We should:

  1. ensure that the collection cycle is thread-safe, because measurementsData could be called from another thread than other modifying it
  2. clean up the items fetched for collection from the state of the instrument

For point 2., we could use toOwnedSlice() but we should first understand if the allocator that is passed as part of the collection is the same used for recording datapoints (unlikely).
If we want to keep a clean separation between the allocators, copying in place the items seems to be simplest solution.

@inge4pres inge4pres added bug Something isn't working metrics labels Feb 13, 2025
@inge4pres inge4pres self-assigned this Feb 13, 2025
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

No branches or pull requests

1 participant