Emit per-test-target OTel spans with test status in BES tracing sink - #1369
Emit per-test-target OTel spans with test status in BES tracing sink#1369thesayyn wants to merge 2 commits into
Conversation
The Bazel BES→OTel tracing sink only spanned the `action` events (the TestRunner spawn, which reports the spawn's exit code — 0 for a spawn that merely executed) and dropped `TestSummary`/`TestResult` via the catch-all arm. Failing tests were therefore invisible in OTel: every TestRunner span carried exit_code 0 and no error status. Add dedicated spans: - `test` (from TestSummary): the authoritative per-target outcome, carrying the BlazeTestStatus, run/shard/attempt counts, cached count, real wall-clock timing (first_start_time..last_stop_time), and otel.status_code=error on FAILED/TIMEOUT/FAILED_TO_BUILD/REMOTE_FAILURE/ TOOL_HALTED_BEFORE_TESTING. - `test_attempt` (from TestResult): per shard/run/attempt status + timing. Also set otel.status_code on failed `action` spans, and record every other BES event kind as a lightweight `bes_event` span-event (the high-volume Progress and NamedSetOfFiles streams are intentionally skipped) so no meaningful build event is silently dropped.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b84c5ecae
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
✨ Aspect Workflows Tasks📅 Tue Aug 4 21:08:23 UTC 2026 ❌ 4 failed tasks
|
TestSummary/TestResult spans read only the modern `first_start_time`/ `last_stop_time`/`test_attempt_start`/`test_attempt_duration` Timestamp fields, falling back to `SystemTime::now()` (or zero duration) when they were absent. Older Bazel versions and cached summaries populate only the deprecated `*_millis` fields, so those spans were exported at consume time rather than the real test window. Prefer the modern Timestamp, then the deprecated millis field (converted to seconds, matching the OTel layer's `otel.start_time`/`otel.end_time` seconds contract), then `now`/zero as a last resort.
|
|
The BES→OTel tracing sink only spanned
actionevents (the TestRunner spawn, which reports the spawn's exit code — 0 for a spawn that merely ran) and droppedTestSummary/TestResultvia the catch-all arm. Failing tests were invisible in OTel: every TestRunner span carriedexit_code=0and no error status.Changes (
crates/axl-runtime/src/engine/bazel/sink/tracing.rs):testspan fromTestSummary— the authoritative per-target outcome:status(BlazeTestStatus), run/shard/attempt counts, cached count, real wall-clock timing, andotel.status_code=erroron FAILED/TIMEOUT/FAILED_TO_BUILD/REMOTE_FAILURE/TOOL_HALTED_BEFORE_TESTING.test_attemptspan fromTestResult— per shard/run/attempt status + timing.otel.status_codeon failedactionspans.bes_eventspan-event (high-volumeProgress/NamedSetOfFilesintentionally skipped) so nothing is silently dropped.Unit tests cover the status→span-status mapping.
🤖 Generated with Claude Code
Generated by Claude Code