Skip to content

Commit

Permalink
[exporter/instana] Remove redundant Sort call making exporter mutating (
Browse files Browse the repository at this point in the history
#16505)

The Sort call is redundant because the range function is applied on a map so there is no reason to preserve order. The call unnecessarily mutates the original data which can lead to subtle bugs
  • Loading branch information
dmitryax authored Nov 28, 2022
1 parent 5dc292d commit 600c905
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .chloggen/remove-instana-mutations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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: exporter/instana

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Make sure the original traces are not mutated

# One or more tracking issues related to the change
issues: [16505]

2 changes: 1 addition & 1 deletion exporter/instanaexporter/internal/converter/model/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func ConvertPDataSpanToInstanaSpan(fromS FromS, otelSpan ptrace.Span, serviceNam

instanaSpan.Data.TraceState = otelSpan.TraceState().AsRaw()

otelSpan.Attributes().Sort().Range(func(k string, v pcommon.Value) bool {
otelSpan.Attributes().Range(func(k string, v pcommon.Value) bool {
instanaSpan.Data.Tags[k] = v.AsString()

return true
Expand Down

0 comments on commit 600c905

Please sign in to comment.