From 766988b77ba9b548f902526b9628fa65075b93e4 Mon Sep 17 00:00:00 2001 From: Cecylia Bocovich Date: Tue, 9 Sep 2025 18:18:42 -0400 Subject: [PATCH] Add proxy type label to ProxyPollTotal metric Annotate ProxyPollTotal prometheus metrics with the proxy type so that we can track counts of proxies that are matched and that answer by implementation. This will help us catch bugs by implementation or deployment. --- broker/ipc.go | 4 ++-- broker/metrics.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/broker/ipc.go b/broker/ipc.go index 7e2951c..d58baec 100644 --- a/broker/ipc.go +++ b/broker/ipc.go @@ -108,7 +108,7 @@ func (i *IPC) ProxyPolls(arg messages.Arg, response *[]byte) error { if offer == nil { i.ctx.metrics.IncrementCounter("proxy-idle") - i.ctx.metrics.promMetrics.ProxyPollTotal.With(prometheus.Labels{"nat": natType, "status": "idle"}).Inc() + i.ctx.metrics.promMetrics.ProxyPollTotal.With(prometheus.Labels{"nat": natType, "type": proxyType, "status": "idle"}).Inc() b, err = messages.EncodePollResponse("", false, "") if err != nil { @@ -119,7 +119,7 @@ func (i *IPC) ProxyPolls(arg messages.Arg, response *[]byte) error { return nil } - i.ctx.metrics.promMetrics.ProxyPollTotal.With(prometheus.Labels{"nat": natType, "status": "matched"}).Inc() + i.ctx.metrics.promMetrics.ProxyPollTotal.With(prometheus.Labels{"nat": natType, "type": proxyType, "status": "matched"}).Inc() var relayURL string bridgeFingerprint, err := bridgefingerprint.FingerprintFromBytes(offer.fingerprint) if err != nil { diff --git a/broker/metrics.go b/broker/metrics.go index ae1183c..c1d4e4a 100644 --- a/broker/metrics.go +++ b/broker/metrics.go @@ -329,7 +329,7 @@ func initPrometheus() *PromMetrics { Name: "rounded_proxy_poll_total", Help: "The number of snowflake proxy polls, rounded up to a multiple of 8", }, - []string{"nat", "status"}, + []string{"nat", "type", "status"}, ) promMetrics.ProxyAnswerTotal = safeprom.NewCounterVec(