Title: feat(webapp): add per-worker Node.js heap metrics by ericallam · Pull Request #3437 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: feat(webapp): add per-worker Node.js heap metrics by ericallam · Pull Request #3437 · triggerdotdev/trigger.dev
X Title: feat(webapp): add per-worker Node.js heap metrics by ericallam · Pull Request #3437 · triggerdotdev/trigger.dev
Description: Summary Adds direct V8 heap and process-memory gauges to the webapp's OpenTelemetry meter. The webapp already exports per-cluster-worker Node.js runtime metrics (event-loop lag / utilization, active handles, active requests, libuv threadpool size) via a custom meter under the trigger.dev scope. Heap and memory were missing; this PR adds them alongside, in the same observable-batch pattern. New gauges Metric Source Unit nodejs.memory.heap.used process.memoryUsage().heapUsed bytes nodejs.memory.heap.total process.memoryUsage().heapTotal bytes nodejs.memory.heap.limit v8.getHeapStatistics().heap_size_limit bytes nodejs.memory.external process.memoryUsage().external bytes nodejs.memory.array_buffers process.memoryUsage().arrayBuffers bytes nodejs.memory.rss process.memoryUsage().rss bytes Gated by the existing INTERNAL_OTEL_NODEJS_METRICS_ENABLED flag, same as the adjacent event-loop / handle gauges. Zero overhead when disabled. Why @opentelemetry/host-metrics publishes process.memory.usage, which is RSS only. RSS is the sum of V8 heap, external memory (Buffers, etc.), native code, and thread stacks. Without a direct heap metric it is not possible to size the V8 heap cap (--max-old-space-size) from metrics alone, because RSS overstates heap by the external + native footprint. A worker can have a 4 GB RSS with a 2.5 GB heap and 1.5 GB of buffers; the former constrains --max-old-space-size, the latter does not. nodejs.memory.heap.limit also surfaces the configured --max-old-space-size (read from v8.getHeapStatistics().heap_size_limit), so operators can see the current limit in the same dashboard as actual usage rather than cross-referencing container environment variables. Risk Minimal. Observable gauges are sampled at the configured metric-export interval. v8.getHeapStatistics() and process.memoryUsage() are each microsecond-level calls, and six gauges are added to the same batch callback that already reads ~20 other Node.js runtime values per sample. Same registration pattern as the existing event-loop metrics in the file. Test plan Deploy and confirm the six new gauges appear at the configured exporter In cluster mode, confirm per-worker granularity (one series per cluster worker, tagged by process.executable.name / service.instance.id) Confirm nodejs.memory.heap.limit reports the configured --max-old-space-size value in bytes
Open Graph Description: Summary Adds direct V8 heap and process-memory gauges to the webapp's OpenTelemetry meter. The webapp already exports per-cluster-worker Node.js runtime metrics (event-loop lag / utilization, a...
X Description: Summary Adds direct V8 heap and process-memory gauges to the webapp's OpenTelemetry meter. The webapp already exports per-cluster-worker Node.js runtime metrics (event-loop lag / utilizatio...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/3437
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:00bda511-31b7-314a-54d8-1ed2de8e19b0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9402:3C1EA1:36F784B:4ACAA1C:6AFAF28B |
| html-safe-nonce | a154e88f7b450f9c6f47dd0049512e47082f938fef53e23c5e36a8b6a48cdfa9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDAyOjNDMUVBMTozNkY3ODRCOjRBQ0FBMUM6NkFGQUYyOEIiLCJ2aXNpdG9yX2lkIjoiMTI5MjcxMzA3NTQ1NDcwMjIxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7b004438e13adbbe2080e61c0c667e8ffb0c59a9ceec81153af2c6c6dc52593f |
| hovercard-subject-tag | pull_request:3574826301 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/3437/files |
| twitter:image | https://avatars.githubusercontent.com/u/534?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/534?s=400&v=4 |
| og:image:alt | Summary Adds direct V8 heap and process-memory gauges to the webapp's OpenTelemetry meter. The webapp already exports per-cluster-worker Node.js runtime metrics (event-loop lag / utilization, a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0178036d8230524a18422872393ab7e708443ae4c2047f758560a2db870c1913 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a85e96a83bed7871993e6b1ffda24105928eee17 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width