Skip to content

tracing: record decisions content under the GenAI convention - #2845

Open
sqaisar wants to merge 1 commit into
theagentrouter:mainfrom
pypestream:sqaisar/decisions-genai-content-upstream
Open

sqaisar wants to merge 1 commit into
theagentrouter:mainfrom
pypestream:sqaisar/decisions-genai-content-upstream

Conversation

@sqaisar

@sqaisar sqaisar commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Description

With AI_GATEWAY_TRACING_SEMCONV=gen_ai and OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true, /v1/decisions spans record only operation, model and usage: NewDecisionsRecorder sets requestModel and responseAttrs but none of the content hooks, so GenAI-convention backends show the span without input or output. The OpenInference recorder already records both for this endpoint.

This wires inputMessages, systemInstructions and outputMessages for decisions, gated by the existing capture setting:

  • input to gen_ai.input.messages: a string becomes one user message; user messages keep input_text as text parts and record input_image as an image part without the payload, the same as chat completions.
  • questions to gen_ai.system_instructions, one JSON text part per question. They are the instructions the model evaluates the input against, provided separately from it, which is what the attribute describes.
  • answers to gen_ai.output.messages, one assistant message with a JSON text part per answer, since the conventions define no part type for typed decision answers.

The tracing doc's list of endpoints with mapped content now includes decisions.

Related Issues/PRs (if applicable)

Related PR: #2819

Special notes for reviewers (if applicable)

The endpoint coverage table in coverage_test.go is updated for decisions. Tests cover string, message, image and malformed input, questions, answers, and capture on and off.

I used AI assistance while writing this change and have reviewed and tested it.

Map the Decisions input, questions and answers to gen_ai.input.messages, gen_ai.system_instructions and gen_ai.output.messages when message content capture is enabled.

Signed-off-by: Shabab Qaisar <sqaisar@pypestream.com>
@sqaisar
sqaisar requested a review from a team as a code owner October 13, 2026 07:20
@netlify

netlify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for theagentrouter ready!

Name Link
🔨 Latest commit b2ce3b6
🔍 Latest deploy log https://app.netlify.com/projects/theagentrouter/deploys/6acddbcbc726701cf4e37a7a
😎 Deploy Preview https://deploy-preview-2845--theagentrouter.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.47826% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/tracing/otelgenai/decisions.go 93.02% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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