Skip to content

Commit f52f520

Browse files
Fix issue found by codex: Set count after each invocation of TagWriter since it is a cumulative count
1 parent 069cf30 commit f52f520

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tracer/src/Datadog.Trace/OpenTelemetry/OtlpMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ public static int EmitAttributesFromSpan(Action<KeyValue> writeKeyValue, in Span
179179

180180
var tagWriter = new TagWriter(writeKeyValue, tagProcessors, count, limit);
181181
spanModel.Span.Tags.EnumerateTags(ref tagWriter);
182-
count += tagWriter.Count;
182+
count = tagWriter.Count;
183183
droppedAttributesCount += tagWriter.DroppedCount;
184184

185185
// Write span metrics
186186
// Note: I could have done this earlier but I wanted to simulate the same behavior as the MessagePack formatter.
187187
var metricsWriter = new TagWriter(writeKeyValue, tagProcessors, count, limit);
188188
spanModel.Span.Tags.EnumerateMetrics(ref metricsWriter);
189-
count += metricsWriter.Count;
189+
count = metricsWriter.Count;
190190
droppedAttributesCount += metricsWriter.DroppedCount;
191191

192192
// if (model.IsLocalRoot)

0 commit comments

Comments
 (0)