Skip to content

[Test Optimization] Add missing test_session metric #6776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 18, 2025

Conversation

tonyredondo
Copy link
Member

Summary of changes

This PR adds the missing test_session telemetry metric.

JIRA: https://datadoghq.atlassian.net/browse/SDTEST-1697

Reason for change

The metric was already in the common_metrics.json file but the implementation was missing.

Implementation details

Test coverage

Other details

@tonyredondo tonyredondo requested review from a team as code owners March 18, 2025 09:38
@tonyredondo tonyredondo self-assigned this Mar 18, 2025
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

LGTM, just a nit + question

/// <summary>
/// Test session auto injected environment variable
/// </summary>
public const string TestSessionAutoInjectedEnvironmentVariable = "DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER";
Copy link
Member

Choose a reason for hiding this comment

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

Need a dd-go PR for this setting? I guess not, but then should they be able to set it through other config sources (i.e. should it be "real" config) and if not, you probably need to add it to the "exclude" list in the unit tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because this is a setting that we want to use internally and not expose it to customers I don't think we want to add it to the dd-go settings. This settings will be set by a bash script and only using environment variables.

@DataDog DataDog deleted a comment from datadog-datadog-prod-us1 bot Mar 18, 2025
@DataDog DataDog deleted a comment from andrewlock Mar 18, 2025
@DataDog DataDog deleted a comment from andrewlock Mar 18, 2025
@andrewlock
Copy link
Member

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

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 shown 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).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6776) - mean (69ms)  : 66, 72
     .   : milestone, 69,
    master - mean (69ms)  : 67, 71
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6776) - mean (1,004ms)  : 985, 1023
     .   : milestone, 1004,
    master - mean (1,006ms)  : 977, 1034
     .   : milestone, 1006,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6776) - mean (102ms)  : 100, 104
     .   : milestone, 102,
    master - mean (102ms)  : 99, 105
     .   : milestone, 102,

    section CallTarget+Inlining+NGEN
    This PR (6776) - mean (684ms)  : 668, 701
     .   : milestone, 684,
    master - mean (685ms)  : 669, 702
     .   : milestone, 685,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6776) - mean (89ms)  : 87, 92
     .   : milestone, 89,
    master - mean (89ms)  : 86, 91
     .   : milestone, 89,

    section CallTarget+Inlining+NGEN
    This PR (6776) - mean (637ms)  : 619, 655
     .   : milestone, 637,
    master - mean (642ms)  : 622, 662
     .   : milestone, 642,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6776) - mean (191ms)  : 186, 195
     .   : milestone, 191,
    master - mean (191ms)  : 187, 194
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (6776) - mean (1,106ms)  : 1078, 1133
     .   : milestone, 1106,
    master - mean (1,107ms)  : 1085, 1130
     .   : milestone, 1107,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6776) - mean (269ms)  : 265, 273
     .   : milestone, 269,
    master - mean (269ms)  : 265, 273
     .   : milestone, 269,

    section CallTarget+Inlining+NGEN
    This PR (6776) - mean (876ms)  : 847, 906
     .   : milestone, 876,
    master - mean (876ms)  : 839, 912
     .   : milestone, 876,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6776) - mean (262ms)  : 258, 265
     .   : milestone, 262,
    master - mean (262ms)  : 258, 265
     .   : milestone, 262,

    section CallTarget+Inlining+NGEN
    This PR (6776) - mean (853ms)  : 824, 883
     .   : milestone, 853,
    master - mean (859ms)  : 828, 890
     .   : milestone, 859,

Loading

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6776 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.130
  • All benchmarks have the same allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.92μs 45.1ns 316ns 0.0192 0.00769 0 5.61 KB
master StartStopWithChild netcoreapp3.1 9.91μs 52.9ns 280ns 0.0237 0.00947 0 5.8 KB
master StartStopWithChild net472 16.1μs 47.9ns 179ns 1.04 0.313 0.0963 6.2 KB
#6776 StartStopWithChild net6.0 8.02μs 45.8ns 340ns 0.0166 0.00415 0 5.61 KB
#6776 StartStopWithChild netcoreapp3.1 10.1μs 56.2ns 342ns 0.02 0.00999 0 5.8 KB
#6776 StartStopWithChild net472 16.2μs 44.1ns 171ns 1.05 0.325 0.103 6.22 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 496μs 605ns 2.34μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 654μs 425ns 1.64μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 854μs 1.56μs 6.06μs 0.425 0 0 3.3 KB
#6776 WriteAndFlushEnrichedTraces net6.0 490μs 602ns 2.33μs 0 0 0 2.7 KB
#6776 WriteAndFlushEnrichedTraces netcoreapp3.1 631μs 299ns 1.16μs 0 0 0 2.7 KB
#6776 WriteAndFlushEnrichedTraces net472 875μs 849ns 3.29μs 0.434 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 128μs 359ns 1.39μs 0.191 0 0 14.47 KB
master SendRequest netcoreapp3.1 143μs 508ns 1.97μs 0.215 0 0 17.27 KB
master SendRequest net472 0.000163ns 9.56E‑05ns 0.000358ns 0 0 0 0 b
#6776 SendRequest net6.0 131μs 581ns 2.25μs 0.193 0 0 14.47 KB
#6776 SendRequest netcoreapp3.1 148μs 133ns 481ns 0.22 0 0 17.27 KB
#6776 SendRequest net472 0.00019ns 0.000147ns 0.000549ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 627μs 4.17μs 41.3μs 0.571 0 0 41.62 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 732μs 4.51μs 44.2μs 0.334 0 0 41.87 KB
master WriteAndFlushEnrichedTraces net472 855μs 4.34μs 20.8μs 8.08 2.55 0.425 53.32 KB
#6776 WriteAndFlushEnrichedTraces net6.0 593μs 3.3μs 20.6μs 0.291 0 0 41.65 KB
#6776 WriteAndFlushEnrichedTraces netcoreapp3.1 694μs 3.9μs 26.1μs 0.332 0 0 41.8 KB
#6776 WriteAndFlushEnrichedTraces net472 872μs 4.22μs 17.4μs 8.08 2.55 0.425 53.28 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.26μs 1.45ns 5.6ns 0.0145 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.71μs 2.1ns 8.14ns 0.0137 0 0 1.02 KB
master ExecuteNonQuery net472 2.08μs 4.28ns 16.6ns 0.157 0.00104 0 987 B
#6776 ExecuteNonQuery net6.0 1.24μs 1.48ns 5.54ns 0.0145 0 0 1.02 KB
#6776 ExecuteNonQuery netcoreapp3.1 1.7μs 2.36ns 9.16ns 0.0135 0 0 1.02 KB
#6776 ExecuteNonQuery net472 2.13μs 3.43ns 13.3ns 0.156 0.00108 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6776

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 1.132 1,353.23 1,195.27

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.35μs 0.414ns 1.6ns 0.0136 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.66μs 1.68ns 6.51ns 0.0132 0 0 976 B
master CallElasticsearch net472 2.72μs 6.62ns 24.8ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.25μs 0.452ns 1.69ns 0.0131 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.64μs 0.872ns 3.38ns 0.014 0 0 1.02 KB
master CallElasticsearchAsync net472 2.61μs 1.9ns 7.36ns 0.167 0 0 1.05 KB
#6776 CallElasticsearch net6.0 1.2μs 0.509ns 1.9ns 0.0136 0 0 976 B
#6776 CallElasticsearch netcoreapp3.1 1.56μs 0.585ns 2.19ns 0.0133 0 0 976 B
#6776 CallElasticsearch net472 2.57μs 1.61ns 6.02ns 0.158 0 0 995 B
#6776 CallElasticsearchAsync net6.0 1.25μs 3.73ns 14.4ns 0.013 0 0 952 B
#6776 CallElasticsearchAsync netcoreapp3.1 1.58μs 0.729ns 2.63ns 0.0135 0 0 1.02 KB
#6776 CallElasticsearchAsync net472 2.79μs 1.67ns 6.47ns 0.167 0 0 1.05 KB
Benchmarks.Trace.GraphQLBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6776

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 1.127 1,362.53 1,208.57

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.36μs 0.462ns 1.73ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.63μs 1.32ns 4.93ns 0.0122 0 0 952 B
master ExecuteAsync net472 1.74μs 0.494ns 1.85ns 0.145 0 0 915 B
#6776 ExecuteAsync net6.0 1.21μs 0.57ns 2.13ns 0.0135 0 0 952 B
#6776 ExecuteAsync netcoreapp3.1 1.66μs 1.17ns 4.53ns 0.0124 0 0 952 B
#6776 ExecuteAsync net472 1.78μs 0.58ns 2.17ns 0.145 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 4.45μs 3.64ns 13.6ns 0.0309 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.45μs 5.27ns 20.4ns 0.0381 0 0 2.85 KB
master SendAsync net472 7.4μs 2.02ns 7ns 0.494 0 0 3.12 KB
#6776 SendAsync net6.0 4.38μs 0.952ns 3.56ns 0.0329 0 0 2.31 KB
#6776 SendAsync netcoreapp3.1 5.44μs 2.18ns 8.43ns 0.0381 0 0 2.85 KB
#6776 SendAsync net472 7.55μs 2.75ns 10.6ns 0.495 0 0 3.12 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.57μs 0.497ns 1.86ns 0.0236 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.24μs 1.43ns 5.37ns 0.0224 0 0 1.64 KB
master EnrichedLog net472 2.58μs 0.624ns 2.25ns 0.25 0 0 1.57 KB
#6776 EnrichedLog net6.0 1.46μs 0.385ns 1.44ns 0.0227 0 0 1.64 KB
#6776 EnrichedLog netcoreapp3.1 2.31μs 2.15ns 7.74ns 0.0219 0 0 1.64 KB
#6776 EnrichedLog net472 2.54μs 5.45ns 20.4ns 0.249 0 0 1.57 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 111μs 143ns 553ns 0.0555 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 117μs 146ns 547ns 0.0588 0 0 4.28 KB
master EnrichedLog net472 149μs 223ns 863ns 0.678 0.226 0 4.46 KB
#6776 EnrichedLog net6.0 112μs 133ns 517ns 0.056 0 0 4.28 KB
#6776 EnrichedLog netcoreapp3.1 117μs 185ns 717ns 0.0588 0 0 4.28 KB
#6776 EnrichedLog net472 149μs 129ns 500ns 0.67 0.223 0 4.46 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.08μs 1.22ns 4.57ns 0.0308 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.31μs 4.52ns 17.5ns 0.0304 0 0 2.2 KB
master EnrichedLog net472 4.71μs 1.77ns 6.87ns 0.32 0 0 2.02 KB
#6776 EnrichedLog net6.0 3.16μs 1.21ns 4.69ns 0.03 0 0 2.2 KB
#6776 EnrichedLog netcoreapp3.1 4.2μs 1.17ns 4.52ns 0.0297 0 0 2.2 KB
#6776 EnrichedLog net472 4.78μs 1.28ns 4.8ns 0.319 0 0 2.02 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.38μs 0.903ns 3.5ns 0.0158 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.81μs 0.735ns 2.85ns 0.0153 0 0 1.14 KB
master SendReceive net472 2.12μs 1.37ns 5.31ns 0.183 0 0 1.16 KB
#6776 SendReceive net6.0 1.36μs 0.926ns 3.59ns 0.0156 0 0 1.14 KB
#6776 SendReceive netcoreapp3.1 1.73μs 0.653ns 2.44ns 0.0155 0 0 1.14 KB
#6776 SendReceive net472 2.11μs 2.03ns 7.32ns 0.183 0 0 1.16 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.82μs 1.27ns 4.74ns 0.0225 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 4.05μs 1.57ns 5.88ns 0.0221 0 0 1.65 KB
master EnrichedLog net472 4.42μs 4.31ns 16.7ns 0.323 0 0 2.04 KB
#6776 EnrichedLog net6.0 2.63μs 0.642ns 2.4ns 0.0224 0 0 1.6 KB
#6776 EnrichedLog netcoreapp3.1 4.04μs 4.94ns 19.1ns 0.0221 0 0 1.65 KB
#6776 EnrichedLog net472 4.57μs 3.51ns 13.1ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 402ns 0.0703ns 0.263ns 0.00801 0 0 576 B
master StartFinishSpan netcoreapp3.1 577ns 0.311ns 1.2ns 0.00777 0 0 576 B
master StartFinishSpan net472 665ns 0.277ns 1.03ns 0.0915 0 0 578 B
master StartFinishScope net6.0 477ns 0.103ns 0.398ns 0.00974 0 0 696 B
master StartFinishScope netcoreapp3.1 742ns 0.362ns 1.4ns 0.00919 0 0 696 B
master StartFinishScope net472 843ns 0.172ns 0.667ns 0.104 0 0 658 B
#6776 StartFinishSpan net6.0 401ns 0.13ns 0.502ns 0.00807 0 0 576 B
#6776 StartFinishSpan netcoreapp3.1 568ns 0.462ns 1.79ns 0.00768 0 0 576 B
#6776 StartFinishSpan net472 649ns 0.449ns 1.74ns 0.0916 0 0 578 B
#6776 StartFinishScope net6.0 471ns 0.197ns 0.762ns 0.00967 0 0 696 B
#6776 StartFinishScope netcoreapp3.1 713ns 0.341ns 1.32ns 0.00932 0 0 696 B
#6776 StartFinishScope net472 803ns 0.621ns 2.32ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 639ns 0.122ns 0.438ns 0.00957 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 922ns 0.391ns 1.41ns 0.0093 0 0 696 B
master RunOnMethodBegin net472 1.12μs 0.367ns 1.42ns 0.104 0 0 658 B
#6776 RunOnMethodBegin net6.0 618ns 0.234ns 0.905ns 0.00991 0 0 696 B
#6776 RunOnMethodBegin netcoreapp3.1 988ns 0.611ns 2.37ns 0.00887 0 0 696 B
#6776 RunOnMethodBegin net472 1.17μs 0.233ns 0.871ns 0.104 0 0 658 B

@tonyredondo tonyredondo merged commit 752321a into master Mar 18, 2025
128 of 130 checks passed
@tonyredondo tonyredondo deleted the tony/civisibility-test-session-metric branch March 18, 2025 17:23
@github-actions github-actions bot added this to the vNext-v3 milestone Mar 18, 2025
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.

4 participants