Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ internal SpanCodeOrigin(DebuggerSettings settings)

internal void SetCodeOriginForExitSpan(Span? span)
{
if (ShouldSkipExitSpan())
{
return;
}

if (span == null)
{
Log.Debug("Can not add code origin when span is null");
Log.Debug("Can not add code origin for exit span when span is null");
return;
}

Expand All @@ -58,6 +63,13 @@ internal void SetCodeOriginForExitSpan(Span? span)
AddExitSpanTags(span);
}

private bool ShouldSkipExitSpan()
{
// Exit span code origin has been disabled since tracer version 3.2.8.
// when it will be enabled, update SpanCodeOriginTests.ExitSpanTests
return true;
}

internal void SetCodeOriginForEntrySpan(Span? span, Type? type, MethodInfo? method)
{
if (span == null ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ at Samples.Probes.TestRuns.SmokeTests.AsyncSpanOnMethodWithExceptionProbeTest.Ca
error.type: System.InvalidOperationException,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
runtime-id: Guid_2,
SpanDecorationArgsAndLocals: Run,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationArgsAndLocals.probe_id: Guid_3
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand All @@ -34,7 +33,6 @@
language: dotnet,
SpanDecorationArgsAndLocals: Run,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationArgsAndLocals.probe_id: Guid_3
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
runtime-id: Guid_2,
SpanDecorationError: Instance=Datadog.Trace.Debugger.Expressions.UndefinedValue,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationError.evaluation_error: EvaluationError { Expression = this.error },
_dd.di.SpanDecorationError.probe_id: Guid_3
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand All @@ -34,7 +33,6 @@
language: dotnet,
SpanDecorationError: Instance=Datadog.Trace.Debugger.Expressions.UndefinedValue,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationError.evaluation_error: EvaluationError { Expression = this.error },
_dd.di.SpanDecorationError.probe_id: Guid_3
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
runtime-id: Guid_2,
SpanDecorationSameTags: 3,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationSameTags.probe_id: Guid_3
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand All @@ -34,7 +33,6 @@
language: dotnet,
SpanDecorationSameTags: 3,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationSameTags.probe_id: Guid_3
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
runtime-id: Guid_2,
SpanDecorationSameTagsFirstError: Run,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationSameTagsFirstError.probe_id: Guid_3
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand All @@ -34,7 +33,6 @@
language: dotnet,
SpanDecorationSameTagsFirstError: Run,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationSameTagsFirstError.probe_id: Guid_3
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
runtime-id: Guid_2,
SpanDecorationSameTagsSecondError: Instance=Datadog.Trace.Debugger.Expressions.UndefinedValue,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationSameTagsSecondError.evaluation_error: EvaluationError { Expression = this.error },
_dd.di.SpanDecorationSameTagsSecondError.probe_id: Guid_3
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand All @@ -34,7 +33,6 @@
language: dotnet,
SpanDecorationSameTagsSecondError: Instance=Datadog.Trace.Debugger.Expressions.UndefinedValue,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationSameTagsSecondError.evaluation_error: EvaluationError { Expression = this.error },
_dd.di.SpanDecorationSameTagsSecondError.probe_id: Guid_3
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
runtime-id: Guid_2,
SpanDecorationTwoSegments: Instance=Datadog.Trace.Debugger.Expressions.UndefinedValueRun,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationTwoSegments.evaluation_error: EvaluationError { Expression = this.Arg = },
_dd.di.SpanDecorationTwoSegments.probe_id: Guid_3
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
SpanDecorationTwoTags: Run,
SpanDecorationTwoTags2: 3,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationTwoTags.probe_id: Guid_3,
_dd.di.SpanDecorationTwoTags2.probe_id: Guid_3
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand All @@ -35,7 +34,6 @@
SpanDecorationTwoTags: Run,
SpanDecorationTwoTags2: 3,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationTwoTags.probe_id: Guid_3,
_dd.di.SpanDecorationTwoTags2.probe_id: Guid_3
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
runtime-id: Guid_2,
SpanDecorationWithoutWhen: Run,
version: 1.0.0,
_dd.code_origin.type: exit,
_dd.di.SpanDecorationWithoutWhen.probe_id: Guid_3
},
Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
env: integration_tests,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ at Samples.Probes.TestRuns.SmokeTests.SpanOnMethodWithExceptionProbeTest.Calcula
error.type: System.InvalidOperationException,
language: dotnet,
runtime-id: Guid_2,
version: 1.0.0,
_dd.code_origin.type: exit
version: 1.0.0
},
Metrics: {
process_id: 0,
Expand Down
10 changes: 10 additions & 0 deletions tracer/test/Datadog.Trace.Tests/Debugger/SpanCodeOriginTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ public void SetCodeOrigin_WhenEnabled_SetsCorrectTags()
TestMethod(spanCodeOrigin, span);

// Assert
// Exit span code origin has been disabled since tracer version 3.2.8.
span.Tags.GetTag($"{CodeOriginTag}.type").Should().BeNull();

/* Uncomment when exit span will be enabled again
var codeOriginType = span.Tags.GetTag($"{CodeOriginTag}.type");
codeOriginType.Should().Be("exit");
var frame0Method = span.Tags.GetTag($"{CodeOriginTag}.frames.0.method");
Expand All @@ -253,6 +257,7 @@ public void SetCodeOrigin_WhenEnabled_SetsCorrectTags()
line.Should().NotBeNullOrEmpty();
var column = span.Tags.GetTag($"{CodeOriginTag}.frames.0.column");
column.Should().NotBeNullOrEmpty();
*/
}

[Fact]
Expand All @@ -267,10 +272,15 @@ public void SetCodeOrigin_WithMaxFramesLimit_RespectsLimit()
DeepTestMethod1(span, spanCodeOrigin);

// Assert
// Exit span code origin has been disabled since tracer version 3.2.8.
span.Tags.GetTag($"{CodeOriginTag}.type").Should().BeNull();

/* Uncomment when exit span will be enabled again
var tags = ((List<KeyValuePair<string, string>>)(typeof(Datadog.Trace.Tagging.TagsList).GetField("_tags", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(span.Tags))).Select(i => i.Key).ToList();
tags.Should().Contain(s => s.StartsWith($"{CodeOriginTag}.frames.0"));
tags.Should().Contain(s => s.StartsWith($"{CodeOriginTag}.frames.1"));
tags.Should().NotContain(s => s.StartsWith($"{CodeOriginTag}.frames.2"));
*/
}

[MethodImpl(MethodImplOptions.NoInlining)]
Expand Down
Loading