Skip to content

Conversation

@andrewlock
Copy link
Member

@andrewlock andrewlock commented Oct 28, 2025

Summary of changes

  • This is the big one
  • Update services to dynamically update when mutable settings or exporter settings change
  • Stop rebuilding everything when there's manual/remote configuration

Reason for change

This is the "endpoint" that we've been heading for - services only being disposed/rebuilt at the end of the app, and otherwise only rebuilding the necessary parts. For example - we don't need to tear down all the API factories when a customer changes a global tag via remote config; they only need to change if the ExporterSettings change.

The hope is that overall this reduces the overhead of using configuration in code and/or remote configuration, while also reducing the number of issues due to managing disposal of services.

Implementation details

Overall, this PR is kind of a pain. Moving from the "rebuild everything" to "reconfigure each service" couldn't be done piecemeal, so this is the one-shot PR. What's more, different services need different patterns (though we can probably consolidate some of them, this has taken a lot of work and I likely changed patterns unnecessarily in some places).

In general, there's a couple of patterns:

  • CI Vis doesn't let you change settings at runtime, so it never needs to respond to changes. It always just uses the "initial" settings
  • Debugger today doesn't respond to changes at runtime (except its own dynamic config), so for now we ignore Debugger too as it's not really a regression. I hope we can fix this soon though.
  • I've introduced the concept of Managed* versions of some services
    • These services generally "wrap" the existing type, delegating access to the underlying service, and handling settings changes
  • Many services only care about a sub-set of mutable settings, so they only update if they need to
  • Somewhat annoyingly, setting updates occur on a background thread, so we need to be careful about thread safety. Where necessary (most places) I've made sure access to a now-mutable service is done using Volatile.Read() (to ensure changes are visible) and are generally cached to a local variable (as the underlying field may be updated in the background).

Test coverage

In the vast majority of places, this should be covered by existing tests

I plan to add some additional integration tests around reconfiguring and a bunch of manual testing to make sure I'm confident.

Other details

I strongly recommend reviewing commit-by-commit. They're generally self-contained, and hopefully simple enough to understand one commit at a time.

https://datadoghq.atlassian.net/browse/LANGPLAT-819

Part of a config stack

This isn't the final PR in the stack, as there will be a bunch of cleaning up to do, but it's the final "implementation" PR

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@andrewlock andrewlock force-pushed the andrew/settings/5-remove-mutablesettings branch 3 times, most recently from 2bc63f6 to 34f0d90 Compare October 28, 2025 15:02
@andrewlock andrewlock force-pushed the andrew/settings/5-move-mutable-settings-off-tracer-settings branch from e347879 to 8c472a5 Compare October 28, 2025 15:02
@andrewlock andrewlock force-pushed the andrew/settings/5-remove-mutablesettings branch from 34f0d90 to f1e1c7e Compare October 28, 2025 15:20
@andrewlock andrewlock force-pushed the andrew/settings/5-move-mutable-settings-off-tracer-settings branch from 8c472a5 to 8e19e3a Compare October 28, 2025 15:20
@datadog-official
Copy link

datadog-official bot commented Oct 28, 2025

⚠️ Tests

⚠️ Warnings

❄️ 3 New flaky tests detected

TestDirectoryListingLeak from Datadog.Trace.Security.IntegrationTests.Iast.AspNetCore5IastTestsRestartedSampleIastEnabled (Datadog)
Unable to determine port application is listening on
TestDirectoryListingLeak from Datadog.Trace.Security.IntegrationTests.Iast.AspNetCore5IastTestsRestartedSampleIastEnabled (Datadog)
Unable to determine port application is listening on
SinkRejectsGiantMessages from Datadog.Trace.Tests.Logging.DirectSubmission.Sink.DatadogSinkTests (Datadog)
Expected logsApi.Logs to be True, but found False.

ℹ️ Info

🧪 All tests passed

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

@andrewlock andrewlock force-pushed the andrew/settings/5-remove-mutablesettings branch from f1e1c7e to c2b6a1c Compare October 28, 2025 18:13
@andrewlock andrewlock requested review from a team as code owners October 28, 2025 18:13
@andrewlock andrewlock requested review from link04 and removed request for a team October 28, 2025 18:13
@andrewlock andrewlock force-pushed the andrew/settings/5-move-mutable-settings-off-tracer-settings branch from 8e19e3a to 7940c31 Compare October 28, 2025 18:13
@andrewlock andrewlock force-pushed the andrew/settings/5-remove-mutablesettings branch from c2b6a1c to 48c7644 Compare October 29, 2025 08:57
@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Oct 29, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7724) 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
duration76.78 ± (76.41 - 77.15) ms75.38 ± (75.39 - 76.24) ms-1.8%
.NET Framework 4.8 - Bailout
duration79.01 ± (78.98 - 79.74) ms80.20 ± (79.96 - 80.67) ms+1.5%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1049.83 ± (1055.45 - 1066.15) ms1057.56 ± (1057.05 - 1063.71) ms+0.7%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms23.22 ± (23.13 - 23.30) ms22.74 ± (22.67 - 22.82) ms-2.0%
process.time_to_main_ms88.30 ± (87.93 - 88.66) ms86.91 ± (86.54 - 87.27) ms-1.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.91 - 10.91) MB10.92 ± (10.92 - 10.93) MB+0.1%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.87 ± (22.81 - 22.92) ms22.78 ± (22.71 - 22.85) ms-0.4%
process.time_to_main_ms88.28 ± (87.95 - 88.61) ms89.38 ± (88.98 - 89.77) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.95 - 10.95) MB10.97 ± (10.96 - 10.97) 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.75 ± (220.67 - 224.82) ms221.43 ± (220.26 - 222.60) ms-0.6%
process.time_to_main_ms497.99 ± (496.96 - 499.02) ms503.07 ± (501.92 - 504.22) ms+1.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.84 ± (47.82 - 47.86) MB47.90 ± (47.88 - 47.92) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.5%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.84 ± (21.78 - 21.90) ms21.78 ± (21.71 - 21.84) ms-0.3%
process.time_to_main_ms76.39 ± (76.09 - 76.69) ms77.42 ± (77.07 - 77.77) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.60 ± (10.59 - 10.60) MB10.64 ± (10.63 - 10.64) MB+0.4%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.68 ± (21.62 - 21.74) ms21.54 ± (21.50 - 21.59) ms-0.6%
process.time_to_main_ms77.45 ± (77.18 - 77.72) ms77.61 ± (77.38 - 77.85) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.68 ± (10.67 - 10.68) MB10.67 ± (10.67 - 10.68) MB-0.0%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms209.24 ± (207.97 - 210.51) ms211.51 ± (210.35 - 212.67) ms+1.1%✅⬆️
process.time_to_main_ms468.88 ± (467.90 - 469.85) ms469.30 ± (468.41 - 470.19) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.12 ± (48.10 - 48.15) MB48.12 ± (48.10 - 48.14) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.94 ± (19.86 - 20.02) ms20.19 ± (20.11 - 20.26) ms+1.2%✅⬆️
process.time_to_main_ms74.90 ± (74.52 - 75.29) ms76.12 ± (75.72 - 76.52) ms+1.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.66 ± (7.65 - 7.67) MB7.68 ± (7.68 - 7.69) MB+0.3%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.98 ± (19.93 - 20.04) ms19.92 ± (19.85 - 19.99) ms-0.3%
process.time_to_main_ms76.52 ± (76.23 - 76.81) ms75.72 ± (75.44 - 76.00) ms-1.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.71 ± (7.70 - 7.72) MB7.72 ± (7.72 - 7.73) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms193.41 ± (192.48 - 194.34) ms194.54 ± (193.46 - 195.62) ms+0.6%✅⬆️
process.time_to_main_ms458.24 ± (457.32 - 459.16) ms458.06 ± (456.99 - 459.14) ms-0.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.48 ± (36.44 - 36.53) MB36.42 ± (36.38 - 36.46) MB-0.2%
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
duration193.09 ± (192.96 - 193.76) ms194.96 ± (194.97 - 195.77) ms+1.0%✅⬆️
.NET Framework 4.8 - Bailout
duration196.53 ± (196.52 - 197.10) ms198.74 ± (198.61 - 199.09) ms+1.1%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1111.45 ± (1118.20 - 1128.70) ms1128.12 ± (1127.17 - 1132.41) ms+1.5%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms188.47 ± (188.10 - 188.84) ms190.32 ± (190.03 - 190.61) ms+1.0%✅⬆️
process.time_to_main_ms81.01 ± (80.79 - 81.23) ms81.98 ± (81.78 - 82.18) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.02 ± (16.00 - 16.05) MB16.08 ± (16.06 - 16.11) MB+0.4%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.3%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms187.74 ± (187.43 - 188.05) ms190.40 ± (189.99 - 190.82) ms+1.4%✅⬆️
process.time_to_main_ms81.98 ± (81.85 - 82.11) ms83.42 ± (83.25 - 83.59) ms+1.8%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.15 ± (16.11 - 16.18) MB16.12 ± (16.10 - 16.14) MB-0.1%
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (20 - 21)-0.3%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms409.92 ± (406.45 - 413.39) ms406.56 ± (403.96 - 409.16) ms-0.8%
process.time_to_main_ms470.48 ± (469.85 - 471.10) ms479.78 ± (479.17 - 480.39) ms+2.0%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.69 ± (58.57 - 58.81) MB59.01 ± (58.94 - 59.07) MB+0.5%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.0%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms193.04 ± (192.61 - 193.47) ms193.98 ± (193.67 - 194.28) ms+0.5%✅⬆️
process.time_to_main_ms70.11 ± (69.94 - 70.29) ms71.18 ± (71.01 - 71.36) ms+1.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.21 ± (16.08 - 16.33) MB16.39 ± (16.32 - 16.45) MB+1.1%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 19)19 ± (19 - 19)+1.9%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms191.68 ± (191.39 - 191.98) ms194.48 ± (194.10 - 194.85) ms+1.5%✅⬆️
process.time_to_main_ms70.79 ± (70.70 - 70.88) ms72.36 ± (72.20 - 72.53) ms+2.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.25 ± (16.11 - 16.39) MB16.39 ± (16.31 - 16.46) MB+0.8%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 20)20 ± (20 - 20)+2.9%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms411.39 ± (408.59 - 414.19) ms413.86 ± (411.99 - 415.73) ms+0.6%✅⬆️
process.time_to_main_ms442.16 ± (441.51 - 442.82) ms449.26 ± (448.63 - 449.89) ms+1.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.72 ± (58.57 - 58.87) MB59.48 ± (59.40 - 59.56) MB+1.3%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)29 ± (29 - 29)-0.5%
.NET 8 - Baseline
process.internal_duration_ms190.45 ± (190.15 - 190.76) ms192.24 ± (191.96 - 192.52) ms+0.9%✅⬆️
process.time_to_main_ms69.66 ± (69.48 - 69.85) ms70.93 ± (70.73 - 71.13) ms+1.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.73 - 11.78) MB11.73 ± (11.71 - 11.76) MB-0.2%
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.1%
.NET 8 - Bailout
process.internal_duration_ms189.78 ± (189.50 - 190.06) ms191.91 ± (191.61 - 192.21) ms+1.1%✅⬆️
process.time_to_main_ms70.73 ± (70.61 - 70.84) ms71.75 ± (71.64 - 71.86) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.82 ± (11.79 - 11.86) MB11.80 ± (11.77 - 11.83) MB-0.2%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.3%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms367.06 ± (365.63 - 368.49) ms372.34 ± (370.93 - 373.75) ms+1.4%✅⬆️
process.time_to_main_ms432.28 ± (431.59 - 432.97) ms438.17 ± (437.59 - 438.75) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.92 ± (47.89 - 47.95) MB47.87 ± (47.83 - 47.90) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-1.1%
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 (7724) - mean (76ms)  : 70, 82
    master - mean (77ms)  : 71, 82

    section Bailout
    This PR (7724) - mean (80ms)  : 75, 86
    master - mean (79ms)  : 73, 85

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (1,060ms)  : 1013, 1108
    master - mean (1,061ms)  : 983, 1138

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 (7724) - mean (118ms)  : 111, 124
    master - mean (119ms)  : 113, 125

    section Bailout
    This PR (7724) - mean (120ms)  : 113, 127
    master - mean (119ms)  : 111, 126

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (765ms)  : 736, 794
    master - mean (763ms)  : 707, 819

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7724) - mean (107ms)  : 101, 113
    master - mean (105ms)  : 100, 110

    section Bailout
    This PR (7724) - mean (106ms)  : 101, 112
    master - mean (106ms)  : 100, 111

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (718ms)  : 679, 757
    master - mean (708ms)  : 671, 745

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

    section Bailout
    This PR (7724) - mean (104ms)  : 99, 110
    master - mean (105ms)  : 99, 111

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (695ms)  : 665, 725
    master - mean (690ms)  : 658, 721

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 (7724) - mean (195ms)  : 192, 199
    master - mean (193ms)  : 189, 197

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

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (1,130ms)  : 1092, 1167
    master - mean (1,123ms)  : 1049, 1198

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 (7724) - mean (281ms)  : 276, 285
    master - mean (278ms)  : 273, 283

    section Bailout
    This PR (7724) - mean (282ms)  : 277, 287
    master - mean (278ms)  : 274, 282

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (929ms)  : 890, 968
    master - mean (913ms)  : 856, 971

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7724) - mean (274ms)  : 270, 277
    master - mean (272ms)  : 265, 278

    section Bailout
    This PR (7724) - mean (275ms)  : 270, 280
    master - mean (271ms)  : 267, 274

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (899ms)  : 866, 933
    master - mean (888ms)  : 844, 931

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7724) - mean (273ms)  : 269, 278
    master - mean (270ms)  : 264, 276

    section Bailout
    This PR (7724) - mean (273ms)  : 269, 277
    master - mean (270ms)  : 266, 274

    section CallTarget+Inlining+NGEN
    This PR (7724) - mean (844ms)  : 820, 868
    master - mean (830ms)  : 812, 849

Loading

…n't respond to changes

I left it like this because the debugger already doesn't respond to changes like other services do
- Move statsd instance creation to separate factory
- Create a StatsdManager to handle automatic updating in response to setting changes
- Always create a statsd instance, as it's hard to know if we're _ever_ going to need one, and reduces some of the compexity
This isn't necessary with the current design, and it causes issues today
Make sure we can't dispose a stats consumer that's in use (as it will throw)
Rework to use a "lease" mechanism to track usages
Make passing in a statsmanager required
The statsd client does sync-over-async in the flush and dispose paths, which can lead to deadlocks and thread exhaustion.
To work around that, we push the dispose to happen on a thread-pool thread instead, in the background
… config changes (#7796)

## Summary of changes

A fix for #7724 to handle telemetry reporting in dynamic config "reset"
scenarios

## Reason for change

The system tests for #7724 were failing in some dynamic configuration
scenarios. Specifically, the tests were sending remote config _without_
any configuration values "i.e. 'reset to use defaults'" and were waiting
a telemetry update. However, we never sent it, because there was "no
telemetry to record".

Note that we _did_ correctly apply the new configuration, we just didn't
report the telemetry correctly, primarily due to limitations in the
telemetry protocol. This PR adds a fix for that, and will be merged into
#7724.

## Implementation details

The solution is to "remember" the telemetry from the default mutable
configuration values, _without_ any dynamic sources, and "replay" this
telemetry when we update telemetry. This feels kind of hacky, but it's
something I suspected we might need to do, and had been avoiding up to
this point because we do a "full reconfigure" anyway.

## Test coverage

Added a specific unit test that mimics the behaviour of the system-test
(i.e. an "empty" dynamic config response) and confirms the telemetry is
recorded as expected

## Other details

https://datadoghq.atlassian.net/browse/LANGPLAT-819

Part of a config stack

- #7522
- #7525
- #7530
- #7532
- #7543
- #7544
- #7721
- #7722
- #7695
- #7723
- #7724
- #7796 👈

Unlike other PRs in the stack, I'll merge this directly into #7724 to
fix the tests there, just thought I'd keep this separate for easier
reviewing
@andrewlock andrewlock force-pushed the andrew/settings/5-remove-mutablesettings branch from 447027a to 9db67e4 Compare November 26, 2025 13:34
Copy link
Collaborator

@NachoEchevarria NachoEchevarria left a comment

Choose a reason for hiding this comment

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

Impressive! Thanks!

@andrewlock andrewlock merged commit 8c4a8c4 into master Nov 26, 2025
151 of 153 checks passed
@andrewlock andrewlock deleted the andrew/settings/5-remove-mutablesettings branch November 26, 2025 18:21
@github-actions github-actions bot added this to the vNext-v3 milestone Nov 26, 2025
andrewlock added a commit that referenced this pull request Nov 27, 2025
## Summary of changes

Updates a couple of places where we're calling `Tracer.Instance` where
we don't need to

## Reason for change

In one of my other PRs I accidentally broke something that should _only_
have affected integration tests, but a bunch of unit tests broke. It
highlighted where they were using `Tracer.Instance` and setting the
global tracer for tests. In other places, it revealed that code that
tests that _looked_ independent of other tests really wasn't...

Calling `Tracer.Instance` potentially does a _lot_ of work, as it
initializes the tracer. It's also hard to follow if we're making static
calls out in places we don't need to. So just pass through the settings
we want instead.

## Implementation details

Instead of calling `Tracer.Instance.Settings`, use the value of `Tracer`
or `TracerSettings` that's already available wherever possible. It makes
the tests cleaner too.

## Test coverage

Same coverage, just a bit cleaner 

## Other details

Included as part of the config stack, just because I already refactored
some of this code, and can't be bothered to faff with merge conflicts:

https://datadoghq.atlassian.net/browse/LANGPLAT-819

- #7522
- #7525
- #7530
- #7532
- #7543
- #7544
- #7721
- #7722
- #7695
- #7723
- #7724
- #7744 👈
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants