Phase 14: OTel GenAI alignment and LLM call recording - #19
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-classllmblock (model, tokens, cost, latency, finish_reason)OTLPTransportexports agent tracing as real OTel spans, with proper span naming and GenAI attributes per the conventionsOTelLogsTransportsends every record as OTLP log records, joinable by trace/span id with spansspan(capture_state=...)snapshots state before/after and records what changed asmeta.state_diffmeta.retry_countstamping for repeated tool calls before successlogquill/semconv.pycentralizes GenAI attribute names, pinned to semantic-conventions 1.44.0;semconv_version="legacy"andOTEL_SEMCONV_STABILITY_OPT_INenv var select naming generationsNew optional fields in record
meta:tool,tool_call_id,provider,agent_name,agent_id,response_model,operation(chat/text_completion/invoke_agent), and opt-ininput_messages/output_messages.Documentation, schema updates, and comprehensive tests included.
Summary
Checklist
ruff check .passesmypy logquillpasses (--stricton the public API)pytestpasses, and new surface area has test coverageREADME.mdwith a runnable exampleCHANGELOG.mdhas an entry underUnreleasedrecord shape, transport/plugin contracts, config shape) shared with
logquill-js, a matching tracking issue/PR is opened thereScope