This commit is contained in:
Raven Scott
2026-07-18 16:22:56 -04:00
parent 015d92a257
commit f747ffbd25
36 changed files with 1975 additions and 873 deletions
+6 -2
View File
@@ -5,10 +5,14 @@ import fs from 'fs'
import path from 'path'
const MUTATING = new Set([
'postMessage',
'clearMessages',
'mintInvite',
'revokePeer',
'setAlertConfig',
'ackAlert',
'silenceAlert',
'runJob',
'cancelJob',
'exportSnapshot',
'handshake',
])
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Export formatters (JSON / Prometheus / shell) for /api/v*/allmetrics.
* Export formatters (JSON / Prometheus / shell) for /api/v1|v2|v3/allmetrics.
*/
import os from 'os'
import { getStore } from '../services/store.js'
+4 -2
View File
@@ -122,7 +122,9 @@ export class MetricsCollector extends EventEmitter {
*/
constructor(opts = {}) {
super()
this.intervalMs = opts.intervalMs ?? Number(process.env.PEARDATA_SAMPLE_MS) || SAMPLE_INTERVAL_MS
this.intervalMs =
opts.intervalMs ??
(Number(process.env.PEARDATA_SAMPLE_MS) || SAMPLE_INTERVAL_MS)
this.timer = null
this.running = false
this.sampleCount = 0
@@ -257,7 +259,7 @@ export class MetricsCollector extends EventEmitter {
values: {
running: load.running,
blocked: 0,
total: load.total || Object.keys(process || {}).length,
total: load.total || 0,
},
})