Skip to content

[Serverless] Cache serverless platform detection results#8231

Merged
lucaspimentel merged 17 commits into
masterfrom
lpimentel/cache-serverless-platform-checks
Mar 31, 2026
Merged

[Serverless] Cache serverless platform detection results#8231
lucaspimentel merged 17 commits into
masterfrom
lpimentel/cache-serverless-platform-checks

Conversation

@lucaspimentel

@lucaspimentel lucaspimentel commented Feb 20, 2026

Copy link
Copy Markdown
Member

Summary of changes

Extract serverless platform detection logic from EnvironmentHelpers into dedicated cached detection classes under Datadog.Trace.Serverless:

  • AzureInfo — Azure App Services, Azure Functions (including isolated host/worker detection)
  • AwsInfo — AWS Lambda
  • GcpInfo — Google Cloud Functions

Each class caches environment variable lookups in instance fields to avoid repeated reads (which incur heap allocations) on hot paths. An Instance singleton is used in production; tests create fresh instances for isolation.

Reason for change

Platform detection methods (e.g., IsAzureAppService(), IsAwsLambda()) were called repeatedly from hot paths like span creation and peer service derivation. Each call re-read environment variables, adding unnecessary overhead. Caching the results eliminates redundant lookups.

This change also moves serverless-specific code out of EnvironmentHelpers and into the Datadog.Trace.Serverless namespace.

Implementation details

  • Add AzureInfo, AwsInfo, and GcpInfo classes under Datadog.Trace.Serverless namespace
  • Each class exposes cached bool properties (e.g., AzureInfo.Instance.IsAzureAppService, AwsInfo.Instance.IsAwsLambda, GcpInfo.Instance.IsCloudFunction)
  • AzureInfo also caches AzureFunctionsWorkerRuntime, AzureFunctionsExtensionVersion, and derived properties like IsIsolatedFunction, IsIsolatedFunctionHostProcess, and IsIsolatedFunctionWorkerProcess
  • Non-static design with Instance singleton enables test isolation without Reset() methods
  • Where possible, callers pass bool values from the detection classes rather than taking a dependency on the platform objects themselves (e.g., ProfilerAvailabilityHelper)
  • Promote EnvironmentHelpers.EnvironmentVariableExists to internal visibility for use by the new classes
  • Update all callers across the tracer to use the new types instead of EnvironmentHelpers.IsXxx() methods
  • Remove the now-unused serverless detection methods from EnvironmentHelpers

Test coverage

  • Add AwsInfoTests, AzureInfoTests, and GcpInfoTests under Serverless/
  • Update ProfilerAvailabilityHelperTests to pass platform detection bools explicitly
  • Remove old EnvironmentHelpersTests that tested the now-removed methods

Other details

n/a

"Why did the environment variable go to therapy? It was tired of being read over and over without anyone remembering what it said." — Claude 🤖

@lucaspimentel lucaspimentel changed the title lpimentel/cache serverless platform checks [Serverless] Cache serverless platform detection results Feb 20, 2026
@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Feb 20, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8231) 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
duration71.85 ± (72.05 - 72.56) ms72.20 ± (72.17 - 72.52) ms+0.5%✅⬆️
.NET Framework 4.8 - Bailout
duration76.03 ± (75.86 - 76.21) ms76.08 ± (76.06 - 76.38) ms+0.1%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1074.50 ± (1074.37 - 1080.06) ms1073.02 ± (1075.24 - 1082.47) ms-0.1%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.19 ± (22.15 - 22.23) ms22.32 ± (22.28 - 22.35) ms+0.6%✅⬆️
process.time_to_main_ms83.62 ± (83.42 - 83.83) ms83.49 ± (83.30 - 83.69) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.91 - 10.91) MB10.93 ± (10.93 - 10.94) MB+0.2%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.15 ± (22.12 - 22.19) ms22.11 ± (22.08 - 22.15) ms-0.2%
process.time_to_main_ms84.63 ± (84.45 - 84.82) ms84.94 ± (84.73 - 85.16) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.95) MB10.96 ± (10.95 - 10.96) MB+0.1%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms224.64 ± (223.32 - 225.96) ms221.74 ± (220.59 - 222.89) ms-1.3%
process.time_to_main_ms533.56 ± (532.39 - 534.73) ms534.54 ± (533.40 - 535.68) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.28 ± (48.25 - 48.31) MB48.26 ± (48.23 - 48.29) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 6 - Baseline
process.internal_duration_ms21.09 ± (21.05 - 21.12) ms20.90 ± (20.87 - 20.94) ms-0.9%
process.time_to_main_ms72.59 ± (72.42 - 72.76) ms71.75 ± (71.60 - 71.90) ms-1.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.61 ± (10.61 - 10.61) MB10.63 ± (10.63 - 10.63) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.85 ± (20.82 - 20.89) ms21.05 ± (21.02 - 21.09) ms+1.0%✅⬆️
process.time_to_main_ms73.07 ± (72.90 - 73.25) ms73.86 ± (73.68 - 74.04) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.72 ± (10.71 - 10.72) MB10.74 ± (10.74 - 10.75) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms384.19 ± (381.83 - 386.56) ms384.34 ± (382.22 - 386.45) ms+0.0%✅⬆️
process.time_to_main_ms535.58 ± (534.59 - 536.57) ms533.86 ± (532.81 - 534.90) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.25 ± (50.23 - 50.28) MB50.34 ± (50.31 - 50.37) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.5%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.18 ± (19.15 - 19.22) ms19.28 ± (19.24 - 19.32) ms+0.5%✅⬆️
process.time_to_main_ms71.24 ± (71.07 - 71.40) ms71.69 ± (71.53 - 71.85) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.67 - 7.68) MB7.70 ± (7.69 - 7.70) MB+0.3%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.34 ± (19.31 - 19.38) ms19.31 ± (19.27 - 19.34) ms-0.2%
process.time_to_main_ms72.70 ± (72.52 - 72.88) ms72.87 ± (72.74 - 73.00) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.71 ± (7.70 - 7.71) MB7.76 ± (7.75 - 7.77) MB+0.7%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms310.04 ± (307.64 - 312.45) ms308.74 ± (306.58 - 310.90) ms-0.4%
process.time_to_main_ms491.11 ± (490.27 - 491.94) ms494.14 ± (493.32 - 494.97) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.23 ± (37.21 - 37.25) MB37.27 ± (37.25 - 37.29) MB+0.1%✅⬆️
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
duration225.79 ± (224.44 - 226.61) ms217.04 ± (216.60 - 218.10) ms-3.9%
.NET Framework 4.8 - Bailout
duration229.52 ± (229.11 - 231.12) ms217.82 ± (218.16 - 219.61) ms-5.1%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1256.83 ± (1254.07 - 1260.78) ms1253.25 ± (1252.82 - 1259.65) ms-0.3%
.NET Core 3.1 - Baseline
process.internal_duration_ms218.20 ± (217.20 - 219.21) ms216.87 ± (215.90 - 217.83) ms-0.6%
process.time_to_main_ms92.93 ± (92.55 - 93.30) ms92.44 ± (92.10 - 92.77) ms-0.5%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed15.87 ± (15.85 - 15.88) MB15.81 ± (15.80 - 15.83) MB-0.3%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.6%
.NET Core 3.1 - Bailout
process.internal_duration_ms218.63 ± (217.71 - 219.56) ms213.47 ± (212.74 - 214.20) ms-2.4%
process.time_to_main_ms94.42 ± (94.09 - 94.76) ms93.23 ± (92.95 - 93.51) ms-1.3%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.2%✅⬆️
runtime.dotnet.mem.committed15.86 ± (15.85 - 15.88) MB15.90 ± (15.88 - 15.92) MB+0.2%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.1%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms422.11 ± (420.60 - 423.62) ms419.87 ± (418.20 - 421.54) ms-0.5%
process.time_to_main_ms566.58 ± (565.38 - 567.78) ms563.01 ± (561.51 - 564.51) ms-0.6%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed59.11 ± (59.06 - 59.16) MB59.12 ± (59.07 - 59.18) MB+0.0%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.2%
.NET 6 - Baseline
process.internal_duration_ms217.90 ± (217.17 - 218.62) ms220.25 ± (219.24 - 221.26) ms+1.1%✅⬆️
process.time_to_main_ms79.32 ± (79.09 - 79.55) ms79.95 ± (79.69 - 80.21) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.15 ± (16.14 - 16.17) MB16.13 ± (16.11 - 16.15) MB-0.2%
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.2%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms216.42 ± (215.86 - 216.98) ms219.90 ± (218.77 - 221.03) ms+1.6%✅⬆️
process.time_to_main_ms80.49 ± (80.29 - 80.69) ms81.20 ± (80.92 - 81.49) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)-0.3%
runtime.dotnet.mem.committed16.20 ± (16.18 - 16.21) MB16.19 ± (16.17 - 16.21) MB-0.1%
runtime.dotnet.threads.count21 ± (20 - 21)20 ± (20 - 21)-0.2%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms603.38 ± (599.95 - 606.80) ms605.82 ± (601.66 - 609.99) ms+0.4%✅⬆️
process.time_to_main_ms572.43 ± (571.32 - 573.54) ms574.31 ± (573.14 - 575.48) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.64 ± (61.56 - 61.73) MB61.70 ± (61.61 - 61.79) MB+0.1%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)+0.2%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms219.36 ± (218.52 - 220.20) ms219.67 ± (218.69 - 220.65) ms+0.1%✅⬆️
process.time_to_main_ms79.18 ± (78.94 - 79.43) ms78.78 ± (78.55 - 79.01) ms-0.5%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.53 ± (11.51 - 11.55) MB11.44 ± (11.42 - 11.45) MB-0.8%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.0%
.NET 8 - Bailout
process.internal_duration_ms217.53 ± (216.80 - 218.25) ms216.77 ± (215.96 - 217.58) ms-0.3%
process.time_to_main_ms79.89 ± (79.70 - 80.08) ms80.07 ± (79.85 - 80.28) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.55 ± (11.54 - 11.57) MB11.53 ± (11.52 - 11.54) MB-0.2%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.0%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms608.90 ± (602.46 - 615.35) ms619.21 ± (613.66 - 624.77) ms+1.7%✅⬆️
process.time_to_main_ms524.96 ± (524.04 - 525.88) ms534.65 ± (533.47 - 535.83) ms+1.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed51.85 ± (51.78 - 51.93) MB52.01 ± (51.95 - 52.07) MB+0.3%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.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 (8231) - mean (72ms)  : 70, 75
    master - mean (72ms)  : 68, 76

    section Bailout
    This PR (8231) - mean (76ms)  : 75, 78
    master - mean (76ms)  : 74, 78

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (1,079ms)  : 1031, 1127
    master - mean (1,077ms)  : 1036, 1118

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 (8231) - mean (113ms)  : 108, 117
    master - mean (113ms)  : 109, 116

    section Bailout
    This PR (8231) - mean (114ms)  : 110, 117
    master - mean (113ms)  : 110, 117

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (794ms)  : 780, 809
    master - mean (794ms)  : 773, 815

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8231) - mean (99ms)  : 96, 102
    master - mean (100ms)  : 97, 103

    section Bailout
    This PR (8231) - mean (101ms)  : 98, 104
    master - mean (100ms)  : 97, 103

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (948ms)  : 910, 986
    master - mean (948ms)  : 912, 984

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8231) - mean (99ms)  : 95, 102
    master - mean (98ms)  : 95, 101

    section Bailout
    This PR (8231) - mean (100ms)  : 98, 102
    master - mean (100ms)  : 97, 102

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (833ms)  : 800, 867
    master - mean (834ms)  : 796, 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 (8231) - mean (217ms)  : 207, 228
    master - mean (226ms)  : 210, 241

    section Bailout
    This PR (8231) - mean (219ms)  : 208, 230
    master - mean (230ms)  : 215, 245

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (1,256ms)  : 1206, 1306
    master - mean (1,257ms)  : 1210, 1305

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 (8231) - mean (319ms)  : 298, 339
    master - mean (321ms)  : 300, 342

    section Bailout
    This PR (8231) - mean (316ms)  : 299, 333
    master - mean (324ms)  : 303, 345

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (1,027ms)  : 1000, 1055
    master - mean (1,030ms)  : 1000, 1060

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8231) - mean (310ms)  : 291, 329
    master - mean (306ms)  : 292, 321

    section Bailout
    This PR (8231) - mean (312ms)  : 288, 335
    master - mean (306ms)  : 296, 316

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (1,213ms)  : 1149, 1276
    master - mean (1,206ms)  : 1155, 1257

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8231) - mean (309ms)  : 293, 325
    master - mean (311ms)  : 292, 329

    section Bailout
    This PR (8231) - mean (308ms)  : 295, 322
    master - mean (308ms)  : 295, 321

    section CallTarget+Inlining+NGEN
    This PR (8231) - mean (1,185ms)  : 1085, 1284
    master - mean (1,169ms)  : 1076, 1261

Loading

@pr-commenter

pr-commenter Bot commented Feb 20, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-03-27 17:12:25

Comparing candidate commit b3347ce in PR branch lpimentel/cache-serverless-platform-checks with baseline commit 017e910 in branch master.

Found 5 performance improvements and 6 performance regressions! Performance is the same for 264 metrics, 13 unstable metrics.

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.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+90.473ms; +90.627ms] or [+81.249%; +81.388%]

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

  • 🟩 execution_time [-17.317ms; -13.455ms] or [-8.087%; -6.283%]

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

  • 🟥 execution_time [+20.455ms; +26.061ms] or [+11.509%; +14.664%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472

  • 🟩 execution_time [-144.695µs; -139.985µs] or [-5.273%; -5.101%]
  • 🟩 throughput [+19.608op/s; +20.268op/s] or [+5.380%; +5.562%]

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

  • 🟥 allocated_mem [+17.437KB; +17.475KB] or [+6.755%; +6.770%]

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

  • 🟥 allocated_mem [+20.880KB; +20.908KB] or [+8.201%; +8.212%]

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

  • 🟥 throughput [-5837.709op/s; -3994.651op/s] or [-24.336%; -16.652%]

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

  • 🟩 execution_time [-30.114ms; -29.117ms] or [-14.947%; -14.452%]

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

  • 🟩 throughput [+14669939.546op/s; +15879598.434op/s] or [+6.505%; +7.041%]

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

  • 🟥 throughput [-60061.676op/s; -43438.697op/s] or [-8.516%; -6.159%]

@lucaspimentel
lucaspimentel marked this pull request as ready for review February 21, 2026 00:16
@lucaspimentel
lucaspimentel requested review from a team as code owners February 21, 2026 00:16
@lucaspimentel
lucaspimentel force-pushed the lpimentel/cache-serverless-platform-checks branch 2 times, most recently from 49ea851 to f0dfbe2 Compare February 21, 2026 19:23
@lucaspimentel

Copy link
Copy Markdown
Member Author

@codex review

@lucaspimentel
lucaspimentel force-pushed the lpimentel/cache-serverless-platform-checks branch from d5415d7 to 989bf74 Compare February 21, 2026 19:40

@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: d5415d7f3d

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

@lucaspimentel

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

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

@lucaspimentel
lucaspimentel force-pushed the lpimentel/cache-serverless-platform-checks branch from 989bf74 to 1222ea7 Compare February 24, 2026 18:39
@lucaspimentel lucaspimentel added type:refactor type:performance Performance, speed, latency, resource usage (CPU, memory) labels Feb 24, 2026

@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.

Nice 👍

Just to be sure, these env vars won't ever be changed in-process, right? I can't see that we would ever set them ourselves, so I think so.

Good call just doing this for the serverless stuff, definitely the safer option.

Comment thread tracer/src/Datadog.Trace/Serverless/Aws.cs Outdated
Comment thread tracer/src/Datadog.Trace/Serverless/Aws.cs Outdated
Comment thread tracer/src/Datadog.Trace/Serverless/AzureInfo.cs Outdated
@lucaspimentel
lucaspimentel force-pushed the lpimentel/cache-serverless-platform-checks branch from 3d71773 to e277348 Compare February 26, 2026 16:54
@lucaspimentel
lucaspimentel force-pushed the lpimentel/cache-serverless-platform-checks branch 2 times, most recently from 832e846 to fe91f7f Compare March 17, 2026 17:04
Create AzurePlatformDetection, AwsPlatformDetection, and GcpPlatformDetection
under Datadog.Trace.Serverless namespace. Each caches detection results in
static fields to avoid repeated env-var reads. Promote EnvironmentVariableExists
to internal visibility for use by the new classes.

🤖 Co-Authored-By: Claude Code <[email protected]>
Replace EnvironmentHelpers.IsXxx() calls with the corresponding
properties on AzurePlatformDetection, AwsPlatformDetection, and
GcpPlatformDetection. Update tests to assert on the new types.

🤖 Co-Authored-By: Claude Code <[email protected]>
All callers now use AzurePlatformDetection, AwsPlatformDetection, and
GcpPlatformDetection directly. EnvironmentVariableExists remains as
internal for use by the new detection classes.

🤖 Co-Authored-By: Claude Code <[email protected]>
🤖 Co-Authored-By: Claude Code <[email protected]>
The tests set environment variables after construction, but
AwsPlatformDetection and AzurePlatformDetection cache their results.
Reset the caches before each test so env vars are read fresh.

🤖 Co-Authored-By: Claude Code <[email protected]>
Replace static AwsPlatformDetection, AzurePlatformDetection, and
GcpPlatformDetection with non-static Aws, Azure, and Gcp classes.
Each has a Default singleton for production and supports new instances
for test isolation, removing the need for Reset() methods and
EnvironmentRestorer workarounds.

🤖 Co-Authored-By: Claude Code <[email protected]>
@lucaspimentel
lucaspimentel force-pushed the lpimentel/cache-serverless-platform-checks branch from fe91f7f to b3347ce Compare March 27, 2026 16:28
@lucaspimentel
lucaspimentel merged commit 0b65644 into master Mar 31, 2026
150 checks passed
@lucaspimentel
lucaspimentel deleted the lpimentel/cache-serverless-platform-checks branch March 31, 2026 13:11
@github-actions github-actions Bot added this to the vNext-v3 milestone Mar 31, 2026
Lewis-E added a commit that referenced this pull request Apr 16, 2026
Master #8231 extracted serverless platform detection from
EnvironmentHelpers into dedicated cached classes under
Datadog.Trace.Serverless. Update the Azure-Functions pipe-name
generation gate to call AzureInfo.Instance.IsAzureFunction and
IsUsingSiteExtension instead of the removed EnvironmentHelpers
methods.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Lewis-E added a commit that referenced this pull request Apr 20, 2026
Master #8231 extracted serverless platform detection from
EnvironmentHelpers into dedicated cached classes under
Datadog.Trace.Serverless. Update the Azure-Functions pipe-name
generation gate to call AzureInfo.Instance.IsAzureFunction and
IsUsingSiteExtension instead of the removed EnvironmentHelpers
methods.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Lewis-E added a commit that referenced this pull request Apr 21, 2026
Master #8231 extracted serverless platform detection from
EnvironmentHelpers into dedicated cached classes under
Datadog.Trace.Serverless. Update the Azure-Functions pipe-name
generation gate to call AzureInfo.Instance.IsAzureFunction and
IsUsingSiteExtension instead of the removed EnvironmentHelpers
methods.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Lewis-E added a commit that referenced this pull request Apr 23, 2026
Master #8231 extracted serverless platform detection from
EnvironmentHelpers into dedicated cached classes under
Datadog.Trace.Serverless. Update the Azure-Functions pipe-name
generation gate to call AzureInfo.Instance.IsAzureFunction and
IsUsingSiteExtension instead of the removed EnvironmentHelpers
methods.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Lewis-E added a commit that referenced this pull request Apr 30, 2026
Master #8231 extracted serverless platform detection from
EnvironmentHelpers into dedicated cached classes under
Datadog.Trace.Serverless. Update the Azure-Functions pipe-name
generation gate to call AzureInfo.Instance.IsAzureFunction and
IsUsingSiteExtension instead of the removed EnvironmentHelpers
methods.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:serverless type:performance Performance, speed, latency, resource usage (CPU, memory) type:refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants