Skip to content

Conversation

@vandonr
Copy link
Contributor

@vandonr vandonr commented Dec 3, 2025

Summary of changes

same as DataDog/dd-trace-java#9156

  • send container ID to the agent with feature discovery requests
  • get back the container tags hash and store it

This hash is meant to be matched in the backend with the actual container tags, with the advantage that :

  • it's less cardinality than container ID
  • it's smaller than propagating th tag values themselves

related RFC: https://docs.google.com/document/d/15GtNOKGBCt6Dc-HsDNnMmCdZwhewFQx8yUlI9in5n3M

Implementation details

storing the value in a public static is probably not the best, but I'm following what my predecessors did on the container metadata 😬

Test coverage

Other details

@vandonr vandonr requested a review from a team as a code owner December 3, 2025 09:26
Comment on lines +223 to +228
// Add container ID header if available
var containerId = ContainerMetadata.GetContainerId();
if (containerId != null)
{
api.AddHeader(AgentHttpHeaderNames.ContainerId, containerId);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are fixed for the lifetime of the app, right? In that case, we should likely include it as a default header instead, as part of the CreateApiRequestFactory call

var containerTagsHash = response.GetHeader(AgentHttpHeaderNames.ContainerTagsHash);
if (containerTagsHash != null)
{
ContainerMetadata.ContainerTagsHash = containerTagsHash;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear you're trolling me with all this static stuff 😅 Having static readonly state is one thing, but having static mutable state is a whole new ball game 😛 I think the ContainerMetadata object likely needs refactoring to be an instance type and passed in to where it's used, so that we don't destroy our tests completely. I'd suggest doing that in a separate PR first, then rebasing this on top

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok fair 😅

/// <summary>
/// Gets or sets the container tags hash received from the agent, used by DBM/DSM
/// </summary>
public static string ContainerTagsHash { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, this isn't actually used anywhere? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yet 😏
I could use it in the same PR, but I wanted to do baby steps. It's gonna be used in DSM and DBM injection

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Dec 3, 2025

⚠️ Tests

⚠️ Warnings

🧪 1 Test failed

AdaptiveCleanupAsync_Should_Handle_Cancellation_Gracefully from Datadog.Trace.Tests.Debugger.CacheTests.ConcurrentAdaptiveCacheTests (Datadog)
The operation has timed out.

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9a80cbf | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@dd-trace-dotnet-ci-bot
Copy link

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7893) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration74.79 ± (74.89 - 75.64) ms74.83 ± (74.94 - 75.65) ms+0.1%✅⬆️
.NET Framework 4.8 - Bailout
duration78.51 ± (78.45 - 79.09) ms79.68 ± (79.78 - 80.48) ms+1.5%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1060.40 ± (1061.54 - 1070.92) ms1065.17 ± (1066.54 - 1074.37) ms+0.4%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.71 ± (22.63 - 22.78) ms23.02 ± (22.95 - 23.10) ms+1.4%✅⬆️
process.time_to_main_ms86.26 ± (85.90 - 86.62) ms86.91 ± (86.61 - 87.21) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.93 - 10.93) MB10.90 ± (10.90 - 10.91) MB-0.2%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.56 ± (22.50 - 22.62) ms22.74 ± (22.68 - 22.80) ms+0.8%✅⬆️
process.time_to_main_ms87.99 ± (87.60 - 88.38) ms88.71 ± (88.32 - 89.09) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.96 ± (10.96 - 10.96) MB10.95 ± (10.95 - 10.95) MB-0.1%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms222.60 ± (221.24 - 223.97) ms223.61 ± (222.06 - 225.15) ms+0.4%✅⬆️
process.time_to_main_ms499.70 ± (498.57 - 500.83) ms504.12 ± (503.04 - 505.20) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.86 ± (47.84 - 47.88) MB47.89 ± (47.87 - 47.91) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.5%
.NET 6 - Baseline
process.internal_duration_ms21.65 ± (21.58 - 21.72) ms21.87 ± (21.81 - 21.93) ms+1.0%✅⬆️
process.time_to_main_ms75.46 ± (75.14 - 75.78) ms77.41 ± (77.11 - 77.70) ms+2.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.60 ± (10.60 - 10.61) MB10.62 ± (10.62 - 10.63) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.68 ± (21.62 - 21.75) ms21.65 ± (21.58 - 21.72) ms-0.2%
process.time_to_main_ms77.43 ± (77.08 - 77.77) ms78.31 ± (77.96 - 78.67) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.65 ± (10.65 - 10.66) MB10.66 ± (10.66 - 10.67) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms213.07 ± (211.89 - 214.25) ms212.42 ± (211.41 - 213.43) ms-0.3%
process.time_to_main_ms467.74 ± (466.73 - 468.75) ms470.39 ± (469.11 - 471.67) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.04 ± (48.02 - 48.06) MB48.05 ± (48.03 - 48.07) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 8 - Baseline
process.internal_duration_ms19.73 ± (19.67 - 19.79) ms20.04 ± (19.97 - 20.12) ms+1.6%✅⬆️
process.time_to_main_ms74.91 ± (74.61 - 75.21) ms76.05 ± (75.74 - 76.37) ms+1.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.64 ± (7.64 - 7.65) MB7.66 ± (7.65 - 7.66) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.72 ± (19.66 - 19.78) ms19.99 ± (19.91 - 20.06) ms+1.4%✅⬆️
process.time_to_main_ms75.83 ± (75.57 - 76.09) ms76.73 ± (76.40 - 77.06) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.69 ± (7.68 - 7.69) MB7.73 ± (7.72 - 7.73) MB+0.5%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms193.90 ± (192.91 - 194.89) ms195.43 ± (194.48 - 196.39) ms+0.8%✅⬆️
process.time_to_main_ms456.26 ± (455.12 - 457.40) ms457.11 ± (456.09 - 458.13) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.36 ± (36.32 - 36.40) MB36.49 ± (36.45 - 36.53) MB+0.4%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration192.80 ± (192.87 - 193.63) ms192.97 ± (192.59 - 193.50) ms+0.1%✅⬆️
.NET Framework 4.8 - Bailout
duration197.03 ± (196.82 - 197.39) ms196.66 ± (196.60 - 197.11) ms-0.2%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1109.34 ± (1116.09 - 1125.16) ms1116.63 ± (1120.88 - 1130.48) ms+0.7%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms188.66 ± (188.35 - 188.97) ms188.61 ± (188.26 - 188.95) ms-0.0%
process.time_to_main_ms81.22 ± (80.99 - 81.45) ms80.90 ± (80.65 - 81.15) ms-0.4%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.15 ± (16.12 - 16.19) MB16.15 ± (16.12 - 16.18) MB-0.0%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.3%
.NET Core 3.1 - Bailout
process.internal_duration_ms187.94 ± (187.63 - 188.25) ms187.75 ± (187.46 - 188.05) ms-0.1%
process.time_to_main_ms82.28 ± (82.10 - 82.46) ms82.07 ± (81.93 - 82.20) ms-0.3%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.23 ± (16.20 - 16.26) MB16.21 ± (16.18 - 16.23) MB-0.2%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (20 - 21)-0.3%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms397.61 ± (395.16 - 400.06) ms402.82 ± (400.07 - 405.58) ms+1.3%✅⬆️
process.time_to_main_ms474.23 ± (473.66 - 474.80) ms476.56 ± (475.89 - 477.24) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.50 ± (58.36 - 58.64) MB58.79 ± (58.67 - 58.91) MB+0.5%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
.NET 6 - Baseline
process.internal_duration_ms192.57 ± (192.22 - 192.93) ms193.13 ± (192.79 - 193.47) ms+0.3%✅⬆️
process.time_to_main_ms70.40 ± (70.24 - 70.56) ms70.52 ± (70.29 - 70.75) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.22 ± (16.09 - 16.34) MB16.22 ± (16.10 - 16.35) MB+0.1%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)19 ± (18 - 19)+1.9%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms191.56 ± (191.28 - 191.84) ms191.96 ± (191.65 - 192.27) ms+0.2%✅⬆️
process.time_to_main_ms71.16 ± (71.07 - 71.26) ms71.48 ± (71.36 - 71.61) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.34 ± (16.23 - 16.45) MB16.24 ± (16.12 - 16.37) MB-0.6%
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.7%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms410.41 ± (408.18 - 412.64) ms409.06 ± (406.90 - 411.22) ms-0.3%
process.time_to_main_ms444.31 ± (443.65 - 444.97) ms442.75 ± (442.20 - 443.30) ms-0.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed59.00 ± (58.86 - 59.13) MB58.67 ± (58.51 - 58.82) MB-0.6%
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (29 - 30)-0.0%
.NET 8 - Baseline
process.internal_duration_ms190.94 ± (190.58 - 191.30) ms191.38 ± (190.95 - 191.82) ms+0.2%✅⬆️
process.time_to_main_ms69.58 ± (69.40 - 69.76) ms69.92 ± (69.72 - 70.12) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.76 ± (11.73 - 11.79) MB11.80 ± (11.77 - 11.83) MB+0.3%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.2%
.NET 8 - Bailout
process.internal_duration_ms189.46 ± (189.26 - 189.66) ms190.15 ± (189.92 - 190.39) ms+0.4%✅⬆️
process.time_to_main_ms70.64 ± (70.55 - 70.72) ms70.53 ± (70.41 - 70.65) ms-0.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.84 ± (11.78 - 11.91) MB11.87 ± (11.84 - 11.90) MB+0.2%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.8%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms363.91 ± (362.35 - 365.48) ms366.22 ± (364.93 - 367.52) ms+0.6%✅⬆️
process.time_to_main_ms430.76 ± (430.12 - 431.39) ms429.98 ± (429.42 - 430.54) ms-0.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.90 ± (47.86 - 47.93) MB47.91 ± (47.88 - 47.94) MB+0.0%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.7%✅⬆️
Comparison explanation

Execution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (75ms)  : 70, 80
    master - mean (75ms)  : 69, 81

    section Bailout
    This PR (7893) - mean (80ms)  : 75, 85
    master - mean (79ms)  : 74, 83

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (1,070ms)  : 1013, 1128
    master - mean (1,066ms)  : 997, 1135

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (117ms)  : 111, 123
    master - mean (117ms)  : 109, 124

    section Bailout
    This PR (7893) - mean (119ms)  : 112, 126
    master - mean (118ms)  : 110, 126

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (766ms)  : 731, 801
    master - mean (759ms)  : 717, 801

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (106ms)  : 100, 113
    master - mean (104ms)  : 99, 110

    section Bailout
    This PR (7893) - mean (107ms)  : 101, 113
    master - mean (106ms)  : 100, 113

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (709ms)  : 680, 739
    master - mean (709ms)  : 680, 738

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (105ms)  : 99, 111
    master - mean (103ms)  : 97, 109

    section Bailout
    This PR (7893) - mean (105ms)  : 100, 111
    master - mean (104ms)  : 98, 110

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (686ms)  : 652, 720
    master - mean (685ms)  : 652, 717

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (193ms)  : 189, 198
    master - mean (193ms)  : 189, 197

    section Bailout
    This PR (7893) - mean (197ms)  : 194, 199
    master - mean (197ms)  : 194, 200

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (1,126ms)  : 1054, 1197
    master - mean (1,121ms)  : 1051, 1191

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (278ms)  : 273, 283
    master - mean (279ms)  : 274, 283

    section Bailout
    This PR (7893) - mean (278ms)  : 274, 282
    master - mean (279ms)  : 274, 283

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (919ms)  : 884, 955
    master - mean (913ms)  : 867, 958

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (272ms)  : 266, 278
    master - mean (271ms)  : 267, 276

    section Bailout
    This PR (7893) - mean (271ms)  : 268, 275
    master - mean (271ms)  : 267, 274

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (889ms)  : 841, 937
    master - mean (892ms)  : 855, 929

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7893) - mean (271ms)  : 265, 277
    master - mean (270ms)  : 265, 275

    section Bailout
    This PR (7893) - mean (270ms)  : 267, 273
    master - mean (270ms)  : 266, 273

    section CallTarget+Inlining+NGEN
    This PR (7893) - mean (826ms)  : 801, 852
    master - mean (828ms)  : 807, 848

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants