Conversation
…reference Add sampling strategy reference for gen_ai spans (JS + Python) covering: - Head-based sampling gotcha (root-only, children inherit) - tracesSampler patterns for both standalone agents and HTTP-child scenarios - Metrics/logs fallback for when 100% tracing isn't feasible - Cost comparison and troubleshooting Also adds: - Node.js ai-monitoring.md reference (was missing, Python/Next.js/NestJS had one) - Sampling check + user prompt to SKILL.md detection flow - Sampling cross-links to Python, Next.js, and NestJS references Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- sampling.md: 242 → 78 lines. Removed 4 redundant code blocks (JS+Python metrics+logs shown separately), consolidated into one Python example + note that JS uses same pattern. Removed comparison table. - ai-monitoring.md (Node): 341 → 95 lines. Removed per-integration setup/wrapping/streaming sections, consolidated into single setup block with important notes callout. - Updated model names from gpt-4o to claude-sonnet-4-6. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Match Python SDK reference structure: add Integration Matrix with min library versions, Configuration Examples (auto + explicit + Vercel AI + browser), 4 manual instrumentation examples (chat, invoke_agent, execute_tool, handoff), Span Attribute Reference tables, Agent Workflow Hierarchy diagram, Streaming compatibility table. Updated model names. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lists providers without auto-instrumentation in Node (Pydantic AI, OpenAI Agents SDK, HuggingFace Hub, MCP are Python-only; Cohere, Bedrock, Mistral, Groq need manual spans in both). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pydantic AI, OpenAI Agents SDK, HuggingFace Hub are Python libraries - not relevant to Node developers. MCP is a separate product with its own docs. Keep only providers a Node developer might actually encounter: Cohere, Bedrock, Mistral, Groq. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
obostjancic
approved these changes
Mar 31, 2026
Comment on lines
+134
to
+144
| ### `gen_ai.handoff` - Agent-to-agent transition | ||
|
|
||
| ```typescript | ||
| await Sentry.startSpan({ | ||
| op: "gen_ai.handoff", | ||
| name: "handoff Billing → Refund Agent", | ||
| attributes: { "gen_ai.agent.name": "Refund Agent" }, | ||
| }, async (span) => { | ||
| return await refundAgent.run(context); | ||
| }); | ||
| ``` |
Member
There was a problem hiding this comment.
We plan to remove this span type in the future so we should probably omit it here.
Suggested change
| ### `gen_ai.handoff` - Agent-to-agent transition | |
| ```typescript | |
| await Sentry.startSpan({ | |
| op: "gen_ai.handoff", | |
| name: "handoff Billing → Refund Agent", | |
| attributes: { "gen_ai.agent.name": "Refund Agent" }, | |
| }, async (span) => { | |
| return await refundAgent.run(context); | |
| }); | |
| ``` |
|
|
||
| ```typescript | ||
| await generateText({ | ||
| model: openai("claude-sonnet-4-6"), |
Member
There was a problem hiding this comment.
Suggested change
| model: openai("claude-sonnet-4-6"), | |
| model: openai("gpt-5.4"), |
Member
Author
There was a problem hiding this comment.
omg 🤦 they are really missing out on something like this https://community.openai.com/t/introducing-codex-plugin-for-claude-code/1378186 😂
- Remove gen_ai.handoff example (planned for deprecation per @obostjancic) - Fix openai("claude-sonnet-4-6") → openai("gpt-4.1") (wrong provider/model combo) - Remove handoff from span hierarchy diagram Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gen_ai.chat is an internal SDK op. The docs document gen_ai.request for manual instrumentation. Fixed all code examples and span hierarchy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
sentry-setup-ai-monitoring/references/sampling.mdwith gen_ai span sampling strategies for JS + Pythonsentry-node-sdk/references/ai-monitoring.md(was missing, Python/Next.js/NestJS already had one)sentry-setup-ai-monitoring/SKILL.mdwith sampling rate detection + user promptWhat the sampling reference covers
tracesSampler(JS) andtraces_sampler(Python) patternsWhat the Node.js reference covers
gen_ai.*span instrumentationIS YOUR CHANGE URGENT?
🤖 Generated with Claude Code