[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M795QHGT5JK3VVGHR53PHKT0":3,"skill-same:01M795QHGT5JK3VVGHR53PHKT0":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M795QHGT5JK3VVGHR53PHKT0","sentry-performance-tuning",null,"Optimize Sentry performance monitoring for lower overhead and higher signal.\nUse when tuning tracesSampleRate vs tracesSampler, configuring continuous profiling,\nfixing high-cardinality transaction names, adding custom span measurements,\nreducing SDK overhead, or setting Web Vitals thresholds.\nTrigger: \"sentry performance optimize\", \"tune sentry sampling\",\n\"reduce sentry overhead\", \"sentry web vitals\", \"sentry profiling setup\".","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--sentry-pack--sentry-performance-tuning\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: sentry-performance-tuning\ndescription: |\n  Optimize Sentry performance monitoring for lower overhead and higher signal.\n  Use when tuning tracesSampleRate vs tracesSampler, configuring continuous profiling,\n  fixing high-cardinality transaction names, adding custom span measurements,\n  reducing SDK overhead, or setting Web Vitals thresholds.\n  Trigger: \"sentry performance optimize\", \"tune sentry sampling\",\n  \"reduce sentry overhead\", \"sentry web vitals\", \"sentry profiling setup\".\nallowed-tools: Read, Write, Edit, Grep, Glob, Bash(npm:*), Bash(npx:*), Bash(node:*), Bash(sentry-cli:*)\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ncompatible-with: claude-code, codex, openclaw\ntags: [saas, sentry, monitoring, performance, optimization, profiling, web-vitals]\n---\n\n# Sentry Performance Tuning\n\n## Overview\n\nOptimize Sentry's performance monitoring pipeline to maximize signal quality while minimizing SDK overhead and event volume costs. Covers the v8 SDK API for `@sentry\u002Fnode`, `@sentry\u002Fbrowser`, and `sentry-sdk` (Python), targeting `sentry.io` or self-hosted Sentry 24.1+.\n\n## Prerequisites\n\n- Sentry SDK v8+ installed (`@sentry\u002Fnode` >= 8.0.0 or `sentry-sdk` >= 2.0.0)\n- `Sentry.init()` called with a valid DSN before any application code runs\n- Performance monitoring enabled (`tracesSampleRate > 0` or a `tracesSampler` function)\n- Access to the Sentry Performance dashboard to verify changes\n\n## Instructions\n\n### Step 1 — Replace Static `tracesSampleRate` with Dynamic `tracesSampler`\n\nA flat `tracesSampleRate: 0.1` samples all routes equally. The `tracesSampler` callback makes per-transaction decisions based on route, operation type, and upstream trace context.\n\n```typescript\nimport * as Sentry from '@sentry\u002Fnode';\n\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  \u002F\u002F tracesSampler replaces tracesSampleRate — do not set both\n  tracesSampler: (samplingContext) => {\n    const { name, attributes, parentSampled } = samplingContext;\n\n    \u002F\u002F Honor parent sampling for distributed trace consistency\n    if (parentSampled !== undefined) return parentSampled ? 1.0 : 0;\n\n    \u002F\u002F Drop noise — health probes, static assets\n    if (name?.match(\u002F\\\u002F(health|ready|alive|ping|metrics)$\u002F)) return 0;\n    if (name?.match(\u002F\\.(js|css|png|jpg|svg|woff2?|ico)$\u002F)) return 0;\n\n    \u002F\u002F Always sample business-critical paths\n    if (name?.includes('\u002Fcheckout') || name?.includes('\u002Fpayment')) return 1.0;\n\n    \u002F\u002F Higher sampling for write operations (mutations are riskier)\n    if (name?.startsWith('POST ') || name?.startsWith('PUT ')) return 0.25;\n\n    \u002F\u002F Moderate sampling for read APIs\n    if (name?.startsWith('GET \u002Fapi\u002F')) return 0.1;\n\n    \u002F\u002F Low sampling for background work\n    if (name?.startsWith('job:') || name?.startsWith('queue:')) return 0.05;\n\n    \u002F\u002F User-tier sampling (via custom attributes from middleware)\n    if (attributes?.['user.plan'] === 'enterprise') return 0.5;\n\n    return 0.05; \u002F\u002F Default: 5%\n  },\n});\n```\n\n### Step 2 — Configure Profiling with `profilesSampleRate`\n\nThe `profilesSampleRate` controls what fraction of *traced* transactions get profiled. Setting it to 1.0 with a 5% `tracesSampler` means 5% of traffic is profiled.\n\n```typescript\nimport { nodeProfilingIntegration } from '@sentry\u002Fprofiling-node';\n\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  integrations: [nodeProfilingIntegration()],\n  tracesSampler: (ctx) => { \u002F* ... from Step 1 ... *\u002F },\n\n  \u002F\u002F Effective rate = tracesSampler rate * profilesSampleRate\n  profilesSampleRate: 1.0,\n\n  \u002F\u002F Alternative: Continuous profiling (v8.7.0+) — profiles the entire process\n  \u002F\u002F profileSessionSampleRate: 0.1,  \u002F\u002F 10% of server instances\n});\n```\n\n**Tuning:** Start at `profilesSampleRate: 0.1` in production. Profiling adds ~3-5% CPU overhead per profiled transaction. Continuous profiling (`profileSessionSampleRate`) has lower per-transaction cost but runs on sampled instances continuously.\n\n### Step 3 — Fix Transaction Naming (Prevent Cardinality Explosion)\n\nNames with dynamic IDs (`\u002Fapi\u002Fusers\u002F12345`) create thousands of unique entries, degrading dashboard performance and inflating quota. **Route templates go in the name, dynamic values go in attributes.**\n\n```typescript\n\u002F\u002F BAD — creates thousands of unique transaction entries\n\u002F\u002F GET \u002Fapi\u002Fusers\u002F12345, GET \u002Fapi\u002Fusers\u002F67890, ...\n\n\u002F\u002F GOOD — Sentry auto-parameterizes Express\u002FKoa\u002FFastify routes\n\u002F\u002F GET \u002Fapi\u002Fusers\u002F:userId\n\n\u002F\u002F For custom spans, always parameterize:\nSentry.startSpan(\n  {\n    name: 'order.process',           \u002F\u002F No dynamic IDs in name\n    op: 'task',\n    attributes: {\n      'order.id': orderId,           \u002F\u002F Filterable in Discover queries\n      'order.total_cents': totalCents,\n      'customer.tier': customerTier,\n    },\n  },\n  async (span) => {\n    const result = await processOrder(orderId);\n    span.setAttribute('order.status', result.status);\n    return result;\n  }\n);\n```\n\n**Detect cardinality issues** with a Discover query:\n\n```\nSELECT count(), transaction FROM transactions GROUP BY transaction ORDER BY count() DESC\n```\n\n### Step 4 — Add Custom Measurements\n\nCustom measurements appear in the Performance dashboard and can be charted, alerted on, and queried in Discover. Unit types: `'millisecond'`, `'byte'`, `'none'` (count), `'percent'`.\n\n```typescript\nawait Sentry.startSpan(\n  { name: 'search.execute', op: 'function' },\n  async (span) => {\n    const start = performance.now();\n    const results = await searchService.query(term);\n\n    Sentry.setMeasurement('search.latency', performance.now() - start, 'millisecond');\n    Sentry.setMeasurement('search.result_count', results.length, 'none');\n    Sentry.setMeasurement('search.memory_delta',\n      process.memoryUsage().heapUsed - memBefore, 'byte');\n\n    span.setAttribute('search.cache_hit', results.fromCache);\n    return results;\n  }\n);\n```\n\n| Measurement | Unit | Use case |\n|-------------|------|----------|\n| `cart.total_cents` | `none` | Revenue correlation with latency |\n| `query.rows_scanned` | `none` | Database query efficiency |\n| `cache.hit_rate` | `percent` | Cache performance per route |\n| `upload.file_size` | `byte` | File upload impact on response time |\n\n### Step 5 — Reduce SDK Overhead\n\nFor high-throughput services (>1000 req\u002Fs), every integration and breadcrumb counts.\n\n```typescript\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  maxBreadcrumbs: 20,           \u002F\u002F Default: 100. Each ~0.5-2KB.\n  maxValueLength: 500,          \u002F\u002F Truncate long string values\n  maxAttachmentSize: 5_242_880, \u002F\u002F 5MB (default: 20MB)\n\n  \u002F\u002F Remove noisy integrations\n  integrations: (defaults) => defaults.filter(\n    (i) => i.name !== 'Console'\n  ),\n\n  \u002F\u002F Trim oversized stack traces\n  beforeSend: (event) => {\n    if (event.exception?.values) {\n      for (const exc of event.exception.values) {\n        if (exc.stacktrace?.frames && exc.stacktrace.frames.length > 30) {\n          exc.stacktrace.frames = [\n            ...exc.stacktrace.frames.slice(0, 10),\n            ...exc.stacktrace.frames.slice(-20),\n          ];\n        }\n      }\n    }\n    return event;\n  },\n\n  \u002F\u002F Drop internal\u002Fnoise spans\n  beforeSendSpan: (span) => {\n    if (span.description?.startsWith('internal.')) return null;\n    return span;\n  },\n});\n```\n\n**Browser SDK lazy loading** (saves ~30KB gzipped from critical path):\n\n```typescript\nasync function initSentry() {\n  const Sentry = await import('@sentry\u002Fbrowser');\n  Sentry.init({\n    dsn: process.env.SENTRY_DSN,\n    integrations: [Sentry.browserTracingIntegration()],\n    tracesSampleRate: 0.1,\n  });\n}\nwindow.addEventListener('load', initSentry, { once: true });\n```\n\n### Step 6 — Span Best Practices (Avoid Span Explosion)\n\nOnly wrap operations with measurable latency (>1ms). Never span synchronous lookups or individual loop iterations.\n\n```typescript\n\u002F\u002F BAD — sub-microsecond config read; span overhead exceeds operation cost\nfunction getConfig(key: string) {\n  return Sentry.startSpan({ name: 'config.get', op: 'function' }, () => config[key]);\n}\n\n\u002F\u002F BAD — N spans per request from loop iterations\nfor (const item of items) {\n  await Sentry.startSpan({ name: 'process.item', op: 'function' }, () => processItem(item));\n}\n\n\u002F\u002F GOOD — span the batch, count in attributes\nawait Sentry.startSpan(\n  { name: 'process.batch', op: 'function', attributes: { 'batch.size': items.length } },\n  async () => Promise.all(items.map(processItem))\n);\n\n\u002F\u002F GOOD — span external I\u002FO with real latency\nasync function fetchUserProfile(userId: string) {\n  return Sentry.startSpan(\n    { name: 'user.fetch_profile', op: 'http.client', attributes: { 'user.id': userId } },\n    async () => fetch(`${USER_SERVICE_URL}\u002Fusers\u002F${userId}`).then(r => r.json())\n  );\n}\n```\n\n### Step 7 — Web Vitals Monitoring\n\nThe Browser SDK auto-captures Core Web Vitals. Filter span creation to avoid noise from third-party scripts.\n\n```typescript\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  integrations: [\n    Sentry.browserTracingIntegration({\n      shouldCreateSpanForRequest: (url) =>\n        !url.includes('googleapis.com') && !url.includes('analytics'),\n    }),\n  ],\n  tracesSampleRate: 0.1,\n});\n```\n\n| Metric | Good | Poor | Measures |\n|--------|------|------|----------|\n| **LCP** | \u003C 2.5s | > 4.0s | Visual load completion |\n| **INP** | \u003C 200ms | > 500ms | Input responsiveness (replaced FID) |\n| **CLS** | \u003C 0.1 | > 0.25 | Visual stability |\n| **TTFB** | \u003C 800ms | > 1800ms | Server response time |\n\n**Alert thresholds:** LCP p75 > 2.5s (5 min), INP p75 > 200ms (5 min), CLS p75 > 0.1 (15 min).\n\n### Step 8 — Dashboard Queries for Performance Trends\n\n```\n-- Slowest transactions (p95)\nSELECT transaction, p95(transaction.duration), count()\nFROM transactions WHERE transaction.duration:>1000\nORDER BY p95(transaction.duration) DESC\n\n-- Regression detection (20%+ slower vs last week)\nSELECT transaction, p75(transaction.duration),\n       compare(p75(transaction.duration), -7d) as vs_last_week\nFROM transactions GROUP BY transaction\nHAVING compare(p75(transaction.duration), -7d) > 1.2\n\n-- Span breakdown for a route\nSELECT span.op, span.description, p75(span.duration), count()\nFROM spans WHERE transaction:\u002Fapi\u002Fcheckout\nORDER BY p75(span.duration) DESC\n```\n\n## Output\n\n- **Dynamic sampling** active — health checks at 0%, payments at 100%, defaults at 5%\n- **Profiling** enabled with `profilesSampleRate` or continuous `profileSessionSampleRate`\n- **Transaction names** parameterized — cardinality under 500 unique names\n- **Custom measurements** tracking business KPIs alongside latency\n- **SDK overhead** reduced — fewer breadcrumbs, filtered integrations, trimmed payloads\n- **Web Vitals** monitored with alerts at Google's recommended thresholds\n\nVerify at Sentry Stats (Settings > Stats) — volume should drop while data quality improves.\n\n## Error Handling\n\n| Symptom | Root Cause | Fix |\n|---------|-----------|-----|\n| Performance tab empty | `tracesSampler` returns 0 for all routes | Log sampler decisions; check default return |\n| \"Too many unique transaction names\" | Dynamic IDs in names | Parameterize names; IDs in `attributes` (Step 3) |\n| SDK adds >50ms latency | Too many integrations\u002Fbreadcrumbs | Reduce `maxBreadcrumbs` to 20; disable `Console` |\n| Profiling tab empty | Missing `@sentry\u002Fprofiling-node` | Install package; set `profilesSampleRate: 1.0` |\n| Incomplete distributed traces | Independent sampling decisions | Check `parentSampled` first in sampler (Step 1) |\n| `setMeasurement` values missing | Called outside active span | Call inside `Sentry.startSpan()` callback |\n| Web Vitals null | Missing `browserTracingIntegration` | Add integration; set `tracesSampleRate > 0` |\n\n## Examples\n\n### TypeScript — Express Production Setup\n\n```typescript\nimport * as Sentry from '@sentry\u002Fnode';\nimport { nodeProfilingIntegration } from '@sentry\u002Fprofiling-node';\nimport express from 'express';\n\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  environment: process.env.NODE_ENV,\n  release: process.env.SENTRY_RELEASE,\n  integrations: [nodeProfilingIntegration()],\n  tracesSampler: (ctx) => {\n    const { name, parentSampled } = ctx;\n    if (parentSampled !== undefined) return parentSampled ? 1.0 : 0;\n    if (name?.match(\u002F\\\u002F(health|ready|ping)$\u002F)) return 0;\n    if (name?.includes('\u002Fcheckout')) return 1.0;\n    if (name?.startsWith('POST ')) return 0.25;\n    if (name?.startsWith('GET \u002Fapi\u002F')) return 0.1;\n    return 0.05;\n  },\n  profilesSampleRate: 1.0,\n  maxBreadcrumbs: 20,\n  beforeSendSpan: (span) =>\n    span.description?.includes('health') ? null : span,\n});\n\nconst app = express();\nSentry.setupExpressErrorHandler(app);\n\napp.get('\u002Fapi\u002Fsearch', async (req, res) => {\n  const results = await Sentry.startSpan(\n    { name: 'search.execute', op: 'function' },\n    async () => {\n      const data = await searchService.query(req.query.q as string);\n      Sentry.setMeasurement('search.result_count', data.length, 'none');\n      return data;\n    }\n  );\n  res.json(results);\n});\n```\n\n### Python — FastAPI Production Setup\n\n```python\nimport os, re, sentry_sdk\nfrom fastapi import FastAPI\n\ndef traces_sampler(ctx: dict) -> float:\n    tx = ctx.get(\"transaction_context\", {})\n    name = tx.get(\"name\", \"\")\n    parent = ctx.get(\"parent_sampled\")\n    if parent is not None:\n        return 1.0 if parent else 0.0\n    if re.search(r\"\u002F(health|ready|ping)$\", name):\n        return 0.0\n    if \"\u002Fcheckout\" in name or \"\u002Fpayment\" in name:\n        return 1.0\n    if name.startswith((\"POST \", \"PUT \")):\n        return 0.25\n    if name.startswith(\"GET \u002Fapi\u002F\"):\n        return 0.1\n    if tx.get(\"op\") == \"task\":\n        return 0.05\n    return 0.05\n\nsentry_sdk.init(\n    dsn=os.environ[\"SENTRY_DSN\"],\n    environment=os.environ.get(\"ENVIRONMENT\", \"development\"),\n    release=os.environ.get(\"SENTRY_RELEASE\"),\n    traces_sampler=traces_sampler,\n    profiles_sample_rate=1.0,\n    max_breadcrumbs=20,\n    before_send_transaction=lambda event, hint: (\n        None if event.get(\"transaction\", \"\").endswith(\"\u002Fhealth\") else event\n    ),\n)\n\napp = FastAPI()\n\n@app.get(\"\u002Fapi\u002Fsearch\")\nasync def search(q: str):\n    with sentry_sdk.start_span(op=\"function\", name=\"search.execute\") as span:\n        results = await search_service.query(q)\n        sentry_sdk.set_measurement(\"search.result_count\", len(results), \"none\")\n        span.set_data(\"search.query_length\", len(q))\n        return {\"results\": results}\n```\n\n## Resources\n\n- [Performance Monitoring](https:\u002F\u002Fdocs.sentry.io\u002Fproduct\u002Fperformance\u002F) — Dashboard overview and configuration\n- [Sampling Configuration](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Fsampling\u002F) — `tracesSampler` deep dive\n- [Profiling (Node.js)](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fguides\u002Fnode\u002Fprofiling\u002F) — Setup and tuning\n- [Profiling (Python)](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fpython\u002Fprofiling\u002F) — `sentry-sdk[profiling]` setup\n- [Web Vitals](https:\u002F\u002Fdocs.sentry.io\u002Fproduct\u002Finsights\u002Fweb-vitals\u002F) — LCP, INP, CLS dashboards\n- [Custom Instrumentation](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fperformance\u002Finstrumentation\u002Fcustom-instrumentation\u002F) — `setMeasurement()` API\n- [Discover Queries](https:\u002F\u002Fdocs.sentry.io\u002Fproduct\u002Fexplore\u002Fdiscover-queries\u002F) — SQL-like query builder\n- [Span Operations](https:\u002F\u002Fdevelop.sentry.dev\u002Fsdk\u002Fperformance\u002Fspan-operations\u002F) — Naming conventions for `op` field\n\n## Next Steps\n\n1. **Validate sampling** — Check Sentry Stats (Settings > Stats) to confirm volume dropped while critical route coverage is maintained\n2. **Set up alerts** — Create metric alerts for LCP p75 > 2.5s and INP p75 > 200ms\n3. **Review flamegraphs** — Navigate to a sampled transaction and examine the Profile tab for CPU hotspots\n4. **Audit cardinality** — Run the Discover query from Step 3 to find remaining high-cardinality names\n5. **Add business measurements** — Identify 3-5 KPIs (cart value, search latency) and add `setMeasurement()` calls\n6. **Server-side sampling** — Use Sentry's Dynamic Sampling UI (Settings > Performance) for rules without code deploys\n","# Sentry Performance Tuning\n\n## Overview\n\nOptimize Sentry's performance monitoring pipeline to maximize signal quality while minimizing SDK overhead and event volume costs. Covers the v8 SDK API for `@sentry\u002Fnode`, `@sentry\u002Fbrowser`, and `sentry-sdk` (Python), targeting `sentry.io` or self-hosted Sentry 24.1+.\n\n## Prerequisites\n\n- Sentry SDK v8+ installed (`@sentry\u002Fnode` >= 8.0.0 or `sentry-sdk` >= 2.0.0)\n- `Sentry.init()` called with a valid DSN before any application code runs\n- Performance monitoring enabled (`tracesSampleRate > 0` or a `tracesSampler` function)\n- Access to the Sentry Performance dashboard to verify changes\n\n## Instructions\n\n### Step 1 — Replace Static `tracesSampleRate` with Dynamic `tracesSampler`\n\nA flat `tracesSampleRate: 0.1` samples all routes equally. The `tracesSampler` callback makes per-transaction decisions based on route, operation type, and upstream trace context.\n\n```typescript\nimport * as Sentry from '@sentry\u002Fnode';\n\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  \u002F\u002F tracesSampler replaces tracesSampleRate — do not set both\n  tracesSampler: (samplingContext) => {\n    const { name, attributes, parentSampled } = samplingContext;\n\n    \u002F\u002F Honor parent sampling for distributed trace consistency\n    if (parentSampled !== undefined) return parentSampled ? 1.0 : 0;\n\n    \u002F\u002F Drop noise — health probes, static assets\n    if (name?.match(\u002F\\\u002F(health|ready|alive|ping|metrics)$\u002F)) return 0;\n    if (name?.match(\u002F\\.(js|css|png|jpg|svg|woff2?|ico)$\u002F)) return 0;\n\n    \u002F\u002F Always sample business-critical paths\n    if (name?.includes('\u002Fcheckout') || name?.includes('\u002Fpayment')) return 1.0;\n\n    \u002F\u002F Higher sampling for write operations (mutations are riskier)\n    if (name?.startsWith('POST ') || name?.startsWith('PUT ')) return 0.25;\n\n    \u002F\u002F Moderate sampling for read APIs\n    if (name?.startsWith('GET \u002Fapi\u002F')) return 0.1;\n\n    \u002F\u002F Low sampling for background work\n    if (name?.startsWith('job:') || name?.startsWith('queue:')) return 0.05;\n\n    \u002F\u002F User-tier sampling (via custom attributes from middleware)\n    if (attributes?.['user.plan'] === 'enterprise') return 0.5;\n\n    return 0.05; \u002F\u002F Default: 5%\n  },\n});\n```\n\n### Step 2 — Configure Profiling with `profilesSampleRate`\n\nThe `profilesSampleRate` controls what fraction of *traced* transactions get profiled. Setting it to 1.0 with a 5% `tracesSampler` means 5% of traffic is profiled.\n\n```typescript\nimport { nodeProfilingIntegration } from '@sentry\u002Fprofiling-node';\n\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  integrations: [nodeProfilingIntegration()],\n  tracesSampler: (ctx) => { \u002F* ... from Step 1 ... *\u002F },\n\n  \u002F\u002F Effective rate = tracesSampler rate * profilesSampleRate\n  profilesSampleRate: 1.0,\n\n  \u002F\u002F Alternative: Continuous profiling (v8.7.0+) — profiles the entire process\n  \u002F\u002F profileSessionSampleRate: 0.1,  \u002F\u002F 10% of server instances\n});\n```\n\n**Tuning:** Start at `profilesSampleRate: 0.1` in production. Profiling adds ~3-5% CPU overhead per profiled transaction. Continuous profiling (`profileSessionSampleRate`) has lower per-transaction cost but runs on sampled instances continuously.\n\n### Step 3 — Fix Transaction Naming (Prevent Cardinality Explosion)\n\nNames with dynamic IDs (`\u002Fapi\u002Fusers\u002F12345`) create thousands of unique entries, degrading dashboard performance and inflating quota. **Route templates go in the name, dynamic values go in attributes.**\n\n```typescript\n\u002F\u002F BAD — creates thousands of unique transaction entries\n\u002F\u002F GET \u002Fapi\u002Fusers\u002F12345, GET \u002Fapi\u002Fusers\u002F67890, ...\n\n\u002F\u002F GOOD — Sentry auto-parameterizes Express\u002FKoa\u002FFastify routes\n\u002F\u002F GET \u002Fapi\u002Fusers\u002F:userId\n\n\u002F\u002F For custom spans, always parameterize:\nSentry.startSpan(\n  {\n    name: 'order.process',           \u002F\u002F No dynamic IDs in name\n    op: 'task',\n    attributes: {\n      'order.id': orderId,           \u002F\u002F Filterable in Discover queries\n      'order.total_cents': totalCents,\n      'customer.tier': customerTier,\n    },\n  },\n  async (span) => {\n    const result = await processOrder(orderId);\n    span.setAttribute('order.status', result.status);\n    return result;\n  }\n);\n```\n\n**Detect cardinality issues** with a Discover query:\n\n```\nSELECT count(), transaction FROM transactions GROUP BY transaction ORDER BY count() DESC\n```\n\n### Step 4 — Add Custom Measurements\n\nCustom measurements appear in the Performance dashboard and can be charted, alerted on, and queried in Discover. Unit types: `'millisecond'`, `'byte'`, `'none'` (count), `'percent'`.\n\n```typescript\nawait Sentry.startSpan(\n  { name: 'search.execute', op: 'function' },\n  async (span) => {\n    const start = performance.now();\n    const results = await searchService.query(term);\n\n    Sentry.setMeasurement('search.latency', performance.now() - start, 'millisecond');\n    Sentry.setMeasurement('search.result_count', results.length, 'none');\n    Sentry.setMeasurement('search.memory_delta',\n      process.memoryUsage().heapUsed - memBefore, 'byte');\n\n    span.setAttribute('search.cache_hit', results.fromCache);\n    return results;\n  }\n);\n```\n\n| Measurement | Unit | Use case |\n|-------------|------|----------|\n| `cart.total_cents` | `none` | Revenue correlation with latency |\n| `query.rows_scanned` | `none` | Database query efficiency |\n| `cache.hit_rate` | `percent` | Cache performance per route |\n| `upload.file_size` | `byte` | File upload impact on response time |\n\n### Step 5 — Reduce SDK Overhead\n\nFor high-throughput services (>1000 req\u002Fs), every integration and breadcrumb counts.\n\n```typescript\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  maxBreadcrumbs: 20,           \u002F\u002F Default: 100. Each ~0.5-2KB.\n  maxValueLength: 500,          \u002F\u002F Truncate long string values\n  maxAttachmentSize: 5_242_880, \u002F\u002F 5MB (default: 20MB)\n\n  \u002F\u002F Remove noisy integrations\n  integrations: (defaults) => defaults.filter(\n    (i) => i.name !== 'Console'\n  ),\n\n  \u002F\u002F Trim oversized stack traces\n  beforeSend: (event) => {\n    if (event.exception?.values) {\n      for (const exc of event.exception.values) {\n        if (exc.stacktrace?.frames && exc.stacktrace.frames.length > 30) {\n          exc.stacktrace.frames = [\n            ...exc.stacktrace.frames.slice(0, 10),\n            ...exc.stacktrace.frames.slice(-20),\n          ];\n        }\n      }\n    }\n    return event;\n  },\n\n  \u002F\u002F Drop internal\u002Fnoise spans\n  beforeSendSpan: (span) => {\n    if (span.description?.startsWith('internal.')) return null;\n    return span;\n  },\n});\n```\n\n**Browser SDK lazy loading** (saves ~30KB gzipped from critical path):\n\n```typescript\nasync function initSentry() {\n  const Sentry = await import('@sentry\u002Fbrowser');\n  Sentry.init({\n    dsn: process.env.SENTRY_DSN,\n    integrations: [Sentry.browserTracingIntegration()],\n    tracesSampleRate: 0.1,\n  });\n}\nwindow.addEventListener('load', initSentry, { once: true });\n```\n\n### Step 6 — Span Best Practices (Avoid Span Explosion)\n\nOnly wrap operations with measurable latency (>1ms). Never span synchronous lookups or individual loop iterations.\n\n```typescript\n\u002F\u002F BAD — sub-microsecond config read; span overhead exceeds operation cost\nfunction getConfig(key: string) {\n  return Sentry.startSpan({ name: 'config.get', op: 'function' }, () => config[key]);\n}\n\n\u002F\u002F BAD — N spans per request from loop iterations\nfor (const item of items) {\n  await Sentry.startSpan({ name: 'process.item', op: 'function' }, () => processItem(item));\n}\n\n\u002F\u002F GOOD — span the batch, count in attributes\nawait Sentry.startSpan(\n  { name: 'process.batch', op: 'function', attributes: { 'batch.size': items.length } },\n  async () => Promise.all(items.map(processItem))\n);\n\n\u002F\u002F GOOD — span external I\u002FO with real latency\nasync function fetchUserProfile(userId: string) {\n  return Sentry.startSpan(\n    { name: 'user.fetch_profile', op: 'http.client', attributes: { 'user.id': userId } },\n    async () => fetch(`${USER_SERVICE_URL}\u002Fusers\u002F${userId}`).then(r => r.json())\n  );\n}\n```\n\n### Step 7 — Web Vitals Monitoring\n\nThe Browser SDK auto-captures Core Web Vitals. Filter span creation to avoid noise from third-party scripts.\n\n```typescript\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  integrations: [\n    Sentry.browserTracingIntegration({\n      shouldCreateSpanForRequest: (url) =>\n        !url.includes('googleapis.com') && !url.includes('analytics'),\n    }),\n  ],\n  tracesSampleRate: 0.1,\n});\n```\n\n| Metric | Good | Poor | Measures |\n|--------|------|------|----------|\n| **LCP** | \u003C 2.5s | > 4.0s | Visual load completion |\n| **INP** | \u003C 200ms | > 500ms | Input responsiveness (replaced FID) |\n| **CLS** | \u003C 0.1 | > 0.25 | Visual stability |\n| **TTFB** | \u003C 800ms | > 1800ms | Server response time |\n\n**Alert thresholds:** LCP p75 > 2.5s (5 min), INP p75 > 200ms (5 min), CLS p75 > 0.1 (15 min).\n\n### Step 8 — Dashboard Queries for Performance Trends\n\n```\n-- Slowest transactions (p95)\nSELECT transaction, p95(transaction.duration), count()\nFROM transactions WHERE transaction.duration:>1000\nORDER BY p95(transaction.duration) DESC\n\n-- Regression detection (20%+ slower vs last week)\nSELECT transaction, p75(transaction.duration),\n       compare(p75(transaction.duration), -7d) as vs_last_week\nFROM transactions GROUP BY transaction\nHAVING compare(p75(transaction.duration), -7d) > 1.2\n\n-- Span breakdown for a route\nSELECT span.op, span.description, p75(span.duration), count()\nFROM spans WHERE transaction:\u002Fapi\u002Fcheckout\nORDER BY p75(span.duration) DESC\n```\n\n## Output\n\n- **Dynamic sampling** active — health checks at 0%, payments at 100%, defaults at 5%\n- **Profiling** enabled with `profilesSampleRate` or continuous `profileSessionSampleRate`\n- **Transaction names** parameterized — cardinality under 500 unique names\n- **Custom measurements** tracking business KPIs alongside latency\n- **SDK overhead** reduced — fewer breadcrumbs, filtered integrations, trimmed payloads\n- **Web Vitals** monitored with alerts at Google's recommended thresholds\n\nVerify at Sentry Stats (Settings > Stats) — volume should drop while data quality improves.\n\n## Error Handling\n\n| Symptom | Root Cause | Fix |\n|---------|-----------|-----|\n| Performance tab empty | `tracesSampler` returns 0 for all routes | Log sampler decisions; check default return |\n| \"Too many unique transaction names\" | Dynamic IDs in names | Parameterize names; IDs in `attributes` (Step 3) |\n| SDK adds >50ms latency | Too many integrations\u002Fbreadcrumbs | Reduce `maxBreadcrumbs` to 20; disable `Console` |\n| Profiling tab empty | Missing `@sentry\u002Fprofiling-node` | Install package; set `profilesSampleRate: 1.0` |\n| Incomplete distributed traces | Independent sampling decisions | Check `parentSampled` first in sampler (Step 1) |\n| `setMeasurement` values missing | Called outside active span | Call inside `Sentry.startSpan()` callback |\n| Web Vitals null | Missing `browserTracingIntegration` | Add integration; set `tracesSampleRate > 0` |\n\n## Examples\n\n### TypeScript — Express Production Setup\n\n```typescript\nimport * as Sentry from '@sentry\u002Fnode';\nimport { nodeProfilingIntegration } from '@sentry\u002Fprofiling-node';\nimport express from 'express';\n\nSentry.init({\n  dsn: process.env.SENTRY_DSN,\n  environment: process.env.NODE_ENV,\n  release: process.env.SENTRY_RELEASE,\n  integrations: [nodeProfilingIntegration()],\n  tracesSampler: (ctx) => {\n    const { name, parentSampled } = ctx;\n    if (parentSampled !== undefined) return parentSampled ? 1.0 : 0;\n    if (name?.match(\u002F\\\u002F(health|ready|ping)$\u002F)) return 0;\n    if (name?.includes('\u002Fcheckout')) return 1.0;\n    if (name?.startsWith('POST ')) return 0.25;\n    if (name?.startsWith('GET \u002Fapi\u002F')) return 0.1;\n    return 0.05;\n  },\n  profilesSampleRate: 1.0,\n  maxBreadcrumbs: 20,\n  beforeSendSpan: (span) =>\n    span.description?.includes('health') ? null : span,\n});\n\nconst app = express();\nSentry.setupExpressErrorHandler(app);\n\napp.get('\u002Fapi\u002Fsearch', async (req, res) => {\n  const results = await Sentry.startSpan(\n    { name: 'search.execute', op: 'function' },\n    async () => {\n      const data = await searchService.query(req.query.q as string);\n      Sentry.setMeasurement('search.result_count', data.length, 'none');\n      return data;\n    }\n  );\n  res.json(results);\n});\n```\n\n### Python — FastAPI Production Setup\n\n```python\nimport os, re, sentry_sdk\nfrom fastapi import FastAPI\n\ndef traces_sampler(ctx: dict) -> float:\n    tx = ctx.get(\"transaction_context\", {})\n    name = tx.get(\"name\", \"\")\n    parent = ctx.get(\"parent_sampled\")\n    if parent is not None:\n        return 1.0 if parent else 0.0\n    if re.search(r\"\u002F(health|ready|ping)$\", name):\n        return 0.0\n    if \"\u002Fcheckout\" in name or \"\u002Fpayment\" in name:\n        return 1.0\n    if name.startswith((\"POST \", \"PUT \")):\n        return 0.25\n    if name.startswith(\"GET \u002Fapi\u002F\"):\n        return 0.1\n    if tx.get(\"op\") == \"task\":\n        return 0.05\n    return 0.05\n\nsentry_sdk.init(\n    dsn=os.environ[\"SENTRY_DSN\"],\n    environment=os.environ.get(\"ENVIRONMENT\", \"development\"),\n    release=os.environ.get(\"SENTRY_RELEASE\"),\n    traces_sampler=traces_sampler,\n    profiles_sample_rate=1.0,\n    max_breadcrumbs=20,\n    before_send_transaction=lambda event, hint: (\n        None if event.get(\"transaction\", \"\").endswith(\"\u002Fhealth\") else event\n    ),\n)\n\napp = FastAPI()\n\n@app.get(\"\u002Fapi\u002Fsearch\")\nasync def search(q: str):\n    with sentry_sdk.start_span(op=\"function\", name=\"search.execute\") as span:\n        results = await search_service.query(q)\n        sentry_sdk.set_measurement(\"search.result_count\", len(results), \"none\")\n        span.set_data(\"search.query_length\", len(q))\n        return {\"results\": results}\n```\n\n## Resources\n\n- [Performance Monitoring](https:\u002F\u002Fdocs.sentry.io\u002Fproduct\u002Fperformance\u002F) — Dashboard overview and configuration\n- [Sampling Configuration](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Fsampling\u002F) — `tracesSampler` deep dive\n- [Profiling (Node.js)](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fguides\u002Fnode\u002Fprofiling\u002F) — Setup and tuning\n- [Profiling (Python)](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fpython\u002Fprofiling\u002F) — `sentry-sdk[profiling]` setup\n- [Web Vitals](https:\u002F\u002Fdocs.sentry.io\u002Fproduct\u002Finsights\u002Fweb-vitals\u002F) — LCP, INP, CLS dashboards\n- [Custom Instrumentation](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fperformance\u002Finstrumentation\u002Fcustom-instrumentation\u002F) — `setMeasurement()` API\n- [Discover Queries](https:\u002F\u002Fdocs.sentry.io\u002Fproduct\u002Fexplore\u002Fdiscover-queries\u002F) — SQL-like query builder\n- [Span Operations](https:\u002F\u002Fdevelop.sentry.dev\u002Fsdk\u002Fperformance\u002Fspan-operations\u002F) — Naming conventions for `op` field\n\n## Next Steps\n\n1. **Validate sampling** — Check Sentry Stats (Settings > Stats) to confirm volume dropped while critical route coverage is maintained\n2. **Set up alerts** — Create metric alerts for LCP p75 > 2.5s and INP p75 > 200ms\n3. **Review flamegraphs** — Navigate to a sampled transaction and examine the Profile tab for CPU hotspots\n4. **Audit cardinality** — Run the Discover query from Step 3 to find remaining high-cardinality names\n5. **Add business measurements** — Identify 3-5 KPIs (cart value, search latency) and add `setMeasurement()` calls\n6. **Server-side sampling** — Use Sentry's Dynamic Sampling UI (Settings > Performance) for rules without code deploys\n",{"name":5,"tags":24,"author":32,"license":15,"version":33,"description":34,"allowed-tools":35,"compatible-with":36},[25,26,27,28,29,30,31],"saas","sentry","monitoring","performance","optimization","profiling","web-vitals","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Optimize Sentry performance monitoring for lower overhead and higher signal.\nUse when tuning tracesSampleRate vs tracesSampler, configuring continuous profiling,\nfixing high-cardinality transaction names, adding custom span measurements,\nreducing SDK overhead, or setting Web Vitals thresholds.\nTrigger: \"sentry performance optimize\", \"tune sentry sampling\",\n\"reduce sentry overhead\", \"sentry web vitals\", \"sentry profiling setup\".\n","Read, Write, Edit, Grep, Glob, Bash(npm:*), Bash(npx:*), Bash(node:*), Bash(sentry-cli:*)","claude-code, codex, openclaw","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fsaas-packs--sentry-pack--sentry-performance-tuning",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill sentry-performance-tuning",{"tool":52,"command":53},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill sentry-performance-tuning",{"tool":55,"command":56},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill sentry-performance-tuning","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--sentry-pack--sentry-performance-tuning\u002FSKILL.md",true,[],[61,68,75,82,89,97],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":93,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]