- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.6k
docs(js): Update span metrics instrumentation examples #15320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| The latest updates on your projects. Learn more about Vercel for GitHub. 
 | 
        
          
                docs/platforms/javascript/common/tracing/span-metrics/examples.mdx
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                docs/platforms/javascript/common/tracing/span-metrics/examples.mdx
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                docs/platforms/javascript/common/tracing/span-metrics/examples.mdx
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | Bundle ReportChanges will increase total bundle size by 293.61kB (1.27%) ⬆️. This is within the configured threshold ✅ Detailed changes
 Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-server-cjsAssets Changed:
 view changes for bundle: sentry-docs-client-array-pushAssets Changed:
 | 
- Add four comprehensive real-world examples with sample repositories - E-Commerce Checkout Flow (Crash Commerce) - Media Upload with Background Processing (SnapTrace) - Search Autocomplete (NullFlix) - Manual LLM Instrumentation (Customer Service Bot) - Fix high-cardinality span name in payment processing - Add missing gen_ai.response.model attribute to AI agent span - Include implementation guidance and monitoring recommendations
- Fix duplicate finalResponse declaration (line 719) - Fix undefined uploadId reference, use uploadData.jobId instead (line 224) - Fix function name mismatch, call searchKnowledgeBase instead of executeKnowledgeBaseSearch (line 708)
- Serialize processing.operations array with JSON.stringify() - Ensures proper attribute serialization in Sentry spans - Follows Sentry conventions for non-primitive span attributes
File Upload Example: - Use proper queue operations (queue.publish/queue.process) - Add queue instrumentation attributes (messaging.*) - Implement trace continuation with continueTrace() - Link to Queues Module documentation - Align span names with queue docs pattern (queue_producer/queue_consumer) Search Autocomplete Example: - Change manual span from http.client to function op - Let SDK auto-instrument fetch requests - Don't re-throw AbortError to avoid sending to Sentry - Return empty results on abort instead LLM Example: - Add link to AI Agents Module documentation - Reference gen_ai attribute specifications All changes follow Sentry's documented conventions and patterns.
Remove ✨ and ❌ emoji characters from code examples that were causing 'InvalidCharacterError: Failed to execute atob' errors in docs. The atob function only supports Latin1 (ISO-8859-1) characters, and emojis are outside that range, causing encoding issues during page rendering.
Replace em dashes (—) with hyphens (-) and arrows (→) with (->) These Unicode characters were causing 'atob' encoding errors: 'InvalidCharacterError: Failed to execute atob on Window' The atob function only supports Latin1 (ISO-8859-1) characters. All special Unicode characters have been replaced with ASCII equivalents.
bb9db67    to
    d566a17      
    Compare
  
    The high-cardinality fix was reverted during rebase.
Changed back from template literal to static name:
- name: 'Charge Payment Provider' (not `Charge ${requestedProvider}`)
    This attribute was lost during the rebase and needs to be present in the frontend invoke_agent span for proper AI monitoring.
Replace 'Coming soon' with link to actual example repository: https://github.com/getsentry/llm-manual-agent-monitoring-example This repo demonstrates custom AI agent instrumentation with tool calls, token tracking, and conversation monitoring.
| Semgrep found 1  Risk: Affected versions of next are vulnerable to Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling'). A vulnerability in Next.js can enable an attacker to poison the cache. Under certain conditions, a HTTP 204 response may be cached for static pages, causing all subsequent requests to receive an empty response and effectively leading to a Denial of Service condition. Manual Review Advice: A vulnerability from this advisory is reachable if you are using ISR with cache revalidation (in next start or standalone mode), and route using SSR, and you are not hosting on Vercel Fix: Upgrade this library to at least version 15.1.8 at sentry-docs/pnpm-lock.yaml:6643. Reference(s): GHSA-67rr-84xm-4c7r, CVE-2025-49826 | 
Overview
Updates the span metrics instrumentation examples page with comprehensive, real-world use cases demonstrating how to instrument both frontend and backend code for distributed tracing.
What's New
Four Complete Examples with Sample Repositories
E-Commerce Checkout Flow (Crash Commerce)
ui.actionspansMedia Upload with Background Processing (SnapTrace)
file.uploadspansSearch Autocomplete (NullFlix)
Manual LLM Instrumentation (Customer Service Bot)
Key Improvements
Content Structure
Each example includes: