join pipelines_total.

This commit is contained in:
Miroslav Šedivý 2022-06-19 00:51:17 +02:00
parent ef7e9b1a53
commit 5ab4848580
4 changed files with 47 additions and 21 deletions

View File

@ -44,8 +44,14 @@ func broadcastNew(pipelineStr string) *BroacastManagerCtx {
pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total",
Namespace: "neko",
Subsystem: "capture_broadcast",
Subsystem: "capture",
Help: "Total number of created pipelines.",
ConstLabels: map[string]string{
"submodule": "broadcast",
"video_id": "main",
"codec_name": "-",
"codec_type": "-",
},
}),
}
}

View File

@ -55,16 +55,22 @@ func screencastNew(enabled bool, pipelineStr string) *ScreencastManagerCtx {
// metrics
imagesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "images_total",
Name: "screencast_images_total",
Namespace: "neko",
Subsystem: "capture_screencast",
Subsystem: "capture",
Help: "Total number of created images.",
}),
pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total",
Namespace: "neko",
Subsystem: "capture_screencast",
Subsystem: "capture",
Help: "Total number of created pipelines.",
ConstLabels: map[string]string{
"submodule": "screencast",
"video_id": "main",
"codec_name": "-",
"codec_type": "-",
},
}),
}

View File

@ -50,23 +50,26 @@ func streamSinkNew(codec codec.RTPCodec, pipelineStr func() string, video_id str
// metrics
currentListeners: promauto.NewGauge(prometheus.GaugeOpts{
Name: "listeners",
Name: "streamsink_listeners",
Namespace: "neko",
Subsystem: "capture_streamsink",
Subsystem: "capture",
Help: "Current number of listeners for a pipeline.",
ConstLabels: map[string]string{
"video_id": video_id,
"codec": codec.Name,
"video_id": video_id,
"codec_name": codec.Name,
"codec_type": codec.Type.String(),
},
}),
pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total",
Namespace: "neko",
Subsystem: "capture_streamsink",
Subsystem: "capture",
Help: "Total number of created pipelines.",
ConstLabels: map[string]string{
"video_id": video_id,
"codec": codec.Name,
"submodule": "streamsink",
"video_id": video_id,
"codec_name": codec.Name,
"codec_type": codec.Type.String(),
},
}),
}

View File

@ -37,25 +37,36 @@ func streamSrcNew(enabled bool, codecPipeline map[string]string, video_id string
pushedData := map[string]prometheus.Summary{}
pipelinesCounter := map[string]prometheus.Counter{}
for codec := range codecPipeline {
pushedData[codec] = promauto.NewSummary(prometheus.SummaryOpts{
Name: "data_bytes",
for codecName, pipeline := range codecPipeline {
codec, ok := codec.ParseStr(codecName)
if !ok {
logger.Fatal().
Str("codec", codecName).
Str("pipeline", pipeline).
Msg("unknown codec name")
}
pushedData[codecName] = promauto.NewSummary(prometheus.SummaryOpts{
Name: "streamsrc_data_bytes",
Namespace: "neko",
Subsystem: "capture_streamsrc",
Subsystem: "capture",
Help: "Data pushed to a pipeline (in bytes).",
ConstLabels: map[string]string{
"video_id": video_id,
"codec": codec,
"video_id": video_id,
"codec_name": codec.Name,
"codec_type": codec.Type.String(),
},
})
pipelinesCounter[codec] = promauto.NewCounter(prometheus.CounterOpts{
pipelinesCounter[codecName] = promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total",
Namespace: "neko",
Subsystem: "capture_streamsrc",
Subsystem: "capture",
Help: "Total number of created pipelines.",
ConstLabels: map[string]string{
"video_id": video_id,
"codec": codec,
"submodule": "streamsrc",
"video_id": video_id,
"codec_name": codec.Name,
"codec_type": codec.Type.String(),
},
})
}