mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
server/server -> server/core
This commit is contained in:
parent
114327d4ce
commit
5a3d0650c9
838 changed files with 111 additions and 111 deletions
|
@ -0,0 +1,24 @@
|
|||
import { Meter } from '@opentelemetry/api'
|
||||
import { JobQueue } from '@server/lib/job-queue/index.js'
|
||||
|
||||
export class JobQueueObserversBuilder {
|
||||
|
||||
constructor (private readonly meter: Meter) {
|
||||
|
||||
}
|
||||
|
||||
buildObservers () {
|
||||
this.meter.createObservableGauge('peertube_job_queue_total', {
|
||||
description: 'Total jobs in the PeerTube job queue'
|
||||
}).addCallback(async observableResult => {
|
||||
const stats = await JobQueue.Instance.getStats()
|
||||
|
||||
for (const { jobType, counts } of stats) {
|
||||
for (const state of Object.keys(counts)) {
|
||||
observableResult.observe(counts[state], { jobType, state })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue