Skip to content

Normalize CosmosDB resource URI IDs to reduce resource cardinality#8541

Merged
pablomartinezbernardo merged 3 commits into
masterfrom
pmartinez/fix-cosmos-resource-cardinality
Apr 30, 2026
Merged

Normalize CosmosDB resource URI IDs to reduce resource cardinality#8541
pablomartinezbernardo merged 3 commits into
masterfrom
pmartinez/fix-cosmos-resource-cardinality

Conversation

@pablomartinezbernardo

@pablomartinezbernardo pablomartinezbernardo commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Normalize CosmosDB resource URI IDs to reduce resource cardinality

Reason for change

Resource cardinality should be bound, as it affects metrics and UI

Implementation details

Normalize even segments from the URI that are not the database id or the collection id

Test coverage

Unit tests

@github-actions

Copy link
Copy Markdown
Contributor

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

2 occurrences of :

-    Resource: Delete dbs/db/colls/items/docs/TestFamily.1,
+    Resource: Delete dbs/db/colls/items/docs/?,

2 occurrences of :

-    Resource: Read dbs/db/colls/items/docs/TestFamily.1,
+    Resource: Read dbs/db/colls/items/docs/?,

2 occurrences of :

-    Resource: Replace dbs/db/colls/items/docs/TestFamily.1,
+    Resource: Replace dbs/db/colls/items/docs/?,

2 occurrences of :

-    Resource: Read dbs/db/colls/items/docs/Andersen.1,
+    Resource: Read dbs/db/colls/items/docs/?,

2 occurrences of :

-    Resource: Read dbs/db/colls/items/docs/Wakefield.7,
+    Resource: Read dbs/db/colls/items/docs/?,

@pablomartinezbernardo
pablomartinezbernardo force-pushed the pmartinez/fix-cosmos-resource-cardinality branch from 4ef47f1 to c5d2bac Compare April 29, 2026 13:40
@pr-commenter

pr-commenter Bot commented Apr 29, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-04-30 12:15:03

Comparing candidate commit 5c26637 in PR branch pmartinez/fix-cosmos-resource-cardinality with baseline commit a65b390 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics, 58 known flaky benchmarks, 29 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 ----------------------------------'

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 net6.0

  • 🟩 throughput [+8397.122op/s; +10678.859op/s] or [+7.058%; +8.976%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+318.751ms; +323.346ms] or [+158.175%; +160.456%]
  • 🟥 throughput [-43.234op/s; -39.651op/s] or [-7.779%; -7.134%]

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

  • 🟥 execution_time [+377.757ms; +379.318ms] or [+298.451%; +299.685%]
  • 🟩 throughput [+98.624op/s; +101.312op/s] or [+13.003%; +13.358%]

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

  • 🟥 execution_time [+393.431ms; +395.701ms] or [+348.171%; +350.180%]

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

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.529%; +27.541%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.977%; +9.987%]
  • 🟩 execution_time [-16.449ms; -12.271ms] or [-7.682%; -5.731%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.502%; +27.510%]

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

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.746%; +105.759%]
  • 🟥 throughput [-263771.350op/s; -260958.802op/s] or [-26.932%; -26.645%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.558%; +38.566%]
  • 🟩 execution_time [-25.909ms; -21.060ms] or [-11.554%; -9.392%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.292%; +105.304%]
  • 🟥 throughput [-139986.388op/s; -124074.806op/s] or [-20.113%; -17.827%]

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

  • 🟩 throughput [+7832.807op/s; +10465.071op/s] or [+6.240%; +8.337%]

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

  • 🟩 throughput [+330850.715op/s; +364005.173op/s] or [+11.032%; +12.137%]

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

  • 🟩 execution_time [-20.113ms; -15.687ms] or [-9.272%; -7.231%]
  • 🟩 throughput [+177320.422op/s; +232265.148op/s] or [+7.038%; +9.219%]

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

  • 🟥 execution_time [+300.568ms; +301.262ms] or [+150.184%; +150.530%]

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

  • 🟥 execution_time [+299.395ms; +302.574ms] or [+150.986%; +152.589%]

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

  • 🟥 execution_time [+300.304ms; +302.920ms] or [+151.270%; +152.587%]

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

  • 🟥 execution_time [+296.968ms; +297.601ms] or [+145.859%; +146.170%]

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

  • 🟥 execution_time [+298.949ms; +300.853ms] or [+146.145%; +147.076%]

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

  • 🟥 execution_time [+301.195ms; +302.672ms] or [+150.537%; +151.275%]

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

  • 🟥 execution_time [+22.924µs; +46.499µs] or [+7.319%; +14.845%]
  • 🟥 throughput [-432.671op/s; -234.282op/s] or [-13.488%; -7.303%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.821ms; +300.533ms] or [+149.641%; +149.997%]

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

  • 🟥 execution_time [+416.597ms; +421.590ms] or [+452.650%; +458.075%]
  • 🟩 throughput [+1048.880op/s; +1170.382op/s] or [+8.619%; +9.617%]

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

  • unstable execution_time [+304.500ms; +341.386ms] or [+231.204%; +259.211%]
  • 🟩 throughput [+630.241op/s; +833.897op/s] or [+6.101%; +8.073%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+2.824KB; +2.829KB] or [+5.018%; +5.026%]
  • unstable execution_time [+342.875ms; +379.107ms] or [+157.650%; +174.310%]
  • 🟥 throughput [-538.826op/s; -501.616op/s] or [-48.823%; -45.451%]

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

  • unstable execution_time [+208.940ms; +342.144ms] or [+89.042%; +145.808%]
  • 🟥 throughput [-672.425op/s; -588.731op/s] or [-44.851%; -39.269%]

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

  • 🟥 allocated_mem [+2.305KB; +2.308KB] or [+5.442%; +5.450%]
  • 🟥 execution_time [+333.895ms; +340.605ms] or [+199.708%; +203.721%]
  • 🟥 throughput [-390.735op/s; -355.304op/s] or [-27.206%; -24.739%]

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

  • 🟩 throughput [+26.402op/s; +36.617op/s] or [+5.212%; +7.228%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+303.514ms; +304.950ms] or [+152.844%; +153.567%]

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

  • 🟥 execution_time [+298.717ms; +300.105ms] or [+149.687%; +150.383%]

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

  • 🟥 execution_time [+300.071ms; +303.727ms] or [+150.743%; +152.580%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+302.013ms; +303.431ms] or [+151.661%; +152.373%]

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

  • 🟥 execution_time [+298.466ms; +300.011ms] or [+147.578%; +148.342%]

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

  • 🟥 execution_time [+306.238ms; +311.988ms] or [+155.215%; +158.129%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+302.163ms; +303.668ms] or [+151.659%; +152.414%]

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

  • 🟥 execution_time [+299.422ms; +315.170ms] or [+149.234%; +157.083%]

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

  • 🟥 execution_time [+298.608ms; +308.834ms] or [+148.555%; +153.642%]

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

  • 🟩 execution_time [-15.777ms; -12.119ms] or [-7.336%; -5.635%]

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

  • unstable execution_time [+8.542µs; +49.726µs] or [+2.110%; +12.283%]

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

  • 🟩 allocated_mem [-24.692KB; -24.672KB] or [-9.007%; -9.000%]
  • unstable execution_time [-35.297µs; +16.352µs] or [-6.976%; +3.232%]

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

  • unstable execution_time [+6.607µs; +11.034µs] or [+15.616%; +26.081%]
  • 🟥 throughput [-4825.268op/s; -3024.390op/s] or [-20.313%; -12.732%]

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

  • unstable execution_time [-14.380µs; -7.290µs] or [-22.310%; -11.310%]
  • 🟩 throughput [+1874.685op/s; +3369.930op/s] or [+11.502%; +20.676%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.221ms; +302.192ms] or [+152.254%; +152.745%]

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

  • 🟥 execution_time [+302.755ms; +304.903ms] or [+154.101%; +155.195%]

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

  • 🟥 execution_time [+298.459ms; +300.961ms] or [+149.416%; +150.668%]

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

  • 🟩 throughput [+29335.865op/s; +37083.019op/s] or [+5.553%; +7.019%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.847ms; +302.624ms] or [+149.945%; +150.831%]

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

  • 🟥 execution_time [+302.397ms; +303.558ms] or [+151.849%; +152.432%]

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

  • 🟥 execution_time [+304.513ms; +307.360ms] or [+154.429%; +155.873%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.841ms; +300.616ms] or [+149.562%; +149.949%]
  • 🟩 throughput [+66245227.118op/s; +66525934.135op/s] or [+48.244%; +48.448%]

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

  • 🟥 execution_time [+421.725ms; +426.236ms] or [+524.490%; +530.100%]
  • 🟩 throughput [+1153.897op/s; +1334.579op/s] or [+8.920%; +10.317%]

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

  • 🟥 execution_time [+299.730ms; +300.686ms] or [+149.498%; +149.975%]
  • 🟩 throughput [+18305082.773op/s; +19251401.649op/s] or [+8.108%; +8.527%]

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

  • 🟩 throughput [+76847.326op/s; +85589.267op/s] or [+7.175%; +7.991%]

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

  • 🟩 throughput [+57253.955op/s; +76470.919op/s] or [+6.627%; +8.851%]

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

  • 🟩 throughput [+66819.559op/s; +96885.394op/s] or [+5.172%; +7.499%]

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

  • 🟩 throughput [+88563.107op/s; +97800.784op/s] or [+8.796%; +9.713%]

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

  • 🟩 throughput [+47564.769op/s; +52692.994op/s] or [+8.637%; +9.568%]

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

  • 🟩 throughput [+24727.611op/s; +34373.434op/s] or [+5.535%; +7.694%]

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

  • 🟩 throughput [+98618.470op/s; +115510.230op/s] or [+11.018%; +12.905%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack 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.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Apr 29, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8541) 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
duration75.17 ± (74.98 - 75.67) ms74.18 ± (74.13 - 74.72) ms-1.3%
.NET Framework 4.8 - Bailout
duration79.30 ± (79.05 - 79.55) ms79.42 ± (79.22 - 79.69) ms+0.1%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1124.53 ± (1125.17 - 1134.81) ms1116.94 ± (1119.51 - 1126.63) ms-0.7%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.85 ± (22.78 - 22.92) ms22.80 ± (22.74 - 22.87) ms-0.2%
process.time_to_main_ms86.51 ± (86.17 - 86.85) ms87.36 ± (87.02 - 87.70) ms+1.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.85 ± (10.85 - 10.86) MB10.86 ± (10.85 - 10.86) MB+0.0%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.51 ± (22.47 - 22.55) ms22.47 ± (22.43 - 22.51) ms-0.2%
process.time_to_main_ms85.28 ± (85.06 - 85.50) ms85.51 ± (85.30 - 85.72) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.95) MB10.94 ± (10.94 - 10.95) MB+0.0%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms206.11 ± (205.49 - 206.72) ms206.09 ± (205.50 - 206.68) ms-0.0%
process.time_to_main_ms568.59 ± (567.14 - 570.04) ms570.24 ± (568.83 - 571.64) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.81 ± (49.79 - 49.84) MB49.79 ± (49.76 - 49.82) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.4%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.62 ± (21.56 - 21.68) ms21.30 ± (21.26 - 21.34) ms-1.5%
process.time_to_main_ms75.47 ± (75.19 - 75.75) ms74.73 ± (74.55 - 74.91) ms-1.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.62 ± (10.62 - 10.63) MB10.64 ± (10.64 - 10.64) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.39 ± (21.34 - 21.43) ms21.63 ± (21.56 - 21.70) ms+1.1%✅⬆️
process.time_to_main_ms75.49 ± (75.27 - 75.71) ms77.94 ± (77.62 - 78.26) ms+3.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.74 ± (10.74 - 10.74) MB10.74 ± (10.74 - 10.75) MB+0.0%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms356.28 ± (353.96 - 358.61) ms356.11 ± (354.14 - 358.09) ms-0.0%
process.time_to_main_ms562.54 ± (561.03 - 564.05) ms564.50 ± (563.15 - 565.86) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.94 ± (50.91 - 50.97) MB51.03 ± (51.01 - 51.05) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.2%
.NET 8 - Baseline
process.internal_duration_ms19.62 ± (19.57 - 19.67) ms19.60 ± (19.57 - 19.64) ms-0.1%
process.time_to_main_ms73.82 ± (73.60 - 74.03) ms73.48 ± (73.32 - 73.65) ms-0.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.68 ± (7.68 - 7.69) MB7.68 ± (7.68 - 7.69) MB-0.0%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.86 ± (19.80 - 19.92) ms19.84 ± (19.78 - 19.90) ms-0.1%
process.time_to_main_ms76.74 ± (76.46 - 77.02) ms76.03 ± (75.71 - 76.35) ms-0.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.73 ± (7.73 - 7.74) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms281.21 ± (278.55 - 283.87) ms278.44 ± (276.22 - 280.66) ms-1.0%
process.time_to_main_ms517.74 ± (516.39 - 519.08) ms523.73 ± (522.60 - 524.86) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.87 ± (37.84 - 37.90) MB37.79 ± (37.76 - 37.81) MB-0.2%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.6%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration202.75 ± (202.50 - 203.78) ms200.32 ± (200.03 - 201.12) ms-1.2%
.NET Framework 4.8 - Bailout
duration204.73 ± (205.20 - 206.54) ms204.11 ± (203.75 - 204.76) ms-0.3%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1244.53 ± (1240.20 - 1245.94) ms1227.88 ± (1228.35 - 1234.58) ms-1.3%
.NET Core 3.1 - Baseline
process.internal_duration_ms195.30 ± (194.66 - 195.94) ms194.70 ± (194.08 - 195.32) ms-0.3%
process.time_to_main_ms84.51 ± (84.21 - 84.81) ms84.50 ± (84.18 - 84.82) ms-0.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.02 ± (16.00 - 16.04) MB16.05 ± (16.03 - 16.06) MB+0.2%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.1%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms195.21 ± (194.59 - 195.83) ms195.13 ± (194.52 - 195.74) ms-0.0%
process.time_to_main_ms86.23 ± (85.94 - 86.51) ms86.39 ± (86.11 - 86.67) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.07 ± (16.06 - 16.09) MB16.07 ± (16.05 - 16.09) MB-0.0%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.5%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms387.92 ± (386.35 - 389.48) ms379.15 ± (378.16 - 380.15) ms-2.3%
process.time_to_main_ms564.75 ± (563.16 - 566.34) ms575.35 ± (573.88 - 576.83) ms+1.9%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.95 ± (58.76 - 59.13) MB58.45 ± (58.41 - 58.50) MB-0.8%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.1%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms199.99 ± (199.37 - 200.60) ms202.16 ± (201.49 - 202.83) ms+1.1%✅⬆️
process.time_to_main_ms73.53 ± (73.30 - 73.77) ms74.73 ± (74.43 - 75.03) ms+1.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.30 ± (16.28 - 16.32) MB16.29 ± (16.28 - 16.31) MB-0.0%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.7%
.NET 6 - Bailout
process.internal_duration_ms200.11 ± (199.42 - 200.81) ms203.66 ± (202.92 - 204.40) ms+1.8%✅⬆️
process.time_to_main_ms74.94 ± (74.66 - 75.23) ms76.61 ± (76.25 - 76.97) ms+2.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.33 ± (16.31 - 16.35) MB16.32 ± (16.30 - 16.35) MB-0.0%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.1%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms569.54 ± (567.18 - 571.89) ms569.41 ± (567.04 - 571.78) ms-0.0%
process.time_to_main_ms564.86 ± (563.51 - 566.20) ms566.87 ± (565.40 - 568.35) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.84 ± (61.80 - 61.87) MB61.96 ± (61.92 - 62.00) MB+0.2%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)+0.2%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms198.16 ± (197.67 - 198.66) ms202.22 ± (201.41 - 203.02) ms+2.0%✅⬆️
process.time_to_main_ms73.43 ± (73.14 - 73.72) ms74.66 ± (74.34 - 74.98) ms+1.7%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.69 ± (11.67 - 11.70) MB11.63 ± (11.61 - 11.65) MB-0.5%
runtime.dotnet.threads.count19 ± (18 - 19)19 ± (19 - 19)+0.5%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms197.35 ± (196.85 - 197.85) ms202.31 ± (201.58 - 203.05) ms+2.5%✅⬆️
process.time_to_main_ms74.12 ± (73.87 - 74.36) ms76.00 ± (75.67 - 76.32) ms+2.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.74 - 11.76) MB11.66 ± (11.64 - 11.68) MB-0.8%
runtime.dotnet.threads.count19 ± (19 - 19)20 ± (20 - 20)+1.7%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms496.48 ± (493.31 - 499.65) ms493.21 ± (489.73 - 496.69) ms-0.7%
process.time_to_main_ms516.02 ± (514.86 - 517.18) ms531.10 ± (529.80 - 532.40) ms+2.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed51.52 ± (51.49 - 51.56) MB51.54 ± (51.50 - 51.58) MB+0.0%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.3%✅⬆️
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 (8541) - mean (74ms)  : 70, 79
    master - mean (75ms)  : 70, 81

    section Bailout
    This PR (8541) - mean (79ms)  : 76, 83
    master - mean (79ms)  : 76, 83

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (1,123ms)  : 1072, 1174
    master - mean (1,130ms)  : 1057, 1203

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 (8541) - mean (117ms)  : 112, 123
    master - mean (117ms)  : 109, 124

    section Bailout
    This PR (8541) - mean (115ms)  : 111, 118
    master - mean (115ms)  : 112, 117

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (814ms)  : 788, 839
    master - mean (811ms)  : 786, 835

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8541) - mean (103ms)  : 99, 106
    master - mean (104ms)  : 98, 109

    section Bailout
    This PR (8541) - mean (106ms)  : 100, 112
    master - mean (103ms)  : 98, 108

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (953ms)  : 914, 993
    master - mean (948ms)  : 901, 995

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8541) - mean (101ms)  : 97, 104
    master - mean (101ms)  : 97, 106

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

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (839ms)  : 780, 897
    master - mean (831ms)  : 790, 871

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 (8541) - mean (201ms)  : 192, 209
    master - mean (203ms)  : 194, 212

    section Bailout
    This PR (8541) - mean (204ms)  : 197, 211
    master - mean (206ms)  : 196, 216

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (1,231ms)  : 1186, 1276
    master - mean (1,243ms)  : 1203, 1283

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 (8541) - mean (289ms)  : 275, 303
    master - mean (290ms)  : 275, 305

    section Bailout
    This PR (8541) - mean (292ms)  : 276, 307
    master - mean (292ms)  : 280, 304

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (997ms)  : 971, 1024
    master - mean (994ms)  : 964, 1024

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8541) - mean (287ms)  : 274, 301
    master - mean (283ms)  : 271, 294

    section Bailout
    This PR (8541) - mean (290ms)  : 277, 302
    master - mean (285ms)  : 269, 301

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (1,169ms)  : 1128, 1210
    master - mean (1,166ms)  : 1125, 1206

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8541) - mean (289ms)  : 271, 307
    master - mean (282ms)  : 269, 295

    section Bailout
    This PR (8541) - mean (291ms)  : 271, 311
    master - mean (282ms)  : 270, 294

    section CallTarget+Inlining+NGEN
    This PR (8541) - mean (1,058ms)  : 999, 1117
    master - mean (1,044ms)  : 991, 1096

Loading

@pablomartinezbernardo
pablomartinezbernardo marked this pull request as ready for review April 29, 2026 15:11
@pablomartinezbernardo
pablomartinezbernardo requested review from a team as code owners April 29, 2026 15:11

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can optimize the allocations, but the main question I have is whether we're sure we're ok making a breaking change here without an escape hatch?

return resourceUriString;
}

var segments = resourceUriString.Split('/');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should avoid using Split if possible because it allocates a bunch. We should be able to do this more efficiently using either IndexOf('/') and manually handling it, or potentially using StringSplitEnumerator.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f2334a0 (assuming you were referring to SpanSplitEnumerator)

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As discussed offline, I think we can probably remove the setting for now if we consider this to be a bugfix (and not fixing it could cause cardinality issues for customers).

if (sb is null && redact)
{
// On the first redaction found, append everything from 0 until the start of that segment as-is
sb = StringBuilderCache.Acquire(resourceUriString.Length);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit/FYI: given you know the maximum length of the string up front, and you're only adding string segments to it (no additional formatting), you could avoid using the StringBuilder entirely in the "fast path" and use a stackalloc which may be preferable. There's also ValueStringBuilder which works similarly. You might want to consider that as an alternative 🙂

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Didn't know about ValueStringBuilder until now, if that's alright let's leave that up as a possible optimization in case this ever becomes a hot path

@pablomartinezbernardo
pablomartinezbernardo merged commit bf5d176 into master Apr 30, 2026
139 checks passed
@pablomartinezbernardo
pablomartinezbernardo deleted the pmartinez/fix-cosmos-resource-cardinality branch April 30, 2026 16:00
@github-actions github-actions Bot added this to the vNext-v3 milestone Apr 30, 2026
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/dd-trace-py that referenced this pull request May 28, 2026
## Description

Normalize CosmosDB resource URI IDs to reduce resource cardinality. Resource cardinality should be bound, as it affects metrics and UI. Normalize even segments from the URI that are not the database id or the collection id.

Replicates dotnet fix DataDog/dd-trace-dotnet#8541

## Testing

Unit tests

## Risks

Users with dashboards and monitors configured on the resource of these spans. Changed without possibility to fall back to the old behavior because this is a bug:
* Unbounded card can be problematic
* Filters/groups on resources containing IDs are pretty much useless


Co-authored-by: pablo.martinezbernardo <[email protected]>
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.

2 participants