|
| 1 | +--- |
| 2 | +title: DenoRuntimeMetrics |
| 3 | +description: "Collect Deno runtime health metrics such as memory usage and process uptime." |
| 4 | +supported: |
| 5 | + - javascript.deno |
| 6 | +--- |
| 7 | + |
| 8 | +<Alert> |
| 9 | + |
| 10 | +This integration only works in the Deno runtime. |
| 11 | + |
| 12 | +</Alert> |
| 13 | + |
| 14 | +_Import name: `Sentry.denoRuntimeMetricsIntegration`_ |
| 15 | + |
| 16 | +The `denoRuntimeMetricsIntegration` periodically collects Deno runtime health metrics and sends them to Sentry. Metrics include memory usage and process uptime. |
| 17 | + |
| 18 | +```javascript |
| 19 | +import * as Sentry from "@sentry/deno"; |
| 20 | + |
| 21 | +Sentry.init({ |
| 22 | + dsn: "___PUBLIC_DSN___", |
| 23 | + integrations: [Sentry.denoRuntimeMetricsIntegration()], |
| 24 | +}); |
| 25 | +``` |
| 26 | + |
| 27 | +## Default Metrics |
| 28 | + |
| 29 | +The following metrics are emitted every 30 seconds by default: |
| 30 | + |
| 31 | +| Metric | Type | Unit | Description | |
| 32 | +| ------------------------------ | ------- | ------ | ---------------------------------------------------- | |
| 33 | +| `deno.runtime.mem.rss` | gauge | byte | Resident Set Size — actual process memory footprint | |
| 34 | +| `deno.runtime.mem.heap_used` | gauge | byte | V8 heap currently in use | |
| 35 | +| `deno.runtime.mem.heap_total` | gauge | byte | Total V8 heap allocated | |
| 36 | +| `deno.runtime.process.uptime` | counter | second | Cumulative process uptime | |
| 37 | + |
| 38 | +<Alert> |
| 39 | + |
| 40 | +Unlike the Node.js equivalent, CPU and event loop metrics are not available because Deno does not expose `process.cpuUsage()`, `performance.eventLoopUtilization()`, or `monitorEventLoopDelay`. |
| 41 | + |
| 42 | +</Alert> |
| 43 | + |
| 44 | +## Options |
| 45 | + |
| 46 | +### `collect` |
| 47 | + |
| 48 | +_Type: `object`_ |
| 49 | + |
| 50 | +Configure which metrics to collect. You can enable opt-in metrics or disable default ones. |
| 51 | + |
| 52 | +**Opt-in metrics (off by default):** |
| 53 | + |
| 54 | +```javascript |
| 55 | +Sentry.denoRuntimeMetricsIntegration({ |
| 56 | + collect: { |
| 57 | + memExternal: true, // deno.runtime.mem.external |
| 58 | + }, |
| 59 | +}); |
| 60 | +``` |
| 61 | + |
| 62 | +**Disabling default metrics:** |
| 63 | + |
| 64 | +```javascript |
| 65 | +Sentry.denoRuntimeMetricsIntegration({ |
| 66 | + collect: { |
| 67 | + uptime: false, |
| 68 | + }, |
| 69 | +}); |
| 70 | +``` |
| 71 | + |
| 72 | +### `collectionIntervalMs` |
| 73 | + |
| 74 | +_Type: `number`_ |
| 75 | + |
| 76 | +The interval in milliseconds between metric collections. Defaults to `30000` (30 seconds). |
| 77 | + |
| 78 | +```javascript |
| 79 | +Sentry.denoRuntimeMetricsIntegration({ |
| 80 | + collectionIntervalMs: 60_000, |
| 81 | +}); |
| 82 | +``` |
0 commit comments