Skip to content

Add GenAI OpenTelemetry-convention agent tracing#246

Merged
JE-Chen merged 1 commit into
devfrom
feat/agent-trace-batch
Jun 19, 2026
Merged

Add GenAI OpenTelemetry-convention agent tracing#246
JE-Chen merged 1 commit into
devfrom
feat/agent-trace-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

Agent observability batch. Full layers + tests + EN/Zh v38 docs + README.

Feature (utils/agent_trace, pure-stdlib, no opentelemetry dep)

  • AgentTrace records spans whose attributes follow the OpenTelemetry GenAI semantic conventions (gen_ai.operation.name, gen_ai.system, gen_ai.request.model, gen_ai.usage.input_tokens/output_tokens, gen_ai.tool.name) and the convention span name "{operation} {model}". record(...) one-shots a completed call; operation(...) is a context manager that times a live block and marks the span error on exception. summary() rolls up span/error count + token usage + duration; to_otel() exports OTLP-friendly span dicts. Clock injectable → deterministic durations.
  • Pairs with trajectory evaluation (Add agent trajectory evaluation against declarative rubrics #244): record the run here, score it there.
  • A module-level default_trace backs AC_trace_record / AC_trace_summary / AC_trace_export / AC_trace_reset (+ ac_*, Builder under Agent).

Verification

  • 9 tests pass (GenAI attributes, summary aggregation, context-manager timing via injected clock, error marking, to_otel shape, reset, executor round-trip, wiring, facade); ruff clean; radon no CC≥C; bandit clean; PySide6-free.
  • Stacked on compliance (Add SOC2/ISO 27001 compliance control evidence report #245); rebased cleanly onto dev.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 47 complexity · 0 duplication

Metric Results
Complexity 47
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 8953cd3 into dev Jun 19, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/agent-trace-batch branch June 19, 2026 15:29
@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