Skip to content

New span source: ingest nested OTLP resourceSpans/scopeSpans exports #11

Description

@bamdadd

Ingest today (src/taintline/ingest.py, _parse_otlp) expects a flat JSON list of span dicts with camelCase keys. Real OTLP JSON exporters (the OpenTelemetry Collector file exporter, otlp/json) emit the nested envelope resourceSpans[].scopeSpans[].spans[], where each spans entry carries spanId/parentSpanId as hex strings and attributes as an array of {key, value:{stringValue|intValue|boolValue|...}} objects rather than a flat map. taintline cannot read those exports as-is. Ingest stays pure and deterministic: no network, clock, or RNG.

Acceptance criteria

  • load_trace auto-detects the nested OTLP envelope (by structure) and flattens resourceSpans[].scopeSpans[].spans[] into the existing normalized Span/Trace types with no changes to model.py.
  • OTLP attributes key/value arrays (including stringValue, intValue, boolValue, arrayValue) are decoded into the flat attributes dict so the existing gen_ai.* key lookups keep working; typed helpers, mypy strict, no loose Any-soup.
  • Existing flat-list and Strands inputs still parse unchanged (open-closed: add a branch, do not rewrite the current paths).
  • A portability fixture under tests/fixtures/portability/ holds a small real-shaped nested OTLP export and a test asserts the same Verdict the flat form would produce. Domain-neutral tool names.
  • Determinism preserved: same file -> byte-identical Trace/Verdict across runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: llmLarge language modelshelp wantedBigger but contributor-ready, well-specifiedsize: MA few daystype: featureNew capability

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions