Skip to content

Commit 357c70c

Browse files
committed
Fix some tests
1 parent 0efb312 commit 357c70c

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

tracer/src/Datadog.Trace/Agent/NullStatsAggregator.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,30 @@ public StatsAggregationKey BuildKey(Span span, out List<byte[]> utf8PeerTags, ou
3434
{
3535
utf8PeerTags = [];
3636
utf8SpanDerivedPrimaryTags = [];
37-
return new();
37+
38+
var rawHttpStatusCode = span.GetTag(Tags.HttpStatusCode);
39+
if (rawHttpStatusCode is null || !int.TryParse(rawHttpStatusCode, out var httpStatusCode))
40+
{
41+
httpStatusCode = 0;
42+
}
43+
44+
return new StatsAggregationKey(
45+
span.ResourceName,
46+
span.ServiceName,
47+
span.OperationName,
48+
span.Type,
49+
httpStatusCode,
50+
span.Context.Origin?.StartsWith("synthetics") == true,
51+
string.Empty,
52+
isError: false,
53+
isTopLevel: false,
54+
isTraceRoot: false,
55+
string.Empty,
56+
string.Empty,
57+
grpcStatusCode: 0,
58+
string.Empty,
59+
peerTagsHash: 0,
60+
spanDerivedPrimaryTagsHash: 0);
3861
}
3962
}
4063
}

tracer/src/Datadog.Trace/Agent/StatsAggregator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ internal StatsAggregationKey BuildKey(Span span, List<string> peerTagKeys, List<
353353
span.OperationName,
354354
span.Type,
355355
httpStatusCode,
356-
span.Context.Origin.StartsWith("synthetics"),
356+
span.Context.Origin?.StartsWith("synthetics") == true,
357357
spanKind,
358358
_isOtlp ? span.Error : false,
359359
_isOtlp ? span.IsTopLevel : false,

0 commit comments

Comments
 (0)