Skip to content

Phase 14: OTel GenAI alignment and LLM call recording - #19

Merged
nikhilvdev merged 1 commit into
mainfrom
feat/phase-14-otel-genai
Sep 26, 2026
Merged

nikhilvdev merged 1 commit into
mainfrom
feat/phase-14-otel-genai

Conversation

@nikhilvdev

Copy link
Copy Markdown
Owner

Implements Phase 14 of the 2.0 roadmap: OpenTelemetry GenAI semantic-convention support and structured LLM call tracking.

New features:

  • logger.llm_call() records LLM calls with a first-class llm block (model, tokens, cost, latency, finish_reason)
  • OTLPTransport exports agent tracing as real OTel spans, with proper span naming and GenAI attributes per the conventions
  • OTelLogsTransport sends every record as OTLP log records, joinable by trace/span id with spans
  • span(capture_state=...) snapshots state before/after and records what changed as meta.state_diff
  • Automatic meta.retry_count stamping for repeated tool calls before success
  • logquill/semconv.py centralizes GenAI attribute names, pinned to semantic-conventions 1.44.0; semconv_version="legacy" and OTEL_SEMCONV_STABILITY_OPT_IN env var select naming generations
  • Type-checking no longer requires OpenTelemetry installed

New optional fields in record meta: tool, tool_call_id, provider, agent_name, agent_id, response_model, operation (chat/text_completion/invoke_agent), and opt-in input_messages/output_messages.

Documentation, schema updates, and comprehensive tests included.

Summary

Checklist

  • ruff check . passes
  • mypy logquill passes (--strict on the public API)
  • pytest passes, and new surface area has test coverage
  • Public API additions are documented in README.md with a runnable example
  • CHANGELOG.md has an entry under Unreleased
  • If this touches the cross-language contract (levels, logger methods,
    record shape, transport/plugin contracts, config shape) shared with
    logquill-js, a matching tracking issue/PR is opened there

Scope

Implements Phase 14 of the 2.0 roadmap: OpenTelemetry GenAI semantic-convention support and structured LLM call tracking.

New features:
- `logger.llm_call()` records LLM calls with a first-class `llm` block (model, tokens, cost, latency, finish_reason)
- `OTLPTransport` exports agent tracing as real OTel spans, with proper span naming and GenAI attributes per the conventions
- `OTelLogsTransport` sends every record as OTLP log records, joinable by trace/span id with spans
- `span(capture_state=...)` snapshots state before/after and records what changed as `meta.state_diff`
- Automatic `meta.retry_count` stamping for repeated tool calls before success
- `logquill/semconv.py` centralizes GenAI attribute names, pinned to semantic-conventions 1.44.0; `semconv_version="legacy"` and `OTEL_SEMCONV_STABILITY_OPT_IN` env var select naming generations
- Type-checking no longer requires OpenTelemetry installed

New optional fields in record `meta`: `tool`, `tool_call_id`, `provider`, `agent_name`, `agent_id`, `response_model`, `operation` (chat/text_completion/invoke_agent), and opt-in `input_messages`/`output_messages`.

Documentation, schema updates, and comprehensive tests included.
@nikhilvdev
nikhilvdev merged commit d2219f4 into main Sep 26, 2026
7 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.

1 participant