From 6e9daff6edef07811bad49d4dd777f516b68569c 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 068532e7..ce3ff28d 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) {