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
[reciever/prometheusremotewritereceiver] Handle multiple timeseries with same metric name+type+unit (open-telemetry#38453)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR belongs to part of the Linux foundation mentee program. Here we
are dealing with data points slices that must be added to the same
metric when the incoming time series have some attributes in common.
Like same resource, metricName, scopeName, scopeVersion, unitRef and
timeseries type. The reference to this implementation can be found
https://opentelemetry.io/docs/specs/otel/metrics/data-model/#opentelemetry-protocol-data-model
Besides that. We are creating 2 new test cases. The first one, to
validate the described behavior above.
The second is to validate an error case. When the unitRef passed doesn't
match with the symbols slice, causing a panic. This test case is
important to guarantee that the error is being handled correctly.
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes part of open-telemetry#37277. Bullet point `Handle multiple timeseries with same
metric name+type+unit`
---------
Co-authored-by: Arthur Silva Sens <[email protected]>
// TODO: Like UnitRef, we should assign the HelpRef to the metric.
211
+
ifts.Metadata.UnitRef>=uint32(len(req.Symbols)) {
212
+
badRequestErrors=errors.Join(badRequestErrors, fmt.Errorf("unit ref %d is out of bounds of symbolsTable", ts.Metadata.UnitRef))
213
+
continue
214
+
}
215
+
unit:=req.Symbols[ts.Metadata.UnitRef]
216
+
217
+
resourceID:=identity.OfResource(rm.Resource())
218
+
// Temporary approach to generate the metric key.
219
+
// TODO: Replace this with a proper hashing function.
220
+
// The definition of the metric uniqueness is based on the following document. Ref: https://opentelemetry.io/docs/specs/otel/metrics/data-model/#opentelemetry-protocol-data-model
0 commit comments