mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-31 09:57:08 +02:00
add active pipelines.
This commit is contained in:
parent
5ab4848580
commit
555fd803bc
4 changed files with 78 additions and 11 deletions
|
@ -26,6 +26,7 @@ type BroacastManagerCtx struct {
|
|||
|
||||
// metrics
|
||||
pipelinesCounter prometheus.Counter
|
||||
pipelinesActive prometheus.Gauge
|
||||
}
|
||||
|
||||
func broadcastNew(pipelineStr string) *BroacastManagerCtx {
|
||||
|
@ -53,6 +54,18 @@ func broadcastNew(pipelineStr string) *BroacastManagerCtx {
|
|||
"codec_type": "-",
|
||||
},
|
||||
}),
|
||||
pipelinesActive: promauto.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "pipelines_active",
|
||||
Namespace: "neko",
|
||||
Subsystem: "capture",
|
||||
Help: "Total number of active pipelines.",
|
||||
ConstLabels: map[string]string{
|
||||
"submodule": "broadcast",
|
||||
"video_id": "main",
|
||||
"codec_name": "-",
|
||||
"codec_type": "-",
|
||||
},
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,6 +135,7 @@ func (manager *BroacastManagerCtx) createPipeline() error {
|
|||
|
||||
manager.pipeline.Play()
|
||||
manager.pipelinesCounter.Inc()
|
||||
manager.pipelinesActive.Set(1)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -137,4 +151,6 @@ func (manager *BroacastManagerCtx) destroyPipeline() {
|
|||
manager.pipeline.Destroy()
|
||||
manager.logger.Info().Msgf("destroying pipeline")
|
||||
manager.pipeline = nil
|
||||
|
||||
manager.pipelinesActive.Set(0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue