feat(telemetry): per-stage review spans for stage-level observability - #103
Merged
Conversation
Make `ReviewTelemetry.span` context-propagating (start_as_current_span) so nested spans form a real trace tree, and wrap each worker stage in a child span under llm_review.run: checkout, provenance, agent, post. The agent span carries token/cost/exit attributes; the post span carries posted/planned/ skipped counts. New `set_span_attrs` helper. No new dependency and a no-op when telemetry is off — Bubo emits richer observability *data* (latency/tokens/cost by stage + model) for any OTel backend to consume; it doesn't ship a dashboard. Adds an in-memory-exporter test asserting child-of-run nesting + attributes; docs/telemetry.md gains a span-tree section.
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.
Makes bubo emit richer observability data, not an observability tool — exactly the ask: bubo provides the metrics/traces; you bring Prometheus/Grafana/Tempo/Honeycomb/whatever.
What
Each review is one trace.
llm_review.runnow has a child span per stage, so a trace shows where the wall-clock actually went (spoiler: it's the agent, not bubo):So any OTel backend can break latency, tokens, and cost down by stage and by model without bubo shipping a dashboard.
How
ReviewTelemetry.spannow usesstart_as_current_span, so nestedspan()calls become real children (wasstart_span, which left them as siblings). Disabled-noop and exception-propagation behavior preserved.set_span_attrs(span, **attrs)helper (mirrorsadd_event).Verify
416 tests pass, incl. a new in-memory-exporter test asserting the agent span is a child of the run span and carries its attributes. ruff + mypy +
mkdocs --strictclean;czvalid; no footer.docs/telemetry.mdgains a span-tree section.Note: trivial CHANGELOG
[Unreleased]overlap with the open docs PR #100 — keep both bullets.