From c17dc2fa7e980acd1035f1df204f43605bdcffcc Mon Sep 17 00:00:00 2001 From: Stnby Date: Wed, 27 Jul 2022 15:37:08 +0300 Subject: [PATCH] Fix panic in "Add total requests per colocation" (#71) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Laurynas Četyrkinas --- prometheus.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prometheus.go b/prometheus.go index 1b8fe6e..73b7b25 100644 --- a/prometheus.go +++ b/prometheus.go @@ -141,7 +141,7 @@ var ( zoneColocationRequestsTotal = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "cloudflare_zone_colocation_requests_total", Help: "Total requests per colocation", - }, []string{"zone", "colocation"}, + }, []string{"zone", "colocation", "host"}, ) zoneFirewallEventsCount = promauto.NewCounterVec(prometheus.CounterOpts{ @@ -246,7 +246,7 @@ func fetchZoneColocationAnalytics(zones []cloudflare.Zone, wg *sync.WaitGroup) { for _, c := range cg { zoneColocationVisits.With(prometheus.Labels{"zone": name, "colocation": c.Dimensions.ColoCode, "host": c.Dimensions.Host}).Add(float64(c.Sum.Visits)) zoneColocationEdgeResponseBytes.With(prometheus.Labels{"zone": name, "colocation": c.Dimensions.ColoCode, "host": c.Dimensions.Host}).Add(float64(c.Sum.EdgeResponseBytes)) - zoneColocationRequestsTotal.With(prometheus.Labels{"zone": name, "colocation": c.Dimensions.ColoCode, "host": c.Dimensions.Host}).Add(float64(c.Count)) + zoneColocationRequestsTotal.With(prometheus.Labels{"zone": name, "colocation": c.Dimensions.ColoCode, "host": c.Dimensions.Host}).Add(float64(c.Count)) } } }