← Back to Pull requests

[PAR] Export split executor traces and flush on shutdown #58767

Closed
unknown closed this pull request without merging on Oct 23, 2026 20:45 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 12:01 UTC
Author

What does this PR do?

Starts the existing installer telemetry sender in the split-mode Go executor and flushes completed spans during executor shutdown, after the action drain.

  • Shares startTelemetry / stopTelemetry helpers between monolithic and executor lifecycles, preserving their startup/shutdown ordering.

  • Reuses the existing HTTP transport, sanitized API key, resolved site, and private-action-runner service.

  • Starts the sender only for an action-capable executor, after fallible startup setup has succeeded.

  • Flushes on normal and idle shutdown, including executors that exit before the periodic flush; clears the telemetry field after stopping.

  • Adds lifecycle/export regression tests and a release note.
  • Motivation

    The shared action execution path already creates action.run spans and rshell descendants. In split mode, run-executor did not initialize a sender or flush one on shutdown. Completed spans accumulated in that process's buffer and were lost when it exited. A sender in the core Agent cannot drain the executor's process-local buffer.

    Describe how you validated your changes

    Passed locally on macOS/arm64:

    dda inv test --targets=./comp/privateactionrunner/impl,./pkg/privateactionrunner/executor,./pkg/privateactionrunner/runners,./pkg/fleet/installer/telemetry --bazel-args='--jobs=4 --test_output=errors'
    
    dda inv test --targets=./comp/privateactionrunner/impl --race --test-args='-test.run=Test(StopFlushesTracesAfterDraining|ExecutorTelemetryLifecycle)$ -test.count=3 -test.v' --bazel-args='--jobs=4 --test_output=errors'
    
    dda inv linter.go --targets=./comp/privateactionrunner/impl --build-tags=test --cpus=4 --timeout=3
    

  • Startup tests cover enabled/disabled mode, failed socket setup without starting telemetry, and idle shutdown. These tests use GovCloud's existing no-export behavior to avoid external traffic and run on Linux/macOS.

  • The portable shutdown test covers both stop paths with concurrent synthetic action/rshell spans, deterministic testing/synctest scheduling, and an in-memory HTTP transport that decodes the export payload. It checks no early flush during draining, final export before the first periodic tick, success/error flags, distinct span IDs, exact trace IDs, services, parent relationships, and no second export after repeated telemetry cleanup.

  • Monolithic drain coverage uses a real WorkflowRunner blocked in a fake OPMS poll, not end-to-end action execution. The complete runner Stop method is not made idempotent.

  • All four package targets passed on the final test revision. Focused race tests passed three repetitions and lint reported zero issues. Buildifier and git diff --check passed.

  • Earlier validation attempts encountered a dependency-download timeout and Bazel crash; subsequent runs passed. Host Go version warning remains (1.27.3 versus tooling expectation 1.26.10).
  • Additional Notes

  • Independent of the phone-home PR stack. No Rust instrumentation, IPC changes, broader tracer refactoring, or new dependencies.

  • Preserves monolithic behavior and existing telemetry policy, span fields, sampling, and GovCloud handling.

  • Delivery remains best-effort: failed HTTP sends and forced termination are not made durable.

  • Both dedicated Linux comparison VMs run the original fix build 05e5951, not the shared-helper follow-up 558fa1a. Host and backend logs confirm successful rshell tasks in both modes, and split executor on-demand startup and graceful idle exit. The operator reports traces visible in the UI; exact trace inspection for correlation/no-duplication remains pending.

  • Draft pending CI and completion of packaged-binary QA, including the updated build and Windows.
  • Diff: 464 lines (+348 / -116) across 5 files Reviewer: dd-gplassard Review duration: 524m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 464 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.367
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #58767"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.6% (MEDIUM) · Higher = larger blast radius
    45.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18% · Safe to merge
    18%