Skip to content

feat(attributes): Add gen_ai conversation compaction conventions - #723

Draft
cleptric wants to merge 3 commits into
mainfrom
feat/gen-ai-conversation-compacted
Draft

cleptric wants to merge 3 commits into
mainfrom
feat/gen-ai-conversation-compacted

Conversation

@cleptric

@cleptric cleptric commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Adds conventions for tracing GenAI conversation context compaction:

  • gen_ai.compact span op and a new well-known gen_ai.operation.name value compact, for the operation that compacts a conversation's context (for example, summarizing earlier messages to fit the context window). Neither is in OpenTelemetry. The op also gets "Compaction" span name and description groups, and gen_ai.operation.type documents that compact spans map to other.
  • gen_ai.conversation.compaction.reason (string, Sentry-specific) is set on the gen_ai.compact span and records what triggered it, for example manual, threshold or overflow.
  • gen_ai.conversation.compacted (boolean, from the OpenTelemetry definition) is set on later requests that run on the compacted context. Instrumentations set it to true only when compaction was reliably applied and leave it unset otherwise, never false.

The resulting trace shape is a gen_ai.compact span with gen_ai.conversation.compaction.reason, its child gen_ai.chat span(s) for the model request that writes the summary, and later gen_ai.chat spans with gen_ai.conversation.compacted. Sentry's coding-agent tracing emits this shape.

Relay currently infers gen_ai.operation.type ai_client for unknown operation names, so it needs a follow-up to map compact to other.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-conventions Ready Ready Preview Oct 15, 2026 11:45am UTC

Request Review

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Attributes

  • Add gen_ai conversation compaction conventions by cleptric in #723
  • Add http.request.duration by loewenheim in #697

Other

  • (names) Add queue.publish/create/receive/process/settle to messaging span names by pabloDeputter in #705

Bug Fixes 🐛

  • (attributes) Apply consistent scrubbing across deprecations by mjq in #692

Internal Changes 🔧

  • (repo) Update CODEOWNERS to include @giortzisg by Lms24 in #708

🤖 This preview updates automatically when you update the PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cleptric cleptric changed the title feat(attributes): Add gen_ai.conversation.compacted attribute feat(attributes): Add gen_ai conversation compaction attributes Oct 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cleptric cleptric changed the title feat(attributes): Add gen_ai conversation compaction attributes feat(attributes): Add gen_ai conversation compaction conventions Oct 15, 2026

This branch was successfully deployed

1 active deployment
Preview — 10b1d657 Deployed Oct 15, 2026 by vercel[bot]
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