Skip to content

Commit

Permalink
Replace usage of InsertString with UpsertString in tests (#13903)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Sep 6, 2022
1 parent 5e92de5 commit bbb2ebd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion processor/servicegraphprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
},
},
}
Expand Down

0 comments on commit bbb2ebd

Please sign in to comment.