From 3ba610b0976f9ef1c2e8335006e695f0c11cb657 Mon Sep 17 00:00:00 2001 From: Ben Reedy Date: Mon, 22 Jan 2024 08:11:26 +1000 Subject: [PATCH] fix: Apply query filter to metrics Signed-off-by: Ben Reedy --- pkg/collector/handler.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/collector/handler.go b/pkg/collector/handler.go index 068532e70..ce3ff28d7 100644 --- a/pkg/collector/handler.go +++ b/pkg/collector/handler.go @@ -32,7 +32,14 @@ func (c *Collectors) BuildServeHTTP(disableExporterMetrics bool, timeoutMargin f } filteredCollectors[name] = col } - return nil, NewPrometheus(timeout, c, c.logger) + + filtered := Collectors{ + logger: c.logger, + collectors: filteredCollectors, + perfCounterQuery: c.perfCounterQuery, + } + + return nil, NewPrometheus(timeout, &filtered, c.logger) } return func(w http.ResponseWriter, r *http.Request) {