From e801ab64237b45c2817afb6dfe88769627dfc600 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 6 Sep 2022 08:58:35 -0700 Subject: [PATCH] Replace usage of InsertString with UpsertString in tests Signed-off-by: Bogdan Drutu --- .../metricsdata_to_logservice_test.go | 8 ++++---- processor/servicegraphprocessor/processor_test.go | 2 +- .../transformprocessor/internal/logs/processor_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice_test.go b/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice_test.go index e392cc8ae152..a8b3c55c6b92 100644 --- a/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice_test.go +++ b/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice_test.go @@ -32,10 +32,10 @@ func TestMetricDataToLogService(t *testing.T) { md.ResourceMetrics().AppendEmpty() // Add an empty ResourceMetrics rm := md.ResourceMetrics().AppendEmpty() - rm.Resource().Attributes().InsertString("labelB", "valueB") - rm.Resource().Attributes().InsertString("labelA", "valueA") - rm.Resource().Attributes().InsertString("service.name", "unknown-service") - rm.Resource().Attributes().InsertString("a", "b") + rm.Resource().Attributes().UpsertString("labelB", "valueB") + rm.Resource().Attributes().UpsertString("labelA", "valueA") + rm.Resource().Attributes().UpsertString("service.name", "unknown-service") + rm.Resource().Attributes().UpsertString("a", "b") sms := rm.ScopeMetrics() sms.AppendEmpty() // Add an empty ScopeMetrics sm := sms.AppendEmpty() diff --git a/processor/servicegraphprocessor/processor_test.go b/processor/servicegraphprocessor/processor_test.go index 7778970157db..efa9abb5d845 100644 --- a/processor/servicegraphprocessor/processor_test.go +++ b/processor/servicegraphprocessor/processor_test.go @@ -206,7 +206,7 @@ func sampleTraces() ptrace.Traces { traces := ptrace.NewTraces() resourceSpans := traces.ResourceSpans().AppendEmpty() - resourceSpans.Resource().Attributes().InsertString(semconv.AttributeServiceName, "some-service") + resourceSpans.Resource().Attributes().UpsertString(semconv.AttributeServiceName, "some-service") scopeSpans := resourceSpans.ScopeSpans().AppendEmpty() diff --git a/processor/transformprocessor/internal/logs/processor_test.go b/processor/transformprocessor/internal/logs/processor_test.go index 87a49adf479f..276307ae1cb6 100644 --- a/processor/transformprocessor/internal/logs/processor_test.go +++ b/processor/transformprocessor/internal/logs/processor_test.go @@ -146,7 +146,7 @@ func TestProcess(t *testing.T) { { query: `set(attributes["test"], Concat(": ", attributes["http.method"], attributes["http.url"])) where body == Concat("", "operation", "A")`, want: func(td plog.Logs) { - td.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().InsertString("test", "get: http://localhost/health") + td.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().UpsertString("test", "get: http://localhost/health") }, }, }