[Blocked] Add automatic process environment context propagation #5660
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #5660"
general
weight: 0.35
pellared
Motivation
Processes launched from CI jobs, test runners, and command-line tools can receive trace context through environment variables, but automatic instrumentation currently starts disconnected root activities and does not inject the active context into child processes. An application using
ActivitySource.StartActivity("job")should continue the incoming context without manually extracting it or configuring method targets.Related specification PR:
Changes
parent,link, andnonemodes. The default isparent.ActivitySource.StartActivityandCreateActivityoverloads. Preserve ambient and supplied parents, existing links, delayed starts, and normal activity lifetimes without creating a synthetic process span.ProcessStartInfo. Forward incoming trace context in parent mode when there is no active span.process.context_extraction.modeandprocess.context_injection.enabledoptions. No-code method instrumentation remains optional.ActivitySource performance
The added per-call
ActivitySourcehook overhead is absent whenOTEL_DOTNET_AUTO_TRACES_PROCESS_INSTRUMENTATION_CONTEXT_EXTRACTION_MODE=noneorOTEL_DOTNET_AUTO_TRACES_PROCESS_INSTRUMENTATION_ENABLED=falseis configured at startup. In both cases, the activity factory hook is excluded before bytecode rewriting; there is no injected callback or per-call enablement check. The hook is also omitted when extraction finds no valid incoming trace context. With extraction set tonone, child-process injection remains independently configurable; disabling PROCESS disables both directions. General profiler, SDK, and other instrumentation costs can still remain. Native audits confirmed the disabled paths (the extraction mode was namedoffin the measured revision).Measured head:
536388a48532750a501e2bf94b36e7b946d69a82. Ubuntu 24.04.4 Linux x64/KVM, AMD EPYC 7571, CPU 3, concurrent workstation GC, runtime-default tiering. The VM is unreserved; frequency controls are unavailable.Measured targets: .NET 8.0.33, .NET 9.0.22: DiagnosticSource assembly
10.0.0.0, file10.0.25.52411; .NET 10.0.14: DiagnosticSource assembly10.0.0.0, file10.0.1426.52326.Baseline: same profiler, PROCESS disabled, equivalent cached manual parent/link inputs, no exporters. Controls preserve parent selection, sampling decisions, and activity lifetimes. The primary listener uses fixed decisions;
NoListenersuses the plain overload in every profile. Missing incoming trace context, disabled extraction, and disabled PROCESS leave the factory hook unregistered (native audits). Δ includes interception and context/link handling: automatic minus baseline after BenchmarkDotNet empty-loop subtraction; brackets show nominal paired 95% Student t intervals. Δ % = 100 × (automatic mean − baseline mean) / baseline mean, using unrounded aggregate means; percentages are point estimates. Allocation deltas are B/op, parent/link.| .NET 10 workload | Parent Δ ns/op [nominal 95% CI] | Parent Δ % | Link Δ ns/op [nominal 95% CI] | Link Δ % | +B/op parent/link |
| --- | ---: | ---: | ---: | ---: | ---: |
|
Root| +101.0 [86.2, 115.7] | +26.8% | +81.9 [66.1, 97.7] | +15.3% | 0/0 ||
RootEmptyLinks| +96.9 [84.0, 109.7] | +25.4% | +219.6 [196.3, 242.8] | +42.3% | 0/+128 ||
RootExistingLink| +100.8 [87.8, 113.8] | +21.8% | +264.3 [241.3, 287.3] | +45.5% | 0/+160 ||
RootAlreadyLinked| +100.5 [80.4, 120.6] | +21.8% | +233.9 [190.2, 277.5] | +43.3% | 0/+160 ||
NoListeners| +86.8 [75.7, 97.9] | +632.1% | +77.3 [75.4, 79.2] | +580.7% | 0/0 ||
Dropped| +79.5 [75.7, 83.3] | +195.3% | +68.3 [60.8, 75.8] | +125.6% | 0/0 ||
DropReadingLinks| +78.6 [75.2, 82.0] | +123.1% | +238.0 [221.2, 254.9] | +309.2% | 0/+160 ||
AmbientParent| +72.9 [65.4, 80.4] | +17.8% | +77.6 [72.6, 82.5] | +19.2% | 0/0 ||
SuppliedContext| +91.0 [74.2, 107.9] | +24.5% | +102.0 [95.9, 108.0] | +28.3% | 0/0 ||
SuppliedParentId| +45.1 [30.9, 59.3] | +8.2% | +68.0 [40.7, 95.2] | +12.5% | 0/0 ||
SuppliedEmptyParentId| +36.6 [11.4, 61.8] | +7.6% | +33.2 [8.1, 58.2] | +6.9% | 0/0 ||
CreateOnly| +88.6 [85.5, 91.7] | +98.9% | +72.1 [62.9, 81.3] | +36.3% | 0/0 ||
CreateThenStart| +112.6 [73.8, 151.4] | +30.1% | +86.9 [79.6, 94.3] | +16.5% | 0/0 ||
PropagationOnly| +105.0 [94.2, 115.7] | +28.0% | +86.3 [45.8, 126.9] | +16.3% | 0/0 |Sampled
Rootabsolute baseline → automatic: parent 376.9 → 477.8 ns/op; link 534.0 → 615.9 ns/op.NoListenersabsolute baseline → automatic: parent 13.7 → 100.5 ns/op; link 13.3 → 90.6 ns/op. Empty-loop subtraction matters here; raw Actual values remain available. The no-listener estimate includes a legacy four-block cohort without captured source/PDB binding; the repeat cannot strengthen that legacy proof.In link mode, non-null caller collections add deferred append/de-duplication work:
RootEmptyLinks+128 B/op;RootExistingLink+160 B/op;RootAlreadyLinked+160 B/op. Null inputs reuse the singleton; the manual control caches the complete equivalent collection.A separate successful sampler reads links before Activity copies them:
Root556.7 → 647.7 ns/op (Δ +91.0 [72.0, 110.0] ns/op; +16.4%; 0 B/op);RootExistingLink635.2 → 977.3 ns/op (Δ +342.2 [324.3, 360.0] ns/op; +53.9%; +160 B/op).Secondary
Rootcases use matched controls; costs depend on workload and runtime/tiering configuration. The SDK uses an application-owned ParentBased(AlwaysOn) provider without processors/exporters. The full report retains the .NET 8/9 six-workload subsets and remaining SDK/tiering cases.| Secondary Root case | Parent Δ ns/op [nominal 95% CI] | Parent Δ % | Link Δ ns/op [nominal 95% CI] | Link Δ % |
| --- | ---: | ---: | ---: | ---: |
| .NET 8 | +97.9 [72.0, 123.7] | +20.1% | +72.7 [43.3, 102.1] | +10.5% |
| .NET 9 | +79.7 [49.0, 110.3] | +17.5% | +63.7 [8.1, 119.2] | +9.8% |
| .NET 10 application SDK, ParentBased(AlwaysOn) | +89.0 [48.4, 129.6] | +19.1% | +88.1 [74.5, 101.6] | +14.5% |
| .NET 10 tiering disabled | +120.9 [103.3, 138.6] | +21.0% | +129.4 [114.1, 144.7] | +15.9% |
Four fresh processes per profile/cohort; 20 iterations/process, all retained (
DontRemove); 10 seconds warming the actual method plus 40 BenchmarkDotNet warmups. The frozen plan pools eight blocks for .NET 10Root,NoListeners,Dropped,AmbientParent, andSuppliedContext; other comparisons use four. Cohorts remain separate in the artifact. Repeats followed observed between-process variance; the plan was then frozen with no further precision-based stopping. These pointwise intervals use process blocks, are exploratory and nominal, and have no sequential-selection or multiplicity adjustment.Scope is warmed, single-threaded Linux factory calls, excluding startup, full requests, exporters, child-process creation, and concurrent throughput. Windows, .NET Framework, and ARM were not measured.
Results · Methodology · Sources · Raw data and audits