Skip to content

Commit 480ab96

Browse files
committed
Fix code origin enabled logic
1 parent 892c888 commit 480ab96

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

tracer/src/Datadog.Trace/Debugger/DebuggerSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ public DebuggerSettings(IConfigurationSource? source, IConfigurationTelemetry te
136136
RedactedTypes = new HashSet<string>(redactedTypes, StringComparer.OrdinalIgnoreCase);
137137

138138
var coEnabledResult = config.WithKeys(ConfigurationKeys.Debugger.CodeOriginForSpansEnabled).AsBoolResult();
139-
CodeOriginForSpansEnabled = coEnabledResult.WithDefault(false);
140139
CodeOriginForSpansCanBeEnabled = coEnabledResult.ConfigurationResult is not { IsValid: true, Result: false };
140+
CodeOriginForSpansEnabled = CodeOriginForSpansCanBeEnabled && (coEnabledResult.WithDefault(false) || DynamicInstrumentationEnabled);
141141

142142
CodeOriginMaxUserFrames = config
143143
.WithKeys(ConfigurationKeys.Debugger.CodeOriginMaxUserFrames)

tracer/test/Datadog.Trace.Tests/Debugger/SpanCodeOriginTests.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,6 @@ public void SetCodeOrigin_WhenSpanIsNull_DoesNotThrow()
229229
spanCodeOrigin.SetCodeOriginForExitSpan(null);
230230
}
231231

232-
[Fact]
233-
public void SetCodeOrigin_WhenDisabled_DoesNotSetTags()
234-
{
235-
// Arrange
236-
SpanCodeOrigin spanCodeOrigin = CreateSpanCodeOrigin(false);
237-
238-
var span = new Span(new SpanContext(1, 2, SamplingPriority.UserKeep), DateTimeOffset.UtcNow);
239-
240-
// Act
241-
spanCodeOrigin.SetCodeOriginForExitSpan(span);
242-
243-
// Assert
244-
span.Tags.GetTag(CodeOriginTag + ".type").Should().BeNull();
245-
}
246-
247232
[Fact]
248233
public void SetCodeOrigin_WhenEnabled_SetsCorrectTags()
249234
{

0 commit comments

Comments
 (0)