You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It means that the attributes var in Sum struct have no relationship with the attributes value in metricKeyToDimensionsCache .
As per the analysis above, I believe that metricKeyToDimensionsCache can no longer help improve the collector's memory usage. We can use aggregation_cardinality_limit instead.
The text was updated successfully, but these errors were encountered:
…CacheSize (open-telemetry#39648)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
fix:
open-telemetry#39646
Component(s)
connector/spanmetrics
Describe the issue you're reporting
The
DimensionsCacheSize
is the limit of the metricKeyToDimensions cache size:opentelemetry-collector-contrib/connector/spanmetricsconnector/connector.go
Line 116 in 154ba2b
It's use to keep the attributes build from span and try to improve collectors memory usage.
As the code of spanconnector iterates, spanconnector uses
ResourceMetrics
to maintain the intermediate state of metrics:opentelemetry-collector-contrib/connector/spanmetricsconnector/connector.go
Lines 88 to 95 in 154ba2b
Below is an example of the SumMetrics struct. Please note the signature of the GetOrCreate function.
GetOrCreate(key Key, attributes pcommon.Map, startTimestamp pcommon.Timestamp) *Sum
opentelemetry-collector-contrib/connector/spanmetricsconnector/internal/metrics/metrics.go
Lines 243 to 293 in 9732ea5
I found that https://pkg.go.dev/go.opentelemetry.io/collector/pdata/pcommon#Map is also a struct, so the attributes variable is passed by value when GetOrCreate is invoked.
It means that the attributes var in
Sum
struct have no relationship with the attributes value inmetricKeyToDimensionsCache
.As per the analysis above, I believe that metricKeyToDimensionsCache can no longer help improve the collector's memory usage. We can use aggregation_cardinality_limit instead.
The text was updated successfully, but these errors were encountered: