npx skills add ...
npx skills add getsentry/sentry-for-cursor --skill sentry-setup-metrics
Setup Sentry Metrics in any project. Use this when asked to add Sentry metrics, track custom metrics, setup counters/gauges/distributions, or instrument application performance metrics. Supports JavaScript, TypeScript, Python, React, Next.js, and Node.js.
npx skills add getsentry/sentry-for-cursor --skill sentry-setup-metrics
This skill helps configure Sentry's custom metrics feature to track counters, gauges, and distributions across your applications.
Invoke this skill when:
Sentry.metrics or sentry_sdk.metricsSupported Platforms:
Note: Ruby does not currently have dedicated metrics support in the Sentry SDK.
Before setup, explain the three metric types to the user:
| Type | Purpose | Use Cases | Aggregations |
|---|---|---|---|
| Counter | Track cumulative occurrences | Button clicks, API calls, errors | sum, per_second, per_minute |
| Gauge | Point-in-time snapshots | Queue depth, memory usage, connections | min, max, avg |
| Distribution | Statistical analysis of values | Response times, cart amounts, query duration | p50, p75, p95, p99, avg, min, max |
Check for these files:
package.json - Read to identify framework and Sentry SDK version@sentry/nextjs, @sentry/react, @sentry/node, @sentry/browserCheck for:
requirements.txt, pyproject.toml, setup.py, or Pipfilesentry-sdk version 2.44.0+ (required for metrics)Ask the user:
10.25.0+If version is below 10.25.0, inform user to upgrade:
Metrics are enabled by default in SDK 10.25.0+. No changes to Sentry.init() are required unless user wants to disable or filter.
Locate init files:
instrumentation-client.ts, sentry.server.config.ts, sentry.edge.config.tssrc/index.tsx, src/main.tsx, or dedicated sentry config fileOptional: Explicitly enable (not required):
If user wants to filter metrics before sending:
If user explicitly wants to disable metrics:
Provide these examples to the user based on their use case:
sentry-sdk version 2.44.0+If version is below 2.44.0:
Metrics are enabled by default in SDK 2.44.0+. No changes required unless filtering is needed.
Common init locations:
settings.pyapp.py or __init__.pymain.pyUse these units for better readability in Sentry dashboard:
| Category | Units |
|---|---|
| Time | nanosecond, microsecond, millisecond, second, minute, hour, day, week |
| Size | bit, byte, kilobyte, megabyte, gigabyte, terabyte |
| Currency | usd, eur, gbp (or any ISO currency code) |
| Rate | ratio, percent |
| Other | none (default), or custom string |
After setup, provide these verification instructions:
Tell user to check their Sentry dashboard under Metrics section to verify metrics are arriving.
Solutions:
enableMetrics: false)await Sentry.flush() or check aggregation windowSolutions:
beforeSendMetric to filter unnecessary metricsSolutions:
Solutions:
Provide this checklist after setup:
| Platform | SDK Version | API Namespace |
|---|---|---|
| JavaScript | 10.25.0+ | Sentry.metrics.* |
| Python | 2.44.0+ | sentry_sdk.metrics.* |
| Method | JavaScript | Python |
|---|---|---|
| Counter | Sentry.metrics.count(name, value, options) | sentry_sdk.metrics.count(name, value, **kwargs) |
| Gauge | Sentry.metrics.gauge(name, value, options) | sentry_sdk.metrics.gauge(name, value, **kwargs) |
| Distribution | Sentry.metrics.distribution(name, value, options) | sentry_sdk.metrics.distribution(name, value, **kwargs) |
| Option | JavaScript | Python |
|---|---|---|
| Unit | { unit: "millisecond" } | unit="millisecond" |
| Attributes | { attributes: { key: "value" } } | attributes={"key": "value"} |