[Test Optimization] Improve GitHub Actions @ci.job.url format#8098
[Test Optimization] Improve GitHub Actions @ci.job.url format#8098tonyredondo merged 10 commits intomasterfrom
@ci.job.url format#8098Conversation
…navigation
Fixes the `@ci.job.url` tag to construct proper job-specific URLs that navigate
directly to the job logs instead of the commit checks page.
Core changes:
- Add `JOB_CHECK_RUN_ID` environment variable support for explicit job ID
- Implement diagnostics file parsing to extract numeric job ID from Worker_*.log
- Use dual extraction strategy: JSON parse with regex fallback for robustness
- Construct correct URL format: `{repo}/actions/runs/{run_id}/job/{job_id}`
Priority order for job ID resolution:
1. `JOB_CHECK_RUN_ID` environment variable (set via `${{ job.check_run_id }}`)
2. GitHub Actions runner diagnostics files (`_diag/Worker_*.log`)
3. Fallback to `GITHUB_JOB` with commit checks URL (existing behavior)
Defensive measures:
- 10MB file size limit for diagnostics files
- Graceful error handling with debug logging
- Platform-specific diagnostic directory detection (Linux, macOS, Windows)
BenchmarksBenchmark execution time: 2026-02-04 11:42:38 Comparing candidate commit fae7606 in PR branch Found 7 performance improvements and 7 performance regressions! Performance is the same for 160 metrics, 18 unstable metrics. scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0
scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0
scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery netcoreapp3.1
scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472
scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8098) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-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:
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 chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8098) - mean (80ms) : 78, 83
master - mean (79ms) : 77, 82
section Bailout
This PR (8098) - mean (84ms) : 82, 87
master - mean (85ms) : 83, 86
section CallTarget+Inlining+NGEN
This PR (8098) - mean (1,128ms) : 1076, 1179
master - mean (1,122ms) : 1067, 1178
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 (8098) - mean (137ms) : 133, 142
master - mean (126ms) : 123, 129
section Bailout
This PR (8098) - mean (139ms) : crit, 136, 141
master - mean (126ms) : 122, 130
section CallTarget+Inlining+NGEN
This PR (8098) - mean (903ms) : crit, 862, 944
master - mean (808ms) : 755, 860
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8098) - mean (113ms) : 109, 117
master - mean (111ms) : 108, 114
section Bailout
This PR (8098) - mean (112ms) : 110, 115
master - mean (112ms) : 110, 114
section CallTarget+Inlining+NGEN
This PR (8098) - mean (789ms) : 735, 843
master - mean (784ms) : 717, 851
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8098) - mean (117ms) : 114, 121
master - mean (107ms) : 103, 111
section Bailout
This PR (8098) - mean (121ms) : crit, 119, 124
master - mean (108ms) : 105, 111
section CallTarget+Inlining+NGEN
This PR (8098) - mean (767ms) : crit, 746, 789
master - mean (723ms) : 698, 749
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 (8098) - mean (206ms) : 196, 217
master - mean (204ms) : 196, 212
section Bailout
This PR (8098) - mean (211ms) : 202, 219
master - mean (207ms) : 200, 213
section CallTarget+Inlining+NGEN
This PR (8098) - mean (1,191ms) : 1126, 1256
master - mean (1,191ms) : 1143, 1239
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 (8098) - mean (297ms) : 282, 311
master - mean (296ms) : 283, 309
section Bailout
This PR (8098) - mean (297ms) : 285, 309
master - mean (296ms) : 288, 305
section CallTarget+Inlining+NGEN
This PR (8098) - mean (979ms) : 921, 1037
master - mean (972ms) : 910, 1033
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8098) - mean (299ms) : 289, 309
master - mean (290ms) : 276, 304
section Bailout
This PR (8098) - mean (303ms) : 290, 316
master - mean (294ms) : 284, 305
section CallTarget+Inlining+NGEN
This PR (8098) - mean (1,020ms) : 970, 1069
master - mean (979ms) : 906, 1053
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8098) - mean (296ms) : 285, 308
master - mean (291ms) : 281, 300
section Bailout
This PR (8098) - mean (297ms) : 286, 307
master - mean (292ms) : 281, 302
section CallTarget+Inlining+NGEN
This PR (8098) - mean (977ms) : 866, 1087
master - mean (993ms) : 877, 1108
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
andrewlock
left a comment
There was a problem hiding this comment.
LGTM, apart from a bunch of nits
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Ci/CiEnvironment/GithubActionsEnvironmentValues.cs
Outdated
Show resolved
Hide resolved
tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/CIEnvironmentVariableTests.cs
Outdated
Show resolved
Hide resolved
tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/CIEnvironmentVariableTests.cs
Show resolved
Hide resolved
…mentValues.cs Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
Summary of changes
Fixes the
@ci.job.urltag to construct proper job-specific URLs that navigate directly to the job logs instead of the commit checks page.JIRA: SDTEST-3001
Core changes:
JOB_CHECK_RUN_IDenvironment variable support for explicit job ID configurationWorker_*.logfiles{repo}/actions/runs/{run_id}/job/{job_id}Reason for change
The current
@ci.job.urlformat points to the commit checks page (/commit/{sha}/checks) rather than the specific job. This makes it difficult for users to navigate directly to the relevant job logs when investigating test failures or CI issues.GitHub Actions jobs have two identifiers:
GITHUB_JOB): Human-readable job name from workflow YAMLjob.check_run_id): The actual ID used in URLs for direct job navigationThe correct URL format
{repo}/actions/runs/{run_id}/job/{job_id}requires the numeric job ID, which is not exposed as an environment variable by default.Implementation details
Priority order for job ID resolution:
JOB_CHECK_RUN_IDenvironment variable - Users can set this via${{ job.check_run_id }}in their workflow_diag/Worker_*.log) - Automatic extraction when env var not setGITHUB_JOBwith commit checks URL (existing behavior)Diagnostics file extraction:
Worker_*.logfiles sorted by modification time (newest first){ "job": { "d": [ { "k": "check_run_id", "v": 55411116365 } ] } }Defensive measures:
Test coverage
Unit tests (CIEnvironmentVariableTests.cs):
GithubJobIdFromEnvironmentVariableTest- Tests job ID fromJOB_CHECK_RUN_IDenv varGithubJobIdFallbackTest- Tests fallback to commit checks URL when no numeric ID availableGithubDiagnosticsFileExtractionTest- Tests JSON extraction via reflectionGithubDiagnosticsFileSizeLimitTest- Tests 10MB file size limit enforcementGithubDiagnosticsFileRegexFallbackTest- Tests regex fallback extractionData-driven tests (github.json):
JOB_CHECK_RUN_IDwith both GitHub.com and GitHub Enterprise ServerOther details
Users can enable the improved URL format by adding this to their workflow:
If not set, the tracer will attempt to extract the job ID from runner diagnostics files automatically.