Skip to content

[RCM] Use libdatadog's remote configuration client - #9406

Open
bwoebi wants to merge 4 commits into
masterfrom
bob/rc-libdatadog
Open

bwoebi wants to merge 4 commits into
masterfrom
bob/rc-libdatadog

Conversation

@bwoebi

@bwoebi bwoebi commented Oct 14, 2026 •

Copy link
Copy Markdown

Replaces the managed remote configuration protocol implementation (request building, response deserialization, TUF targets, applied configs cache) with the libdatadog remote config client (libdatadog-dotnet's ddog_rc_* FFI), which talks to the agent itself and validates the file hashes.

The config contents stay in native memory: RemoteConfiguration.Contents is a RemoteConfigurationContent read in place via UnmanagedMemoryStream, so the payloads are no longer copied onto the managed heap.

The subscription API and dispatch are unchanged. The protocol DTOs are moved to the test helpers, whose mock agent responses now carry real hashes.

It also not yet implements agentless remote config. This however is a rather minor change - mostly wiring up configuration at that point, and forwarding that to the native code.

This requires DataDog/libdatadog-dotnet#60. (The pipeline is broken as longas that isn't merged.)

bwoebi and others added 2 commits October 12, 2026 16:38
libdatadog v45 is source compatible with v38 for the profiling, crashtracker
and library-config FFI (only additions). The musl builds now import
fstatfs, mkdir, openat, pipe, readlinkat, rename and statfs, and no longer
import dup. The version pins in FindLibdatadog.cmake and the vcpkg port are
to be updated once the corresponding libdatadog-dotnet release exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the managed remote configuration protocol implementation (request
building, response deserialization, TUF targets, applied configs cache) with
the libdatadog remote config client (libdatadog-dotnet's ddog_rc_* FFI),
which talks to the agent itself and validates the file hashes.

The config contents stay in native memory: RemoteConfiguration.Contents is a
RemoteConfigurationContent read in place via UnmanagedMemoryStream (or a span
on .NET Core), so the payloads are no longer copied onto the managed heap.

The subscription API and dispatch are unchanged. The protocol DTOs are moved
to the test helpers, whose mock agent responses now carry real hashes.
@bwoebi
bwoebi requested review from a team as code owners October 14, 2026 15:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T15:14:34.576362Z 878f207 PR opened
🔒 Security Review ✅ Completed 2026-10-14T15:13:02.543249Z 878f207 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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.

Reviewed commit: 878f20754c

ℹ️ 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".

Comment on lines +76 to +77
[DllImport(DllName, EntryPoint = "ddog_rc_client_new")]
internal static extern VoidResult ClientNew(ref RcClientConfig config, IntPtr endpoint, out IntPtr client);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ship a libdatadog build that exports the new RC API

The packaged native dependency is still pinned to libdatadog-dotnet v2.1.1 in build/cmake/FindLibdatadog.cmake and build/vcpkg_local_ports/libdatadog/vcpkg.json, but this change begins importing the new ddog_rc_* entry points without updating that dependency or its hashes. With the normal packaged monitoring home, the first client creation therefore throws EntryPointNotFoundException; RemoteConfigurationManager.Poll() catches that as a client-factory failure and permanently exits its polling loop, disabling every Remote Configuration product. Update the libdatadog pins to a release containing this FFI as part of this change.

Useful? React with 👍 / 👎.

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

The pinned native dependency lacks the remote-config exports, causing client creation to fail and polling to stop permanently. The new polling lifecycle also introduces application-scheduler blocking and races during manager replacement and shutdown.

Open Bits AI session

🤖 Bits Code Review · Commit 878f207

var nativeEndpoint = CreateEndpoint(endpoint);
try
{
NativeInterop.RemoteConfig.ClientNew(ref config, nativeEndpoint, out var client).ThrowIfError();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Ship a native release containing the remote-config exports

Default builds still download libdatadog-dotnet 2.1.1 through FindLibdatadog.cmake and the Windows vcpkg port, but that release lacks the new ddog_rc_* exports. Client creation throws EntryPointNotFoundException, after which RemoteConfigurationManager permanently exits its polling loop. Remote configuration therefore stops working with the shipped dependency. Update the native release pins and platform checksums alongside this migration.

React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it

What each reaction means
  • 👍 Useful: correct, and you're fixing it or will.
  • 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
  • 😕 Unclear: you can't tell what it means or why it matters.
  • 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.

🤖 Bits Code Review · Open Bits AI session

…onfigurationManager.cs

Co-authored-by: datadog-prod-us1-4[bot] <266080418+datadog-prod-us1-4[bot]@users.noreply.github.com>
@pr-commenter

pr-commenter Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-10-14 19:48:33

Comparing candidate commit 68b7f28 in PR branch bob/rc-libdatadog with baseline commit 0aaa1b3 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 11 performance regressions! Performance is the same for 61 metrics, 0 unstable metrics, 75 known flaky benchmarks, 51 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.133%; +10.144%]
  • 🟥 throughput [-28967.897op/s; -26256.045op/s] or [-8.159%; -7.395%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.750%; +9.761%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.830%; +9.841%]
  • 🟥 throughput [-39034.267op/s; -31021.641op/s] or [-9.648%; -7.668%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 allocated_mem [+272 bytes; +273 bytes] or [+9.374%; +9.385%]
  • 🟥 throughput [-11430.377op/s; -11221.734op/s] or [-13.049%; -12.810%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net6.0

  • 🟥 allocated_mem [+199 bytes; +200 bytes] or [+9.426%; +9.438%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync netcoreapp3.1

  • 🟥 allocated_mem [+199 bytes; +200 bytes] or [+7.569%; +7.581%]
  • 🟥 throughput [-13354.773op/s; -12243.612op/s] or [-10.598%; -9.716%]

scenario:Benchmarks.Trace.NLogBenchmark.EnrichedLog net472

  • 🟥 throughput [-9250.786op/s; -8509.578op/s] or [-7.086%; -6.519%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-8073.833op/s; -7494.386op/s] or [-9.573%; -8.886%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0

  • 🟥 throughput [-8965.353op/s; -6754.786op/s] or [-7.536%; -5.678%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-14458.572op/s; -13163.607op/s] or [-14.701%; -13.384%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+1.541KB; +1.541KB] or [+46.817%; +46.831%]
  • 🟥 execution_time [+306.370ms; +308.768ms] or [+152.031%; +153.222%]
  • 🟥 throughput [-54.927op/s; -50.905op/s] or [-9.882%; -9.159%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 allocated_mem [+1.011KB; +1.011KB] or [+37.485%; +37.498%]
  • 🟥 execution_time [+381.770ms; +385.506ms] or [+301.622%; +304.573%]
  • 🟩 throughput [+67.660op/s; +71.111op/s] or [+8.921%; +9.376%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 allocated_mem [+1.088KB; +1.088KB] or [+40.343%; +40.355%]
  • 🟥 execution_time [+393.378ms; +397.079ms] or [+348.125%; +351.400%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+4.758KB; +4.758KB] or [+100.159%; +100.174%]
  • 🟥 throughput [-63932.228op/s; -63440.129op/s] or [-49.743%; -49.360%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.880KB; +3.880KB] or [+82.058%; +82.072%]
  • 🟩 execution_time [-15.569ms; -11.393ms] or [-7.271%; -5.321%]
  • 🟥 throughput [-62178.644op/s; -59422.211op/s] or [-45.387%; -43.375%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+4.608KB; +4.608KB] or [+99.641%; +99.654%]
  • 🟥 throughput [-49097.038op/s; -46851.629op/s] or [-44.389%; -42.359%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.380KB; +1.380KB] or [+111.648%; +111.662%]
  • 🟥 throughput [-360090.367op/s; -352978.557op/s] or [-36.767%; -36.041%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+543 bytes; +544 bytes] or [+44.437%; +44.446%]
  • 🟩 execution_time [-26.471ms; -21.580ms] or [-11.805%; -9.624%]
  • 🟥 throughput [-116420.921op/s; -92810.772op/s] or [-12.437%; -9.915%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.344KB; +1.344KB] or [+111.253%; +111.267%]
  • 🟥 throughput [-183679.835op/s; -167435.928op/s] or [-26.391%; -24.057%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472

  • 🟥 allocated_mem [+3.378KB; +3.378KB] or [+89.003%; +89.017%]
  • 🟥 throughput [-76956.250op/s; -76166.294op/s] or [-51.791%; -51.259%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.336KB; +3.336KB] or [+88.150%; +88.161%]
  • 🟥 throughput [-75191.155op/s; -72309.397op/s] or [-47.843%; -46.009%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+3.264KB; +3.264KB] or [+88.493%; +88.506%]
  • 🟥 throughput [-56810.721op/s; -54191.052op/s] or [-45.257%; -43.170%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472

  • 🟥 throughput [-315461.966op/s; -301193.192op/s] or [-9.597%; -9.163%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+223084.520op/s; +256806.854op/s] or [+7.439%; +8.563%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-18.627ms; -14.215ms] or [-8.586%; -6.552%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟩 allocated_mem [-13.759KB; -13.756KB] or [-42.324%; -42.316%]
  • 🟥 execution_time [+301.338ms; +302.380ms] or [+150.568%; +151.089%]
  • 🟩 throughput [+906.914op/s; +925.062op/s] or [+10.017%; +10.217%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.547ms; +303.755ms] or [+151.567%; +153.184%]
  • 🟩 throughput [+2070.622op/s; +2281.399op/s] or [+15.837%; +17.449%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.690ms; +303.370ms] or [+151.464%; +152.814%]
  • 🟩 throughput [+1743.335op/s; +1872.907op/s] or [+16.831%; +18.082%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+296.535ms; +297.551ms] or [+145.646%; +146.145%]
  • 🟩 throughput [+512.872op/s; +520.744op/s] or [+13.596%; +13.805%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+298.342ms; +302.232ms] or [+145.849%; +147.750%]
  • 🟩 throughput [+2641.290op/s; +2698.614op/s] or [+38.373%; +39.206%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+299.245ms; +300.601ms] or [+149.563%; +150.240%]
  • 🟩 throughput [+1349.647op/s; +1374.367op/s] or [+26.789%; +27.280%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472

  • 🟩 execution_time [-139.608µs; -130.596µs] or [-28.664%; -26.813%]
  • 🟩 throughput [+760.210op/s; +825.892op/s] or [+37.026%; +40.225%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0

  • 🟩 execution_time [-127.592µs; -100.751µs] or [-29.263%; -23.107%]
  • 🟩 throughput [+745.870op/s; +871.169op/s] or [+32.427%; +37.875%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1

  • 🟩 execution_time [-141.991µs; -120.029µs] or [-30.422%; -25.717%]
  • 🟩 throughput [+771.576op/s; +853.681op/s] or [+35.617%; +39.408%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472

  • 🟩 execution_time [-118.393µs; -111.999µs] or [-31.965%; -30.239%]
  • 🟩 throughput [+1182.300op/s; +1265.865op/s] or [+43.787%; +46.882%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟩 execution_time [-96.320µs; -72.483µs] or [-30.750%; -23.140%]
  • 🟩 throughput [+1060.503op/s; +1271.667op/s] or [+33.059%; +39.642%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1

  • 🟩 execution_time [-132.330µs; -109.834µs] or [-36.200%; -30.046%]
  • 🟩 throughput [+1235.112op/s; +1376.356op/s] or [+44.323%; +49.392%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.480ms; +300.654ms] or [+149.471%; +150.057%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • unstable execution_time [+321.243ms; +397.553ms] or [+349.043%; +431.958%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+240.783ms; +306.384ms] or [+182.824%; +232.634%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+295.662ms; +362.961ms] or [+135.942%; +166.886%]
  • 🟥 throughput [-556.747op/s; -500.654op/s] or [-50.447%; -45.364%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+201.357ms; +334.610ms] or [+85.810%; +142.597%]
  • 🟥 throughput [-668.809op/s; -585.344op/s] or [-44.610%; -39.043%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+355.948ms; +370.946ms] or [+212.898%; +221.869%]
  • 🟥 throughput [-451.886op/s; -416.294op/s] or [-31.464%; -28.986%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-138.949µs; -108.140µs] or [-7.039%; -5.478%]
  • 🟩 throughput [+29.820op/s; +38.759op/s] or [+5.887%; +7.651%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+12.092%; +12.103%]
  • 🟥 execution_time [+302.000ms; +303.857ms] or [+152.082%; +153.017%]
  • 🟥 throughput [-20474.642op/s; -17848.485op/s] or [-6.588%; -5.743%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.114%; +12.124%]
  • 🟥 execution_time [+300.422ms; +303.117ms] or [+150.542%; +151.892%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.114%; +12.124%]
  • 🟥 execution_time [+299.945ms; +303.109ms] or [+150.680%; +152.269%]
  • 🟥 throughput [-33188.026op/s; -25266.188op/s] or [-6.991%; -5.322%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+11.165%; +11.177%]
  • 🟥 execution_time [+302.015ms; +303.850ms] or [+151.662%; +152.583%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.493%; +12.506%]
  • 🟥 execution_time [+296.580ms; +300.514ms] or [+146.646%; +148.591%]
  • 🟥 throughput [-54979.889op/s; -49067.912op/s] or [-8.858%; -7.906%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+11.422%; +11.434%]
  • 🟥 execution_time [+303.214ms; +307.436ms] or [+153.682%; +155.822%]
  • 🟥 throughput [-34273.688op/s; -26075.714op/s] or [-7.401%; -5.631%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+11.197%; +11.208%]
  • 🟥 execution_time [+301.932ms; +303.521ms] or [+151.543%; +152.340%]
  • 🟥 throughput [-29224.013op/s; -26058.447op/s] or [-7.581%; -6.760%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.618%; +10.631%]
  • 🟥 execution_time [+301.625ms; +303.762ms] or [+150.333%; +151.398%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.618%; +10.631%]
  • 🟥 execution_time [+298.250ms; +301.800ms] or [+148.377%; +150.143%]
  • 🟥 throughput [-32585.446op/s; -26136.699op/s] or [-7.713%; -6.187%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+6.002%; +6.011%]
  • 🟥 throughput [-18652.694op/s; -17513.453op/s] or [-7.501%; -7.043%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.627%; +5.636%]
  • 🟩 execution_time [-16.462ms; -12.818ms] or [-7.655%; -5.961%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.605%; +5.617%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [-6.208µs; +36.302µs] or [-1.533%; +8.967%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-19.433KB; -19.408KB] or [-7.089%; -7.080%]
  • unstable execution_time [-54.862µs; +3.596µs] or [-10.843%; +0.711%]
  • unstable throughput [+2.979op/s; +215.297op/s] or [+0.149%; +10.743%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-18.297KB; -18.278KB] or [-6.670%; -6.663%]
  • unstable execution_time [-88.897µs; -28.196µs] or [-15.405%; -4.886%]
  • 🟩 throughput [+112.727op/s; +284.872op/s] or [+6.440%; +16.275%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟥 execution_time [+2.436µs; +5.831µs] or [+5.758%; +13.782%]
  • 🟥 throughput [-3036.627op/s; -1392.965op/s] or [-12.783%; -5.864%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-16.778µs; -10.272µs] or [-26.031%; -15.936%]
  • 🟩 throughput [+2690.366op/s; +4028.939op/s] or [+16.506%; +24.719%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.790ms; +304.180ms] or [+153.047%; +153.749%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+304.313ms; +307.630ms] or [+154.894%; +156.583%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+298.679ms; +300.902ms] or [+149.526%; +150.639%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.197%; +9.208%]
  • 🟥 throughput [-40631.553op/s; -38227.421op/s] or [-11.248%; -10.582%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.226%; +9.238%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.226%; +9.238%]
  • 🟥 throughput [-39326.804op/s; -30076.513op/s] or [-9.307%; -7.118%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+299.366ms; +301.246ms] or [+149.207%; +150.144%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 allocated_mem [+96 bytes; +96 bytes] or [+6.000%; +6.010%]
  • 🟥 execution_time [+301.298ms; +304.100ms] or [+151.298%; +152.705%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.819%; +5.828%]
  • 🟥 execution_time [+302.519ms; +305.053ms] or [+153.418%; +154.703%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.096ms; +300.729ms] or [+149.689%; +150.005%]
  • 🟩 throughput [+61305682.040op/s; +61537303.669op/s] or [+44.647%; +44.815%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • 🟥 execution_time [+421.036ms; +427.567ms] or [+523.633%; +531.756%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.634ms; +300.603ms] or [+149.451%; +149.934%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+5.244%; +5.256%]
  • 🟥 throughput [-122389.172op/s; -104477.325op/s] or [-13.659%; -11.660%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+61680.100op/s; +69313.995op/s] or [+5.759%; +6.472%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.037%; +6.047%]
  • 🟥 throughput [-119285.048op/s; -114006.202op/s] or [-10.919%; -10.436%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.057%; +6.065%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.059%; +6.069%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472

  • 🟥 throughput [-39207.856op/s; -34862.188op/s] or [-8.736%; -7.767%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+15.733%; +15.745%]
  • 🟥 throughput [-70904.144op/s; -66994.467op/s] or [-10.377%; -9.805%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+14.810%; +14.823%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+14.810%; +14.821%]
  • 🟥 throughput [-67992.375op/s; -51888.112op/s] or [-9.493%; -7.245%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

The remote configuration managers of replaced tracers (Tracer.Configure)
created a new client, whose change tracking started from zero: configs
which no longer applied were never removed. Now RcmSubscriptionManager
owns the client and rebinds it for other targets, and serializes the
polls. The old manager is disposed before the new one starts, and the
client is only cancelled on shutdown.
@dd-trace-dotnet-ci-bot

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

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

✅ No regressions detected

📄 View the full report (charts + all metrics) →

}

private async Task<GetRcmResponse?> TrySendRequest(RcmClientTracer rcmClientTracer, Func<GetRcmRequest, Task<GetRcmResponse?>> func)
public void Cancel() => Volatile.Read(ref _client)?.Cancel();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Comment from Codex working with leoromanovsky:

[P2] Preserve shutdown cancellation while the first client is being created.

If shutdown calls Cancel() while clientFactory is running, _client is still null and the cancellation is lost. After the factory returns, Poll publishes the client and starts an uncancelled fetch. Keep a terminal cancellation flag and serialize client publication with cancellation under a separate short lock. Keep factory execution and fetching outside that lock.

Regression evidence and candidate fix

A gated factory reproduces the missed cancellation with subscriptions present and absent: both tests fail on this head. A candidate using a separate publication/cancellation lock passes all 15 focused tests, including cancellation during a pending fetch and repeated concurrent cancellation. Inverting the candidate guard causes five failures. These are managed tests with a fake client; they do not establish a process-exit delay or exercise native cancellation.

The candidate adds _cancellationLock and _isCancelled. After the factory returns, it publishes _client under that lock and calls client.Cancel() if shutdown has already occurred. Cancel() takes only that lock, sets the flag once, and cancels any published client. It never waits for _pollLock.

This branch has not been deployed

No deployments
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.

3 participants