Skip to content

Commit fc72c72

Browse files
authored
[enrichments] Set svc target if either name or type is present (#63)
1 parent c5ae8f2 commit fc72c72

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

enrichments/trace/internal/elastic/span.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,8 @@ func (s *spanEnrichmentContext) setServiceTarget(span ptrace.Span) {
294294
}
295295
}
296296

297-
if targetType != "" {
297+
if targetType != "" || targetName != "" {
298298
span.Attributes().PutStr(AttributeServiceTargetType, targetType)
299-
}
300-
if targetName != "" {
301299
span.Attributes().PutStr(AttributeServiceTargetName, targetName)
302300
}
303301
}

enrichments/trace/internal/elastic/span_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ func TestElasticSpanEnrich(t *testing.T) {
268268
AttributeSpanName: "testspan",
269269
AttributeEventOutcome: "success",
270270
AttributeServiceTargetName: "testsvc",
271+
AttributeServiceTargetType: "",
271272
},
272273
},
273274
{

0 commit comments

Comments
 (0)