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

Unify metrics DataPoints collection #2145

Open
fraillt opened this issue Sep 25, 2024 · 1 comment
Open

Unify metrics DataPoints collection #2145

fraillt opened this issue Sep 25, 2024 · 1 comment

Comments

@fraillt
Copy link
Contributor

fraillt commented Sep 25, 2024

Problem

At the moment there's zero code reuse in DataPoints collection phase. Due to too much copy/paste there are few issues:

  • there are inefficiencies by doing unnecessary .clone()
  • I noticed at least one bug in PrecomputedSum::delta where no_attribute_tracker uses get_value instead of get_and_reset_value.
  • hard to understand the core logic of aggregator, versus implementation details of how DataPoints are collected.
  • makes very hard to experiment with performance improvements in measuring and/or collecting phase. E.g. if I change something within ValueMap, I need to go and update at minimum 5 aggregators (if we add ExpoHistogram) * 2 (delta/comulative) = 10 places.
  • makes very hard to review, because simple change will affect at least 10 places.

Solution

Hide implementation details of ValueMap, and provide simple collect_cumulative and collect_delta functions instead (similar idea as in #2114).
In the future we'll be able to experiment and improve ValueMap implementation and get benefits across all aggregators.

@cijothomas
Copy link
Member

Agreed. In other implementations like OTel .NET, the entire logic of keeping track of metric points, look up, etc are done in a common place (i.e not repeated for each instument type).

Related:#1566

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

No branches or pull requests

2 participants