Skip to content

Commit b821c57

Browse files
authored
fix(microbenchmarks): restore CI Visibility reporting to Datadog (#8483)
## Summary of changes - Set `DD_CIVISIBILITY_AGENTLESS_ENABLED=1` on the benchmark process in `.gitlab/benchmarks/microbenchmarks/scripts/run-benchmarks.ps1` when `DD_API_KEY` is present, and default `DD_SITE=datadoghq.com`. - Change the SSM parameter name in `.gitlab/benchmarks/microbenchmarks.yml` from `ci.dd-trace-dotnet.dd_api_key` to `ci.dd-trace-dotnet.dd_api_key-prod` to match the key the previous pipeline was using. ## Reason for change Microbenchmark results stopped being reported to Datadog on April 8, 2026, after #8300 moved the Windows microbenchmark runner from `benchmarking-platform@dd-trace-dotnet/micro` into this repo. The `Datadog.Trace.BenchmarkDotNet` exporter ships results to Datadog via CI Visibility, and the old flow enabled agentless mode (`DD_CIVISIBILITY_AGENTLESS_ENABLED=1`) with a production SSM key — two details that were not carried over in the rewrite, so the exporter silently failed to reach intake. Cross-reference with the old script: `benchmarking-platform/run-benchmarks.ps1:128` (`$env:DD_CIVISIBILITY_AGENTLESS_ENABLED=1`) and `benchmarking-platform/steps/run-windows-benchmarks.sh:9` (`ci.${CI_PROJECT_NAME}.dd_api_key-prod`). ## Implementation details - `run-benchmarks.ps1` now guards the agentless toggle on `DD_API_KEY` being set, so local/dev invocations without a key continue to behave as before (warn and skip agentless) rather than attempting — and failing — to hit intake. - No changes to `Build.cs`, tracer code, or the benchmark projects. This is purely a CI config fix. ## Test coverage - Verified the execution order in `bp-runner.windows.yml`: the env vars are set in `run-benchmarks.ps1` after `BuildTracerHome`/`BuildBenchmarks` and before the BDN CLI is invoked — i.e., inherited by every BDN child process. ## Other details
1 parent d5e3bbf commit b821c57

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

.gitlab/benchmarks/microbenchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ run-benchmarks:
106106
- mkdir -p artifacts
107107
- export GITHUB_TOKEN=$(cat /tmp/github-token)
108108
# Fetch DD_API_KEY from SSM (in GitLab runner's AWS account) and export for bp-infra
109-
- export DD_API_KEY=$(aws ssm get-parameter --name "ci.dd-trace-dotnet.dd_api_key" --with-decryption --query "Parameter.Value" --output text --region "${AWS_REGION}")
109+
- export DD_API_KEY=$(aws ssm get-parameter --name "ci.dd-trace-dotnet.dd_api_key-prod" --with-decryption --query "Parameter.Value" --output text --region "${AWS_REGION}")
110110
- CLEANUP_ARG=$([[ "$CLEANUP" == "false" ]] && echo "--no-cleanup" || echo "")
111111
# Run benchmarks on ephemeral instance
112112
- |

.gitlab/benchmarks/microbenchmarks/scripts/run-benchmarks.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ $env:DD_ENV = "CI"
114114
$env:DD_DOTNET_TRACER_HOME = $monitoringHome
115115
$env:DD_TRACER_HOME = $monitoringHome
116116

117+
# CI Visibility ships benchmark results to Datadog via the in-process tracer.
118+
# The ephemeral benchmarking VM does not run a Datadog Agent, so route directly
119+
# to intake via agentless mode. DD_API_KEY is forwarded from the GitLab job.
120+
if ($env:DD_API_KEY) {
121+
$env:DD_CIVISIBILITY_AGENTLESS_ENABLED = "1"
122+
if (-not $env:DD_SITE) {
123+
$env:DD_SITE = "datadoghq.com"
124+
}
125+
Write-Output "CI Visibility agentless mode enabled (site: $env:DD_SITE)"
126+
} else {
127+
Write-Warning "DD_API_KEY not set; CI Visibility data will not be sent to Datadog"
128+
}
129+
117130
# Build BenchmarkDotNet arguments
118131
$arguments = @("-r") + $runtimes + @(
119132
"-m",

0 commit comments

Comments
 (0)