Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/prom-exporter-identifying-scope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: prometheusexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Expose Scope Name, Version, Schema URL, and Attributes as labels.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [40004]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: This work is done to comply with https://github.com/open-telemetry/opentelemetry-specification/issues/4223.

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
80 changes: 51 additions & 29 deletions exporter/prometheusexporter/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ type accumulatedValue struct {
// updated indicates when metric was last changed.
updated time.Time

scope pcommon.InstrumentationScope
scopeName string
scopeVersion string
scopeSchemaURL string
scopeAttributes pcommon.Map
Comment thread
ArthurSens marked this conversation as resolved.
}

// accumulator stores aggregated values of incoming metrics
Expand All @@ -35,7 +38,7 @@ type accumulator interface {
Accumulate(resourceMetrics pmetric.ResourceMetrics) (processed int)
// Collect returns a slice with relevant aggregated metrics and their resource attributes.
// The number or metrics and attributes returned will be the same.
Collect() (metrics []pmetric.Metric, resourceAttrs []pcommon.Map)
Collect() (metrics []pmetric.Metric, resourceAttrs []pcommon.Map, scopeNames []string, scopeVersions []string, scopeSchemaURLs []string, scopeAttributes []pcommon.Map)
}

// LastValueAccumulator keeps last value for accumulated metrics
Expand Down Expand Up @@ -68,25 +71,25 @@ func (a *lastValueAccumulator) Accumulate(rm pmetric.ResourceMetrics) (n int) {

metrics := ilm.Metrics()
for j := 0; j < metrics.Len(); j++ {
n += a.addMetric(metrics.At(j), ilm.Scope(), resourceAttrs, now)
n += a.addMetric(metrics.At(j), ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), resourceAttrs, now)
}
}

return
}

func (a *lastValueAccumulator) addMetric(metric pmetric.Metric, il pcommon.InstrumentationScope, resourceAttrs pcommon.Map, now time.Time) int {
func (a *lastValueAccumulator) addMetric(metric pmetric.Metric, scopeName string, scopeVersion string, scopeSchemaURL string, scopeAttributes pcommon.Map, resourceAttrs pcommon.Map, now time.Time) int {
a.logger.Debug(fmt.Sprintf("accumulating metric: %s", metric.Name()))

switch metric.Type() {
case pmetric.MetricTypeGauge:
return a.accumulateGauge(metric, il, resourceAttrs, now)
return a.accumulateGauge(metric, scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, resourceAttrs, now)
case pmetric.MetricTypeSum:
return a.accumulateSum(metric, il, resourceAttrs, now)
return a.accumulateSum(metric, scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, resourceAttrs, now)
case pmetric.MetricTypeHistogram:
return a.accumulateHistogram(metric, il, resourceAttrs, now)
return a.accumulateHistogram(metric, scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, resourceAttrs, now)
case pmetric.MetricTypeSummary:
return a.accumulateSummary(metric, il, resourceAttrs, now)
return a.accumulateSummary(metric, scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, resourceAttrs, now)
default:
a.logger.With(
zap.String("data_type", string(metric.Type())),
Expand All @@ -97,12 +100,12 @@ func (a *lastValueAccumulator) addMetric(metric pmetric.Metric, il pcommon.Instr
return 0
}

func (a *lastValueAccumulator) accumulateSummary(metric pmetric.Metric, il pcommon.InstrumentationScope, resourceAttrs pcommon.Map, now time.Time) (n int) {
func (a *lastValueAccumulator) accumulateSummary(metric pmetric.Metric, scopeName string, scopeVersion string, scopeSchemaURL string, scopeAttributes pcommon.Map, resourceAttrs pcommon.Map, now time.Time) (n int) {
dps := metric.Summary().DataPoints()
for i := 0; i < dps.Len(); i++ {
ip := dps.At(i)

signature := timeseriesSignature(il.Name(), metric, ip.Attributes(), resourceAttrs)
signature := timeseriesSignature(scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, metric, ip.Attributes(), resourceAttrs)
if ip.Flags().NoRecordedValue() {
a.registeredMetrics.Delete(signature)
return 0
Expand All @@ -119,19 +122,19 @@ func (a *lastValueAccumulator) accumulateSummary(metric pmetric.Metric, il pcomm

m := copyMetricMetadata(metric)
ip.CopyTo(m.SetEmptySummary().DataPoints().AppendEmpty())
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scope: il, updated: now})
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scopeName: scopeName, scopeVersion: scopeVersion, scopeSchemaURL: scopeSchemaURL, scopeAttributes: scopeAttributes, updated: now})
n++
}

return n
}

func (a *lastValueAccumulator) accumulateGauge(metric pmetric.Metric, il pcommon.InstrumentationScope, resourceAttrs pcommon.Map, now time.Time) (n int) {
func (a *lastValueAccumulator) accumulateGauge(metric pmetric.Metric, scopeName string, scopeVersion string, scopeSchemaURL string, scopeAttributes pcommon.Map, resourceAttrs pcommon.Map, now time.Time) (n int) {
dps := metric.Gauge().DataPoints()
for i := 0; i < dps.Len(); i++ {
ip := dps.At(i)

signature := timeseriesSignature(il.Name(), metric, ip.Attributes(), resourceAttrs)
signature := timeseriesSignature(scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, metric, ip.Attributes(), resourceAttrs)
if ip.Flags().NoRecordedValue() {
a.registeredMetrics.Delete(signature)
return 0
Expand All @@ -141,7 +144,7 @@ func (a *lastValueAccumulator) accumulateGauge(metric pmetric.Metric, il pcommon
if !ok {
m := copyMetricMetadata(metric)
ip.CopyTo(m.SetEmptyGauge().DataPoints().AppendEmpty())
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scope: il, updated: now})
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scopeName: scopeName, scopeVersion: scopeVersion, scopeSchemaURL: scopeSchemaURL, scopeAttributes: scopeAttributes, updated: now})
n++
continue
}
Expand All @@ -154,13 +157,13 @@ func (a *lastValueAccumulator) accumulateGauge(metric pmetric.Metric, il pcommon

m := copyMetricMetadata(metric)
ip.CopyTo(m.SetEmptyGauge().DataPoints().AppendEmpty())
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scope: il, updated: now})
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scopeName: scopeName, scopeVersion: scopeVersion, scopeSchemaURL: scopeSchemaURL, scopeAttributes: scopeAttributes, updated: now})
n++
}
return
}

func (a *lastValueAccumulator) accumulateSum(metric pmetric.Metric, il pcommon.InstrumentationScope, resourceAttrs pcommon.Map, now time.Time) (n int) {
func (a *lastValueAccumulator) accumulateSum(metric pmetric.Metric, scopeName string, scopeVersion string, scopeSchemaURL string, scopeAttributes pcommon.Map, resourceAttrs pcommon.Map, now time.Time) (n int) {
doubleSum := metric.Sum()

// Drop metrics with unspecified aggregations
Expand All @@ -177,7 +180,7 @@ func (a *lastValueAccumulator) accumulateSum(metric pmetric.Metric, il pcommon.I
for i := 0; i < dps.Len(); i++ {
ip := dps.At(i)

signature := timeseriesSignature(il.Name(), metric, ip.Attributes(), resourceAttrs)
signature := timeseriesSignature(scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, metric, ip.Attributes(), resourceAttrs)
if ip.Flags().NoRecordedValue() {
a.registeredMetrics.Delete(signature)
return 0
Expand All @@ -189,7 +192,7 @@ func (a *lastValueAccumulator) accumulateSum(metric pmetric.Metric, il pcommon.I
m.SetEmptySum().SetIsMonotonic(metric.Sum().IsMonotonic())
m.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
ip.CopyTo(m.Sum().DataPoints().AppendEmpty())
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scope: il, updated: now})
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scopeName: scopeName, scopeVersion: scopeVersion, scopeSchemaURL: scopeSchemaURL, scopeAttributes: scopeAttributes, updated: now})
n++
continue
}
Expand All @@ -215,21 +218,21 @@ func (a *lastValueAccumulator) accumulateSum(metric pmetric.Metric, il pcommon.I
m.SetEmptySum().SetIsMonotonic(metric.Sum().IsMonotonic())
m.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
ip.CopyTo(m.Sum().DataPoints().AppendEmpty())
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scope: il, updated: now})
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scopeName: scopeName, scopeVersion: scopeVersion, scopeSchemaURL: scopeSchemaURL, scopeAttributes: scopeAttributes, updated: now})
n++
}
return
}

func (a *lastValueAccumulator) accumulateHistogram(metric pmetric.Metric, il pcommon.InstrumentationScope, resourceAttrs pcommon.Map, now time.Time) (n int) {
func (a *lastValueAccumulator) accumulateHistogram(metric pmetric.Metric, scopeName string, scopeVersion string, scopeSchemaURL string, scopeAttributes pcommon.Map, resourceAttrs pcommon.Map, now time.Time) (n int) {
histogram := metric.Histogram()
a.logger.Debug("Accumulate histogram.....")
dps := histogram.DataPoints()

for i := 0; i < dps.Len(); i++ {
ip := dps.At(i)

signature := timeseriesSignature(il.Name(), metric, ip.Attributes(), resourceAttrs) // uniquely identify this time series you are accumulating for
signature := timeseriesSignature(scopeName, scopeVersion, scopeSchemaURL, scopeAttributes, metric, ip.Attributes(), resourceAttrs) // uniquely identify this time series you are accumulating for
if ip.Flags().NoRecordedValue() {
a.registeredMetrics.Delete(signature)
return 0
Expand All @@ -241,7 +244,7 @@ func (a *lastValueAccumulator) accumulateHistogram(metric pmetric.Metric, il pco
m := copyMetricMetadata(metric)
ip.CopyTo(m.SetEmptyHistogram().DataPoints().AppendEmpty())
m.Histogram().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scope: il, updated: now})
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scopeName: scopeName, scopeVersion: scopeVersion, scopeSchemaURL: scopeSchemaURL, scopeAttributes: scopeAttributes, updated: now})
n++
continue
}
Expand Down Expand Up @@ -284,18 +287,22 @@ func (a *lastValueAccumulator) accumulateHistogram(metric pmetric.Metric, il pco
// unsupported temporality
continue
}
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scope: il, updated: now})
a.registeredMetrics.Store(signature, &accumulatedValue{value: m, resourceAttrs: resourceAttrs, scopeName: scopeName, scopeVersion: scopeVersion, scopeSchemaURL: scopeSchemaURL, scopeAttributes: scopeAttributes, updated: now})
n++
}
return
}

// Collect returns a slice with relevant aggregated metrics and their resource attributes.
func (a *lastValueAccumulator) Collect() ([]pmetric.Metric, []pcommon.Map) {
func (a *lastValueAccumulator) Collect() ([]pmetric.Metric, []pcommon.Map, []string, []string, []string, []pcommon.Map) {
a.logger.Debug("Accumulator collect called")

var metrics []pmetric.Metric
var resourceAttrs []pcommon.Map
var scopeNames []string
var scopeVersions []string
var scopeSchemaURLs []string
var scopeAttributes []pcommon.Map
expirationTime := time.Now().Add(-a.metricExpiration)

a.registeredMetrics.Range(func(key, value any) bool {
Expand All @@ -308,23 +315,38 @@ func (a *lastValueAccumulator) Collect() ([]pmetric.Metric, []pcommon.Map) {

metrics = append(metrics, v.value)
resourceAttrs = append(resourceAttrs, v.resourceAttrs)
scopeNames = append(scopeNames, v.scopeName)
scopeVersions = append(scopeVersions, v.scopeVersion)
scopeSchemaURLs = append(scopeSchemaURLs, v.scopeSchemaURL)
scopeAttributes = append(scopeAttributes, v.scopeAttributes)
return true
})

return metrics, resourceAttrs
return metrics, resourceAttrs, scopeNames, scopeVersions, scopeSchemaURLs, scopeAttributes
}

func timeseriesSignature(ilmName string, metric pmetric.Metric, attributes pcommon.Map, resourceAttrs pcommon.Map) string {
func timeseriesSignature(scopeName string, scopeVersion string, scopeSchemaURL string, scopeAttributes pcommon.Map, metric pmetric.Metric, attributes pcommon.Map, resourceAttrs pcommon.Map) string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't block this PR, but we are building massive strings to compute signatures here (contains all resource and metric attributes). That is probably using a huge amount of memory. We should strongly consider using something like internal/exp/metrics/identity.OfResourceMetric instead of computing large strings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, moving to the identity package would also solve the string collision problem. Would you be okay with me working on those in a follow-up PR? That way I don't need to solve the same problem twice :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i'm OK with a follow-up

var b strings.Builder
b.WriteString(metric.Type().String())
b.WriteString("*" + ilmName)
b.WriteString("*" + metric.Name())
attrs := make([]string, 0, attributes.Len())
b.WriteString(metric.Type().String())
b.WriteString("*" + scopeName)
b.WriteString("*" + scopeVersion)
b.WriteString("*" + scopeSchemaURL)

attrs := make([]string, 0, scopeAttributes.Len())
for k, v := range scopeAttributes.All() {
attrs = append(attrs, k+"*"+v.AsString())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this uses the same delimiter * as attributes below, it seems possible for there to be a collision between timeseries where an attribute is a scope attribute in one, but a metric attribute in another.

}
sort.Strings(attrs)
b.WriteString("*" + strings.Join(attrs, "*"))

attrs = make([]string, 0, attributes.Len())
for k, v := range attributes.All() {
attrs = append(attrs, k+"*"+v.AsString())
}
sort.Strings(attrs)
b.WriteString("*" + strings.Join(attrs, "*"))

if job, ok := extractJob(resourceAttrs); ok {
b.WriteString("*" + model.JobLabel + "*" + job)
}
Expand Down
22 changes: 11 additions & 11 deletions exporter/prometheusexporter/accumulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,14 @@ func TestAccumulateMetrics(t *testing.T) {

m2Labels, _, m2Value, m2Temporality, m2IsMonotonic := getMetricProperties(ilm2.Metrics().At(0))

signature := timeseriesSignature(ilm2.Scope().Name(), ilm2.Metrics().At(0), m2Labels, pcommon.NewMap())
signature := timeseriesSignature(ilm2.Scope().Name(), ilm2.Scope().Version(), ilm2.SchemaUrl(), ilm2.Scope().Attributes(), ilm2.Metrics().At(0), m2Labels, pcommon.NewMap())
m, ok := a.registeredMetrics.Load(signature)
require.True(t, ok)

v := m.(*accumulatedValue)
vLabels, vTS, vValue, vTemporality, vIsMonotonic := getMetricProperties(ilm2.Metrics().At(0))

require.Equal(t, "test", v.scope.Name())
require.Equal(t, "test", v.scopeName)
require.Equal(t, v.value.Type(), ilm2.Metrics().At(0).Type())
for k, v := range vLabels.All() {
r, _ := m2Labels.Get(k)
Expand Down Expand Up @@ -350,14 +350,14 @@ func TestAccumulateDeltaToCumulative(t *testing.T) {
require.Equal(t, 2, n)

mLabels, _, mValue, _, _ := getMetricProperties(ilm.Metrics().At(1))
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Metrics().At(0), mLabels, pcommon.NewMap())
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), ilm.Metrics().At(0), mLabels, pcommon.NewMap())
m, ok := a.registeredMetrics.Load(signature)
require.True(t, ok)

v := m.(*accumulatedValue)
vLabels, vTS, vValue, vTemporality, vIsMonotonic := getMetricProperties(v.value)

require.Equal(t, "test", v.scope.Name())
require.Equal(t, "test", v.scopeName)
require.Equal(t, v.value.Type(), ilm.Metrics().At(0).Type())
require.Equal(t, v.value.Type(), ilm.Metrics().At(1).Type())

Expand Down Expand Up @@ -405,7 +405,7 @@ func TestAccumulateDeltaToCumulativeHistogram(t *testing.T) {

m1 := ilm.Metrics().At(0).Histogram().DataPoints().At(0)
m2 := ilm.Metrics().At(1).Histogram().DataPoints().At(0)
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())

a := newAccumulator(zap.NewNop(), 1*time.Hour).(*lastValueAccumulator)
n := a.Accumulate(resourceMetrics)
Expand Down Expand Up @@ -438,7 +438,7 @@ func TestAccumulateDeltaToCumulativeHistogram(t *testing.T) {

m1 := ilm.Metrics().At(0).Histogram().DataPoints().At(0)
m2 := ilm.Metrics().At(1).Histogram().DataPoints().At(0)
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())

// should ignore metric with different buckets from the past
a := newAccumulator(zap.NewNop(), 1*time.Hour).(*lastValueAccumulator)
Expand Down Expand Up @@ -472,7 +472,7 @@ func TestAccumulateDeltaToCumulativeHistogram(t *testing.T) {
appendDeltaHistogram(ts1, ts2, 7, 5, []uint64{3, 1, 1, 0, 0}, []float64{0.1, 0.2, 1, 10}, ilm.Metrics())

m2 := ilm.Metrics().At(1).Histogram().DataPoints().At(0)
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())

// should ignore metric with different buckets from the past
a := newAccumulator(zap.NewNop(), 1*time.Hour).(*lastValueAccumulator)
Expand Down Expand Up @@ -507,7 +507,7 @@ func TestAccumulateDeltaToCumulativeHistogram(t *testing.T) {
appendDeltaHistogram(startTs2, ts2, 7, 5, []uint64{3, 1, 1, 0, 0}, []float64{0.1, 0.2, 1, 10}, ilm.Metrics())

m1 := ilm.Metrics().At(0).Histogram().DataPoints().At(0)
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Metrics().At(0), m1.Attributes(), pcommon.NewMap())
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), ilm.Metrics().At(0), m1.Attributes(), pcommon.NewMap())

a := newAccumulator(zap.NewNop(), 1*time.Hour).(*lastValueAccumulator)
n := a.Accumulate(resourceMetrics)
Expand Down Expand Up @@ -541,7 +541,7 @@ func TestAccumulateDeltaToCumulativeHistogram(t *testing.T) {
appendDeltaHistogram(startTs2, ts2, 7, 5, []uint64{3, 1, 1, 0, 0}, []float64{0.1, 0.2, 1, 10}, ilm.Metrics())

m2 := ilm.Metrics().At(1).Histogram().DataPoints().At(0)
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), ilm.Metrics().At(0), m2.Attributes(), pcommon.NewMap())

a := newAccumulator(zap.NewNop(), 1*time.Hour).(*lastValueAccumulator)
n := a.Accumulate(resourceMetrics)
Expand Down Expand Up @@ -632,7 +632,7 @@ func TestAccumulateDroppedMetrics(t *testing.T) {
n := a.Accumulate(resourceMetrics)
require.Equal(t, 0, n)

signature := timeseriesSignature(ilm.Scope().Name(), ilm.Metrics().At(0), pcommon.NewMap(), pcommon.NewMap())
signature := timeseriesSignature(ilm.Scope().Name(), ilm.Scope().Version(), ilm.SchemaUrl(), ilm.Scope().Attributes(), ilm.Metrics().At(0), pcommon.NewMap(), pcommon.NewMap())
v, ok := a.registeredMetrics.Load(signature)
require.False(t, ok)
require.Nil(t, v)
Expand All @@ -646,7 +646,7 @@ func TestTimeseriesSignatureNotMutating(t *testing.T) {
attrs.PutStr("label_1", "1")
origAttrs := pcommon.NewMap()
attrs.CopyTo(origAttrs)
timeseriesSignature("test_il", pmetric.NewMetric(), attrs, attrs)
timeseriesSignature("test_il", "1.0.0", "http://test.com", attrs, pmetric.NewMetric(), attrs, pcommon.NewMap())
require.Equal(t, origAttrs, attrs) // make sure attrs are not mutated
}

Expand Down
Loading
Loading