mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09: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:
parent
42e0c015e8
commit
073cd4f0ba
1 changed files with 4 additions and 11 deletions
|
@ -171,14 +171,9 @@ export class NodeJSObserversBuilder {
|
||||||
private buildActiveResourcesObserver () {
|
private buildActiveResourcesObserver () {
|
||||||
if (typeof (process as any).getActiveResourcesInfo !== 'function') return
|
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.'
|
description: 'Number of active resources that are currently keeping the event loop alive, grouped by async resource type.'
|
||||||
})
|
}).addCallback(observableResult => {
|
||||||
const total = this.meter.createObservableCounter('nodejs_active_resources_total', {
|
|
||||||
description: 'Total number of active resources.'
|
|
||||||
})
|
|
||||||
|
|
||||||
this.meter.addBatchObservableCallback(observableResult => {
|
|
||||||
const resources = (process as any).getActiveResourcesInfo()
|
const resources = (process as any).getActiveResourcesInfo()
|
||||||
|
|
||||||
const data = {}
|
const data = {}
|
||||||
|
@ -192,10 +187,8 @@ export class NodeJSObserversBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const type of Object.keys(data)) {
|
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 ])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue