Skip to content

Add support for traces exported from Tempo#129

Merged
krisztianfekete merged 2 commits intomainfrom
fix/better-json-format-support
Apr 30, 2026
Merged

Add support for traces exported from Tempo#129
krisztianfekete merged 2 commits intomainfrom
fix/better-json-format-support

Conversation

@krisztianfekete
Copy link
Copy Markdown
Contributor

@krisztianfekete krisztianfekete commented Apr 30, 2026

This PR fixes the offline-eval crash on Tempo/OTLP .json uploads and cleans up the codebase to auto-detect trace formats instead of defaulting to Jaeger.

  • Auto-detecting loader. New loader/auto.py with load_traces / detect_format sniffs JSON top-level keys and dispatches; --format and trace_format defaults flipped from "jaeger-json" to None (auto), override still works.
  • OTLP loader accepts Tempo shapes. batches, instrumentationLibrarySpans, instrumentationLibrary, and the Tempo v2 {"trace": {...}} envelope all parse correctly.
  • ADK detection is more forgiving. is_adk_scope now also matches gen_ai.system == "gcp.vertex.agent" and gcp.vertex.agent.* custom attrs; new has_adk_descendant recovers invoke_agent parents whose markers got dropped on export.
  • Frontend handles all formats. loadJaegerTraces -> loadTraces, trace dropzones accept .json,.jsonl, defensive guard around result.traceResults.map so malformed SSE payloads surface a real error. We will be removing this duplicated trace parsing in a follow-up PR, see Eliminate duplicated trace parsing between frontend and backend #130

Fixes #127

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds end-to-end support for Tempo-exported OTLP trace uploads by switching the backend (and parts of the UI) to content-based trace-format auto-detection, expanding OTLP shape compatibility, and hardening the offline-eval UI path.

Changes:

  • Add an auto-detecting trace loader (load_traces / detect_format) and flip defaults so trace format is inferred unless explicitly overridden.
  • Expand OTLP parsing to accept Tempo v1/v2 export shapes and improve ADK span detection/recovery for Tempo-compacted traces.
  • Update the UI to accept .json and .jsonl trace uploads, use the unified loader, and guard against malformed SSE completion payloads.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui/src/lib/trace-loader.ts Replaces Jaeger-default parsing with loadTraces() auto-detection for Jaeger JSON, OTLP JSON, Tempo wrappers, and OTLP JSONL.
ui/src/context/TraceProvider.tsx Prevents offline-eval crash by guarding traceResults.map and normalizing error handling.
ui/src/components/upload/UploadView.tsx Allows .json,.jsonl trace uploads in the offline-eval upload view.
ui/src/components/upload/TraceEditorDrawer.tsx Switches editor parsing to loadTraces() to support non-Jaeger formats.
ui/src/components/builder/TraceUploadZone.tsx Updates UI text to reflect .json/.jsonl trace support.
ui/src/api/client.ts Removes explicit trace_format form field from convert calls (backend auto-detects).
tests/test_otlp_loader.py Adds regression coverage for Tempo v1/v2 OTLP export shapes and a real Tempo fixture.
tests/test_loader_auto.py New tests for loader auto-detection and load_traces dispatch behavior.
tests/test_extraction.py Adds ADK marker fallbacks and subtree recovery tests for Tempo-compacted traces.
tests/test_converter.py Adds integration test covering load→detect→convert on the real Tempo fixture.
tests/test_api.py Updates streaming tests to patch load_traces; adds /convert auto-detect API regression tests.
src/agentevals/runner.py Uses unified load_traces() instead of a per-format loader factory.
src/agentevals/mcp_server.py Makes trace_format optional and updates docs to reflect auto-detection.
src/agentevals/loader/otlp.py Extends OTLP loader to support batches, instrumentationLibrarySpans, and Tempo v2 wrapper.
src/agentevals/loader/auto.py Introduces content-based format detection and unified file-loading entrypoint.
src/agentevals/loader/init.py Exposes auto-loader entrypoints and constants at the package level.
src/agentevals/extraction.py Broadens ADK detection signals and adds has_adk_descendant recovery.
src/agentevals/eval_config_loader.py Adjusts config merging for optional trace_format (None = auto).
src/agentevals/converter.py Reuses ADK detection helpers and recovers invoke_agent via ADK-instrumented descendants.
src/agentevals/config.py Makes trace_format optional and updates config descriptions for auto-detection.
src/agentevals/cli.py Makes --format optional and constrains overrides to known formats.
src/agentevals/api/routes.py Switches /convert and streaming paths to use load_traces() auto-detection.
samples/tempo_export_with_batches.json Adds a real Tempo export fixture used by regression/integration tests.
docs/streaming.md Updates documentation to reflect auto-detected Jaeger vs OTLP loading behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/agentevals/loader/auto.py Outdated
Comment thread ui/src/lib/trace-loader.ts Outdated
@krisztianfekete krisztianfekete merged commit da3ca5e into main Apr 30, 2026
5 checks passed
@krisztianfekete krisztianfekete deleted the fix/better-json-format-support branch April 30, 2026 14:52
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.

UI offline evaluation mishandles OTLP JSON/JSONL traces and crashes with Cannot read properties of undefined (reading 'map')

2 participants