feat(otel): emit runner client spans (RIG-2890) - #714
Open
rigel-mintaka wants to merge 2 commits into
Open
Conversation
|
Compass engineering docs preview: https://compass-obs-rig-2890-runner.compass-eng-docs.pages.dev Deployed from |
Wire OTel emission into the compass-runner binary and its outbound RunnerService client (T4b T3). Endpoint is env-only (`OTEL_EXPORTER_OTLP_ENDPOINT`); empty = tracing off. - **cmd/compass-runner:** bootstrap `SetupTracerProvider`/`SetupMeterProvider` off `RunnerConfig.OtelEndpoint` (populated from the env knob via a `setupOtel` helper), defer the combined shutdown before `runner.Run`. - **runner.go:** prepend the `otelconnect` client interceptor (outermost, ahead of the bearer-token interceptor) on `NewRunnerServiceClient` so enroll and Sessions dials emit CLIENT spans; a no-op when no global provider is installed. Rides the `connectrpc.com/otelconnect v0.9.0` dep added by the T2 base commit (RIG-2889). Spec-impact: none. Refs RIG-2890. Co-authored-by: Matt Wilkinson <matt@rigel.build>
…IG-2890) Review round 1 on PR #714. ### M2 — dead, misleading `RunnerConfig.OtelEndpoint` The field was write-only: `main.setupOtel` already installs and gates the global provider (that IS the enable gate), and `Dial` mounts the otelconnect interceptor unconditionally — no runner-package code ever read the field. Its doc comment nonetheless claimed it "gates whether this Runner exports OTel data", a false invariant for the next maintainer. Removed the field, the `OtelEndpoint:` set at the call site, and `setupOtel`'s now-unused endpoint return (it returns only the shutdown). The tautological `TestRunnerConfigOtelEndpointFromEnv` (asserted a struct field equals what it was just assigned — L2) is deleted; the enabled/disabled span tests already cover the real env → provider gate. ### M3 — shutdown flush dropped on graceful drain `setupOtel`'s combined shutdown ran `tracerShutdown`/`meterShutdown` with the signal-derived `ctx`, already cancelled by the time the defer fires, so the SDK `Shutdown` aborted its final `ForceFlush` and dropped the last buffered batch — the same defect the sibling server bootstrap carried. The shutdown now derives a fresh `context.WithTimeout(context.WithoutCancel(ctx), 2*time.Second)` at fire time (not at bootstrap, where an absolute deadline would expire mid-run), matching the `context.WithoutCancel` precedent already in `internal/runner/run.go` and the frozen design's 2s bound. Spec-impact: none. Refs RIG-2890 Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
force-pushed
the
compass-obs/rig-2890-runner-emission
branch
from
August 28, 2026 05:44
2bd0b92 to
e6badb1
Compare
rigel-mintaka
marked this pull request as ready for review
August 28, 2026 05:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a stack containing 2 PRs:
mainWire OTel emission into the compass-runner binary and its outbound RunnerService client (T4b T3). Endpoint is env-only (
OTEL_EXPORTER_OTLP_ENDPOINT); empty = tracing off.SetupTracerProvider/SetupMeterProvideroffRunnerConfig.OtelEndpoint(populated from the env knob via asetupOtelhelper), defer the combined shutdown beforerunner.Run.otelconnectclient interceptor (outermost, ahead of the bearer-token interceptor) onNewRunnerServiceClientso enroll and Sessions dials emit CLIENT spans; a no-op when no global provider is installed.Rides the
connectrpc.com/otelconnect v0.9.0dep added by the T2 base commit (RIG-2889).Spec-impact: none. Refs RIG-2890.
Co-authored-by: Matt Wilkinson matt@rigel.build