Skip to content

Commit ea167be

Browse files
authored
[Code Origin] DEBUG-4174 - Make Code Origin on by default (#8272)
## Summary of changes Enable Code Origin for entry spans by default (DD_CODE_ORIGIN_FOR_SPANS_ENABLED now defaults to true). Add the always-present Code Origin tags as generated tag properties on AspNetCoreTags Update ASP.NET Core integration snapshots and metadata rules to account for Code Origin tags on entry spans. ## Reason for change Make Code Origin tags available out-of-the-box on supported entry spans (currently ASP.NET Core). ## Implementation details `CodeOriginForSpansEnabled` now uses `WithDefault(true)`. Explicit `DD_CODE_ORIGIN_FOR_SPANS_ENABLED=false` still hard-disables. Reduce allocations/locking on the entry-span hot path by leveraging generated tag properties for Code Origin fields. - `AspNetCoreTags` and `AspNetCoreSingleSpanTags` add generated `[Tag]` properties for entry Code Origin tags, scoped to ASP.NET Core entry spans. - Code Origin tags are only emitted when set. - Unsupported tag types are skipped with a debug log instead of using the generic `ITags` write path. - Code Origin presence checks use the concrete ASP.NET Core tag properties first, then fall back to generic tag lookup for duplicate detection. ## Test coverage Updated focused unit coverage: - `Datadog.Trace.Tests.Debugger.SpanCodeOriginTests` - `Datadog.Trace.Tests.Debugger.DebuggerSettingsTests` - `Datadog.Trace.Tests.DiagnosticListeners.AspNetCoreDiagnosticObserverTests` - `Datadog.Trace.Debugger.IntegrationTests.DebuggerManagerTests` - `Datadog.Trace.Debugger.IntegrationTests.DebuggerManagerDynamicTests` Updated ASP.NET Core integration snapshots to verify serialized Code Origin tags across affected APM, Security, IAST, MVC, minimal API, and IIS scenarios. Added Verify scrubbers/tests for Code Origin file paths, line numbers, and column numbers so snapshot output is stable across machines.
1 parent b01af68 commit ea167be

581 files changed

Lines changed: 6314 additions & 1126 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/span_attribute_schema/v0.md

Lines changed: 292 additions & 6 deletions
Large diffs are not rendered by default.

docs/span_attribute_schema/v1.md

Lines changed: 192 additions & 387 deletions
Large diffs are not rendered by default.

tracer/build/_build/GenerateSpanDocumentation/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ public void ParseRequirements(ArgumentListSyntax arg, PropertyType propertyType)
241241
case "IsPresent": // only for tags
242242
requiredValue = "Yes";
243243
break;
244+
case "IsAbsent": // only for tags - must NOT be present
245+
requiredValue = "Must be absent";
246+
break;
244247
case "PassesThroughSource": // only for additional tags
245248
operationName = "PassThru";
246249
requiredValue = "No";

tracer/build/_build/SmokeTests/SmokeTestScenario.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public record TrimmingScenario : SmokeTestScenario
119119
public required string PackageName { get; init; }
120120
public string? PackageVersionSuffix { get; init; }
121121
public string InstallCommand => InstallType.GetInstallCommand();
122+
123+
// Single-file trimming publishes bundled user assemblies without Assembly.Location.
124+
// Code Origin still emits reflection-derived frame tags, but PDB-backed file/line/column tags are unavailable.
125+
public override string SnapshotFile => "smoke_test_snapshots_trimming";
122126
}
123127

124128
public record WindowsMsiScenario : SmokeTestScenario

tracer/build/_build/docker/smoke.windows.dd-dotnet.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WORKDIR /src
99
COPY ./test/test-applications/regression/AspNetCoreSmokeTest/ .
1010

1111
ARG PUBLISH_FRAMEWORK
12-
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% -o /src/publish
12+
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% /p:PathMap=C:\src=/src -o /src/publish
1313

1414
FROM $RUNTIME_IMAGE AS publish-msi
1515
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

tracer/build/_build/docker/smoke.windows.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WORKDIR /src
99
COPY ./test/test-applications/regression/AspNetCoreSmokeTest/ .
1010

1111
ARG PUBLISH_FRAMEWORK
12-
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% -o /src/publish
12+
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% /p:PathMap=C:\src=/src -o /src/publish
1313

1414
FROM $RUNTIME_IMAGE AS publish-msi
1515
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

tracer/build/_build/docker/smoke.windows.dotnet-tool.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WORKDIR /src
99
COPY ./test/test-applications/regression/AspNetCoreSmokeTest/ .
1010

1111
ARG PUBLISH_FRAMEWORK
12-
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% -o /src/publish
12+
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% /p:PathMap=C:\src=/src -o /src/publish
1313

1414
FROM $RUNTIME_IMAGE AS publish
1515
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

tracer/build/_build/docker/smoke.windows.fleet-installer.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WORKDIR /src
99
COPY ./test/test-applications/regression/AspNetCoreSmokeTest/ .
1010

1111
ARG PUBLISH_FRAMEWORK
12-
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% -o /src/publish
12+
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% /p:PathMap=C:\src=/src -o /src/publish
1313

1414
FROM $RUNTIME_IMAGE AS publish
1515
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

tracer/build/_build/docker/smoke.windows.iis.fleet-installer.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WORKDIR /src
99
COPY ./test/test-applications/regression/AspNetCoreSmokeTest/ .
1010

1111
ARG PUBLISH_FRAMEWORK
12-
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% -o /src/publish
12+
RUN dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% /p:PathMap=C:\src=/src -o /src/publish
1313

1414
FROM $RUNTIME_IMAGE AS publish
1515
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

tracer/build/_build/docker/smoke.windows.nuget.dd-dotnet.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ARG TOOL_VERSION
1616
RUN dotnet restore "AspNetCoreSmokeTest.csproj" \
1717
&& dotnet nuget add source "c:\src\artifacts" \
1818
&& dotnet add package "Datadog.Trace.Bundle" --version %TOOL_VERSION% \
19-
&& dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% -o "c:\src\publish"
19+
&& dotnet publish "AspNetCoreSmokeTest.csproj" -c Release --framework %PUBLISH_FRAMEWORK% /p:PathMap=C:\src=/src -o "c:\src\publish"
2020

2121
FROM $RUNTIME_IMAGE AS publish-msi
2222
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

0 commit comments

Comments
 (0)