Skip to content

Add OTLP/JSON span export#302

Merged
JE-Chen merged 1 commit into
devfrom
feat/otlp-export-batch
Jun 21, 2026
Merged

Add OTLP/JSON span export#302
JE-Chen merged 1 commit into
devfrom
feat/otlp-export-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

agent_trace.to_otel returned flat span dicts that aren't valid OTLP/JSON (no resourceSpans/scopeSpans nesting, no proper attribute encoding, times not as uint64 strings).

  • spans_to_otlp(spans, *, resource_attrs, scope_name, scope_version) → the resourceSpans → scopeSpans → spans envelope; hex IDs, uint64-string times, OTLP KeyValue attributes.
  • attributes_to_otlp(dict) → OTLP KeyValue list (string/int/bool/double).
  • write_otlp(payload, path).

Pairs with trace_context (IDs) and agent_trace (span data).

Layers

  • Headless core: utils/otlp_export/ (pure stdlib json, zero PySide6).
  • Facade: 3 symbols + __all__.
  • Executor: AC_spans_to_otlp.
  • MCP: ac_spans_to_otlp (read-only).
  • Script Builder: under Report.
  • Tests: test/unit_test/headless/test_otlp_export_batch.py (8 tests).
  • Docs: v94_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest test/unit_test/headless/test_otlp_export_batch.py → 8 passed.
  • ruff check je_auto_control/ clean; pylint 10.00/10; bandit clean; radon CC clean.
  • Package stays Qt-free.

agent_trace.to_otel returned flat span dicts that are not valid OTLP/JSON
(no resourceSpans/scopeSpans nesting, no proper attribute encoding, times
not as uint64 strings). Add spans_to_otlp / attributes_to_otlp / write_otlp
to shape spans into the envelope an OpenTelemetry collector ingests via its
file exporter (hex ids, uint64-string times, KeyValue attributes). Wired
through facade, executor (AC_spans_to_otlp), MCP, and the Script Builder
with a headless test batch and EN/Zh docs.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 28 complexity · 0 duplication

Metric Results
Complexity 28
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit b39a604 into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/otlp-export-batch branch June 21, 2026 19:46
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant