1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00

Fix nodejs_active_resources_total metric

Remove duplicate metric and transform it into a gauge because the value
can decrease
This commit is contained in:
Chocobozzz 2025-09-15 14:16:37 +02:00
parent 42e0c015e8
commit 073cd4f0ba
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -171,14 +171,9 @@ export class NodeJSObserversBuilder {
private buildActiveResourcesObserver () {
if (typeof (process as any).getActiveResourcesInfo !== 'function') return
const grouped = this.meter.createObservableCounter('nodejs_active_resources', {
this.meter.createObservableGauge('nodejs_active_resources_total', {
description: 'Number of active resources that are currently keeping the event loop alive, grouped by async resource type.'
})
const total = this.meter.createObservableCounter('nodejs_active_resources_total', {
description: 'Total number of active resources.'
})
this.meter.addBatchObservableCallback(observableResult => {
}).addCallback(observableResult => {
const resources = (process as any).getActiveResourcesInfo()
const data = {}
@ -192,10 +187,8 @@ export class NodeJSObserversBuilder {
}
for (const type of Object.keys(data)) {
observableResult.observe(grouped, data[type], { type })
observableResult.observe(data[type], { type })
}
observableResult.observe(total, resources.length)
}, [ grouped, total ])
})
}
}