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{ pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total", Name: "pipelines_total",
Namespace: "neko", Namespace: "neko",
Subsystem: "capture_broadcast", Subsystem: "capture",
Help: "Total number of created pipelines.", 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 // metrics
imagesCounter: promauto.NewCounter(prometheus.CounterOpts{ imagesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "images_total", Name: "screencast_images_total",
Namespace: "neko", Namespace: "neko",
Subsystem: "capture_screencast", Subsystem: "capture",
Help: "Total number of created images.", Help: "Total number of created images.",
}), }),
pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{ pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total", Name: "pipelines_total",
Namespace: "neko", Namespace: "neko",
Subsystem: "capture_screencast", Subsystem: "capture",
Help: "Total number of created pipelines.", 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 // metrics
currentListeners: promauto.NewGauge(prometheus.GaugeOpts{ currentListeners: promauto.NewGauge(prometheus.GaugeOpts{
Name: "listeners", Name: "streamsink_listeners",
Namespace: "neko", Namespace: "neko",
Subsystem: "capture_streamsink", Subsystem: "capture",
Help: "Current number of listeners for a pipeline.", Help: "Current number of listeners for a pipeline.",
ConstLabels: map[string]string{ ConstLabels: map[string]string{
"video_id": video_id, "video_id": video_id,
"codec": codec.Name, "codec_name": codec.Name,
"codec_type": codec.Type.String(),
}, },
}), }),
pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{ pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total", Name: "pipelines_total",
Namespace: "neko", Namespace: "neko",
Subsystem: "capture_streamsink", Subsystem: "capture",
Help: "Total number of created pipelines.", Help: "Total number of created pipelines.",
ConstLabels: map[string]string{ ConstLabels: map[string]string{
"video_id": video_id, "submodule": "streamsink",
"codec": codec.Name, "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{} pushedData := map[string]prometheus.Summary{}
pipelinesCounter := map[string]prometheus.Counter{} pipelinesCounter := map[string]prometheus.Counter{}
for codec := range codecPipeline { for codecName, pipeline := range codecPipeline {
pushedData[codec] = promauto.NewSummary(prometheus.SummaryOpts{ codec, ok := codec.ParseStr(codecName)
Name: "data_bytes", 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", Namespace: "neko",
Subsystem: "capture_streamsrc", Subsystem: "capture",
Help: "Data pushed to a pipeline (in bytes).", Help: "Data pushed to a pipeline (in bytes).",
ConstLabels: map[string]string{ ConstLabels: map[string]string{
"video_id": video_id, "video_id": video_id,
"codec": codec, "codec_name": codec.Name,
"codec_type": codec.Type.String(),
}, },
}) })
pipelinesCounter[codec] = promauto.NewCounter(prometheus.CounterOpts{ pipelinesCounter[codecName] = promauto.NewCounter(prometheus.CounterOpts{
Name: "pipelines_total", Name: "pipelines_total",
Namespace: "neko", Namespace: "neko",
Subsystem: "capture_streamsrc", Subsystem: "capture",
Help: "Total number of created pipelines.", Help: "Total number of created pipelines.",
ConstLabels: map[string]string{ ConstLabels: map[string]string{
"video_id": video_id, "submodule": "streamsrc",
"codec": codec, "video_id": video_id,
"codec_name": codec.Name,
"codec_type": codec.Type.String(),
}, },
}) })
} }