Skip to content

Commit 32e2660

Browse files
committed
Rename RootSpan to FirstSpan
1 parent 10f703f commit 32e2660

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="AgentWriter.cs" company="Datadog">
1+
// <copyright file="AgentWriter.cs" company="Datadog">
22
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
44
// </copyright>
@@ -483,7 +483,7 @@ private void SerializeTrace(in SpanCollection spans)
483483
}
484484

485485
// Add the current keep rate to trace
486-
if (chunk.RootSpan?.Context.TraceContext is { } trace)
486+
if (chunk.FirstSpan?.Context.TraceContext is { } trace)
487487
{
488488
trace.TracesKeepRate = _traceKeepRateCalculator.GetKeepRate();
489489
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal SpanCollection(Span[] values)
6464
/// <summary>
6565
/// Gets the first span in the <see cref="SpanCollection" />, or returns null if the collection is empty
6666
/// </summary>
67-
public Span? RootSpan
67+
public Span? FirstSpan
6868
{
6969
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7070
get

tracer/src/Datadog.Trace/Ci/Processors/OriginTagTraceProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="OriginTagTraceProcessor.cs" company="Datadog">
1+
// <copyright file="OriginTagTraceProcessor.cs" company="Datadog">
22
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
44
// </copyright>
@@ -74,7 +74,7 @@ public SpanCollection Process(in SpanCollection trace)
7474
if (!_isCiVisibilityProtocol)
7575
{
7676
// Sets the origin tag on the TraceContext to ensure the CI track.
77-
var traceContext = trace.RootSpan?.Context.TraceContext;
77+
var traceContext = trace.FirstSpan?.Context.TraceContext;
7878

7979
if (traceContext is not null)
8080
{

tracer/src/Datadog.Trace/Processors/NormalizerTraceProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="NormalizerTraceProcessor.cs" company="Datadog">
1+
// <copyright file="NormalizerTraceProcessor.cs" company="Datadog">
22
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
44
// </copyright>
@@ -58,7 +58,7 @@ public SpanCollection Process(in SpanCollection trace)
5858
}
5959

6060
// https://github.com/DataDog/datadog-agent/blob/eac2327c5574da7f225f9ef0f89eaeb05ed10382/pkg/trace/agent/normalizer.go#L133-L135
61-
var traceContext = trace.RootSpan?.Context.TraceContext;
61+
var traceContext = trace.FirstSpan?.Context.TraceContext;
6262

6363
if (!string.IsNullOrEmpty(traceContext?.Environment))
6464
{

tracer/src/Datadog.Trace/TraceContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="TraceContext.cs" company="Datadog">
1+
// <copyright file="TraceContext.cs" company="Datadog">
22
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
44
// </copyright>
@@ -127,7 +127,7 @@ internal AppSecRequestContext AppSecRequestContext
127127
internal bool WafExecuted { get; set; }
128128

129129
internal static TraceContext? GetTraceContext(in SpanCollection spans)
130-
=> spans.RootSpan?.Context.TraceContext;
130+
=> spans.FirstSpan?.Context.TraceContext;
131131

132132
internal void EnableIastInRequest()
133133
{

tracer/test/Datadog.Trace.Tests/Agent/SpanCollectionTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void DefaultValue()
1919
SpanCollection collection = default;
2020

2121
collection.Count.Should().Be(0);
22-
collection.RootSpan.Should().BeNull();
22+
collection.FirstSpan.Should().BeNull();
2323
collection.ToArray().Array.Should().BeEmpty();
2424
foreach (var span in collection)
2525
{
@@ -36,7 +36,7 @@ public void SingleSpanConstructor()
3636
var collection = new SpanCollection(span);
3737

3838
collection.Count.Should().Be(1);
39-
collection.RootSpan.Should().BeSameAs(span);
39+
collection.FirstSpan.Should().BeSameAs(span);
4040
collection.ToArray().Array.Should().ContainSingle().Which.Should().BeSameAs(span);
4141
var spans = new List<Span>();
4242
foreach (var x in collection)
@@ -56,7 +56,7 @@ public void ArrayCapacityConstructor()
5656
var collection = new SpanCollection(length);
5757

5858
collection.Count.Should().Be(0);
59-
collection.RootSpan.Should().BeNull();
59+
collection.FirstSpan.Should().BeNull();
6060
var array = collection.ToArray();
6161
array.Count.Should().Be(0);
6262
array.Offset.Should().Be(0);
@@ -76,7 +76,7 @@ public void ArrayConstructor()
7676
var collection = new SpanCollection(spans, 2);
7777

7878
collection.Count.Should().Be(2);
79-
collection.RootSpan.Should().BeSameAs(spans[0]);
79+
collection.FirstSpan.Should().BeSameAs(spans[0]);
8080
collection[0].Should().BeSameAs(spans[0]);
8181
collection[1].Should().BeSameAs(spans[1]);
8282
FluentActions.Invoking(() => collection[2]).Should().Throw<IndexOutOfRangeException>();
@@ -104,7 +104,7 @@ public void ArrayConstructor_SetsCountToArrayLength()
104104
var collection = new SpanCollection(spans);
105105

106106
collection.Count.Should().Be(2);
107-
collection.RootSpan.Should().BeSameAs(spans[0]);
107+
collection.FirstSpan.Should().BeSameAs(spans[0]);
108108
collection[0].Should().BeSameAs(spans[0]);
109109
collection[1].Should().BeSameAs(spans[1]);
110110
}
@@ -118,7 +118,7 @@ public void Append_ToEmptyCollection()
118118
var result = SpanCollection.Append(in collection, span);
119119

120120
result.Count.Should().Be(1);
121-
result.RootSpan.Should().BeSameAs(span);
121+
result.FirstSpan.Should().BeSameAs(span);
122122
result[0].Should().BeSameAs(span);
123123
}
124124

@@ -132,7 +132,7 @@ public void Append_ToSingleSpanCollection()
132132
var result = SpanCollection.Append(in collection, span2);
133133

134134
result.Count.Should().Be(2);
135-
result.RootSpan.Should().BeSameAs(span1);
135+
result.FirstSpan.Should().BeSameAs(span1);
136136
result[0].Should().BeSameAs(span1);
137137
result[1].Should().BeSameAs(span2);
138138

0 commit comments

Comments
 (0)