From c69d2fd91f2471cd3525ea45f9578cdf7ebf7380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Mon, 26 Aug 2024 11:06:41 +0200 Subject: [PATCH] Add 'catalyst=true' label to Mist-enriched metrics (#1367) --- mapic/mistmetrics.go | 1 + mapic/mistmetrics_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mapic/mistmetrics.go b/mapic/mistmetrics.go index 96213531e..907c97b3b 100644 --- a/mapic/mistmetrics.go +++ b/mapic/mistmetrics.go @@ -75,6 +75,7 @@ func (mc *mac) parsePlaybackID(line string) (string, bool) { func (mc *mac) enrichLabels(playbackID string) string { res := mc.streamLabel(playbackID) + res += `,catalyst="true"` si, err := mc.getStreamInfo(playbackID) if err != nil { glog.Warning("could not enrich Mist metrics for stream=%s err=%v", playbackID, err) diff --git a/mapic/mistmetrics_test.go b/mapic/mistmetrics_test.go index 55d73f487..02e943fde 100644 --- a/mapic/mistmetrics_test.go +++ b/mapic/mistmetrics_test.go @@ -42,10 +42,10 @@ func TestEnrichMistMetrics(t *testing.T) { expLines := []string{ `version{app="MistServer",version="729ddd4b42980d0124c72a46f13d8e0697293e94",release="Generic_x86_64"} 1`, - `mist_sessions{stream="video+077bh6xx5bx5tdua",user_id="abcdefgh-123456789",sessType="viewers"}1`, - `mist_latency{stream="video+077bh6xx5bx5tdua",user_id="abcdefgh-123456789",source="sin-prod-catalyst-3.lp-playback.studio"}1795`, - `mist_sessions{stream="video+51b13mqy7sgw520w",user_id="hgfedcba-987654321",sessType="viewers"}5`, - `mist_latency{stream="video+51b13mqy7sgw520w",user_id="hgfedcba-987654321",source="prg-prod-catalyst-0.lp-playback.studio"}1156`, + `mist_sessions{stream="video+077bh6xx5bx5tdua",catalyst="true",user_id="abcdefgh-123456789",sessType="viewers"}1`, + `mist_latency{stream="video+077bh6xx5bx5tdua",catalyst="true",user_id="abcdefgh-123456789",source="sin-prod-catalyst-3.lp-playback.studio"}1795`, + `mist_sessions{stream="video+51b13mqy7sgw520w",catalyst="true",user_id="hgfedcba-987654321",sessType="viewers"}5`, + `mist_latency{stream="video+51b13mqy7sgw520w",catalyst="true",user_id="hgfedcba-987654321",source="prg-prod-catalyst-0.lp-playback.studio"}1156`, } for _, exp := range expLines { require.Contains(t, resLines, exp)