Skip to content

Commit 6eea18e

Browse files
committed
add eventLoopUtilization to metrics
1 parent 5f6b887 commit 6eea18e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

apps/meteor/app/metrics/server/lib/metrics.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { performance } from 'node:perf_hooks';
2+
13
import client from 'prom-client';
24

35
const percentiles = [0.01, 0.1, 0.5, 0.9, 0.95, 0.99, 1];
@@ -233,3 +235,13 @@ export const metrics = {
233235
};
234236

235237
// Metrics
238+
let eluBase = performance.eventLoopUtilization();
239+
240+
new client.Gauge({
241+
name: 'nodejs_event_loop_utilization',
242+
help: 'Event Loop Utilization (ELU) as reported by Node',
243+
collect() {
244+
this.set(performance.eventLoopUtilization(eluBase).utilization);
245+
eluBase = performance.eventLoopUtilization();
246+
},
247+
});

0 commit comments

Comments
 (0)