Skip to content

fix(tracing): keep span events and status messages; judge summary keeps every attribute - #144

Merged
SushantGautam merged 2 commits into
devfrom
fix/otlp-events-judge-budget
Nov 6, 2026
Merged

SushantGautam merged 2 commits into
devfrom
fix/otlp-events-judge-budget

Conversation

@SushantGautam

Copy link
Copy Markdown
Collaborator

Two tracing gaps found while auditing Open WebUI agents from SimpleAudit Studio.

1. OTLP parsing dropped span events and status messages

parse_otlp_json (JSON) and _spans_from_otlp_dict (gRPC/protobuf) kept only the status code. OpenTelemetry records why a span failed in its exception event (exception.type, exception.message) and in the status message, so neither the store nor the judge could see the reason.

  • Spans now carry status_message and events ([{name, time, attributes}]) when present. Spans without them are unchanged (no new keys).
  • normalize_span passes both through.

2. summarize_for_judge cut spans from the front

Each span's attribute JSON was cut at max_chars_per_span (2,000). A model call's long gen_ai.input.messages history therefore pushed later attributes, such as gen_ai.output.messages (what the model decided or answered), out of the judge's view.

  • Long values are now shortened first: max_chars_per_value (default 600), halved until the span fits, down to 80 characters. Every attribute stays visible, and the old end-cut is only the last resort.
  • A failed span shows status: ERROR — <message> and exception: <type>: <message> lines.
  • The signature is backwards compatible: max_chars_per_span is unchanged and max_chars_per_value is a new keyword argument.

Tests

4 new tests in tests/test_tracing.py: events and status message parsed, no new keys without them, values shortened with every attribute kept, failure lines rendered.

Full suite: 1933 passed (base 1929). The same 10 tests fail with and without this change in my environment. They bind a local OTLP receiver (test_ephemeral_receiver_*, test_shared_receiver_*, test_audit_with_tracing_*, test_otlp_auth::test_ephemeral_receiver_basic_auth_401_and_200).

Studio already works around both gaps (it copies exception attributes before parsing and pre-trims the spans it hands to the judge); this fixes them at the source.

…ps every attribute

parse_otlp_json and the protobuf path dropped span events and the status
message, so why a span failed (OpenTelemetry records exceptions as an
'exception' event) never reached the store or the judge. Both are now kept
(status_message, events) and pass through normalize_span.

summarize_for_judge cut each span's JSON at 2,000 characters from the front, so
a long input history pushed later attributes such as the model output out of
view. It now shortens long values first (max_chars_per_value, halved until the
span fits) so every attribute stays visible, and shows a failed span's status
message and exception.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Resolve summarize_for_judge: keep per-value shortening and failure lines
from this branch, and redact attributes and failure text as dev does.
@SushantGautam
SushantGautam merged commit d8b90ef into dev Nov 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants