From 517bf634e5af35ae57495e2c80fad332440731c7 Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Mon, 11 Mar 2024 19:31:28 -0400 Subject: [PATCH] Metric `gubernator_getratelimit_counter` adds calltype value "local non-owner" Better tracks the code path. Can exclude non-owner activity. Can get accurate total rate limit checks with query like `rate(gubernator_getratelimit_counter{calltype="local"}[1m])` --- gubernator.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gubernator.go b/gubernator.go index 280821f3..19d5db50 100644 --- a/gubernator.go +++ b/gubernator.go @@ -605,7 +605,11 @@ func (s *V1Instance) getLocalRateLimit(ctx context.Context, r *RateLimitReq, rs s.global.QueueUpdate(r) } - metricGetRateLimitCounter.WithLabelValues("local").Inc() + if rs.IsOwner { + metricGetRateLimitCounter.WithLabelValues("local").Inc() + } else { + metricGetRateLimitCounter.WithLabelValues("local non-owner").Inc() + } return resp, nil }