[Metrics][Perf] Move BucketLookup tree to AggregatorStore to reduce memory usage #5976
Labels
enhancement
New feature or request
needs-triage
New issues which have not been classified or triaged by a community member
pkg:OpenTelemetry
Issues related to OpenTelemetry NuGet package
Package
OpenTelemetry
Is your feature request related to a problem?
No response
What is the expected behavior?
Currently, we switch to using binary search for Histogram measurements if the bounds count >= 50.
Binary search has been implemented using a custom binary search tree. Here's the code for reference. This leads to allocating memory for the tree for each
MetricPoint
. This could be moved to a more central place such asAggregatorStore
as the Histogram bounds would always stay the same for a givenMetric
. That way allMetricPoints
could share the same tree structure.We have cases where people use very high cardinality Histogram metrics. This would greatly benefit such users. Check #5416 for reference. This user has a Histogram metric with a cardinality of around 600M! We could greatly reduce memory usage in such scenarios by avoiding the repeated creation of these trees.
Which alternative solutions or features have you considered?
N/A
Additional context
No response
The text was updated successfully, but these errors were encountered: