Skip to content

Commit f4b007a

Browse files
fix(sentry-node-sdk): add nodeRuntimeMetricsIntegration and bunRuntimeMetricsIntegration (#84)
Documents the new runtime metrics integrations introduced in sentry-javascript (getsentry/sentry-javascript#19923, #19979) which were missing from the skill. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: claude-sonnet-4-6 <noreply@anthropic.com>
1 parent fdb4eeb commit f4b007a

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

skills/sentry-node-sdk/SKILL.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Present a concrete recommendation based on what you found. Don't ask open-ended
103103
-**AI Monitoring** — OpenAI, Anthropic, LangChain, Vercel AI SDK; recommend when AI/LLM calls detected
104104
-**Crons** — detect missed or failed scheduled jobs; recommend when node-cron, Bull, or Agenda is detected
105105
-**Metrics** — custom counters, gauges, distributions; recommend when custom KPIs needed
106+
-**Runtime Metrics** — automatic collection of memory, CPU, and event loop metrics; `nodeRuntimeMetricsIntegration()` (Node.js) / `bunRuntimeMetricsIntegration()` (Bun)
106107

107108
**Recommendation logic:**
108109

@@ -115,6 +116,7 @@ Present a concrete recommendation based on what you found. Don't ask open-ended
115116
| AI Monitoring | App calls OpenAI, Anthropic, LangChain, Vercel AI, or Google GenAI |
116117
| Crons | App uses node-cron, Bull, BullMQ, Agenda, or any scheduled task pattern |
117118
| Metrics | App needs custom counters, gauges, or histograms |
119+
| Runtime Metrics | Any Node.js or Bun service wanting automatic memory/CPU/event-loop visibility |
118120

119121
Propose: *"I recommend setting up Error Monitoring + Tracing. Want me to also add Logging or Profiling?"*
120122

@@ -436,6 +438,7 @@ app.listen(3000);
436438
| Logging | ✅ Full | `enableLogs: true` + `Sentry.logger.*` |
437439
| Profiling | ❌ Not available | `@sentry/profiling-node` uses native addons incompatible with Bun |
438440
| Metrics | ✅ Full | `Sentry.metrics.*` |
441+
| Runtime Metrics | ✅ Full | `bunRuntimeMetricsIntegration()` — memory, CPU, event loop (no event loop delay percentiles) |
439442
| Crons | ✅ Full | `Sentry.withMonitor()` |
440443
| AI Monitoring | ✅ Full | OpenAI, Anthropic integrations work |
441444

@@ -527,6 +530,7 @@ Deno.cron("daily-cleanup", "0 0 * * *", () => {
527530
| Logging | ✅ Full | `enableLogs: true` + `Sentry.logger.*` |
528531
| Profiling | ❌ Not available | No profiling addon for Deno |
529532
| Metrics | ✅ Full | `Sentry.metrics.*` |
533+
| Runtime Metrics | ❌ Not available | No runtime metrics integration for Deno |
530534
| Crons | ✅ Full | `denoCronIntegration()` + `Sentry.withMonitor()` |
531535
| AI Monitoring | ✅ Partial | Vercel AI SDK integration works; OpenAI/Anthropic via `npm:` |
532536

@@ -543,11 +547,51 @@ Load the corresponding reference file and follow its steps:
543547
| Logging | `references/logging.md` | Structured logs, `Sentry.logger.*`, log-to-trace correlation |
544548
| Profiling | `references/profiling.md` | Node.js only — CPU profiling, Bun/Deno gaps documented |
545549
| Metrics | `references/metrics.md` | Custom counters, gauges, distributions |
550+
| Runtime Metrics | See inline below | Automatic memory, CPU, and event loop metrics for Node.js and Bun |
546551
| Crons | `references/crons.md` | Scheduled job monitoring, node-cron, Bull, Agenda, Deno.cron |
547552
| AI Monitoring | Load `sentry-setup-ai-monitoring` skill | OpenAI, Anthropic, LangChain, Vercel AI, Google GenAI |
548553

549554
For each feature: read the reference file, follow its steps exactly, and verify before moving on.
550555

556+
### Runtime Metrics
557+
558+
Automatically collect Node.js and Bun runtime health metrics (memory, CPU utilization, event loop delay/utilization, uptime) at a configurable interval. Metrics appear in Sentry's Metrics product under the `node.runtime.*` / `bun.runtime.*` namespace.
559+
560+
**Node.js** — add `nodeRuntimeMetricsIntegration()` to your `instrument.js`:
561+
562+
```javascript
563+
const Sentry = require("@sentry/node");
564+
565+
Sentry.init({
566+
dsn: process.env.SENTRY_DSN,
567+
integrations: [
568+
Sentry.nodeRuntimeMetricsIntegration(),
569+
// Optional: change collection interval (default 30 000 ms)
570+
// Sentry.nodeRuntimeMetricsIntegration({ collectionIntervalMs: 60_000 }),
571+
],
572+
});
573+
```
574+
575+
Metrics collected by default: `node.runtime.mem.rss`, `node.runtime.mem.heap_used`, `node.runtime.mem.heap_total`, `node.runtime.cpu.utilization`, `node.runtime.event_loop.delay.p50`, `node.runtime.event_loop.delay.p99`, `node.runtime.event_loop.utilization`, `node.runtime.process.uptime`.
576+
577+
**Bun** — add `bunRuntimeMetricsIntegration()` to your `instrument.ts`:
578+
579+
```typescript
580+
import * as Sentry from "@sentry/bun";
581+
import { bunRuntimeMetricsIntegration } from "@sentry/bun";
582+
583+
Sentry.init({
584+
dsn: process.env.SENTRY_DSN,
585+
integrations: [
586+
bunRuntimeMetricsIntegration(),
587+
// Optional: change collection interval (default 30 000 ms)
588+
// bunRuntimeMetricsIntegration({ collectionIntervalMs: 60_000 }),
589+
],
590+
});
591+
```
592+
593+
Metrics collected: same as Node.js except no event loop delay percentiles (unavailable in Bun). Prefixed with `bun.runtime.*`.
594+
551595
---
552596

553597
## Verification

0 commit comments

Comments
 (0)