From 194e2741a9d3cb2f10768f22c4a5c0fba02f1bd0 Mon Sep 17 00:00:00 2001 From: Brendan O'Handley Date: Mon, 6 Nov 2023 12:06:18 -0500 Subject: [PATCH] [v10.2.x] Prometheus: set httpMethod as POST for new query client when not defined (#77736) set httpMethod as POST for new query client when not defined (cherry picked from commit c3b333b762251b3f9251d16846f533682e8f35e6) --- pkg/tsdb/prometheus/querydata/request.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/tsdb/prometheus/querydata/request.go b/pkg/tsdb/prometheus/querydata/request.go index fec1e9c6bf1..bfca8f1c10b 100644 --- a/pkg/tsdb/prometheus/querydata/request.go +++ b/pkg/tsdb/prometheus/querydata/request.go @@ -64,6 +64,10 @@ func New( return nil, err } + if httpMethod == "" { + httpMethod = http.MethodPost + } + promClient := client.NewClient(httpClient, httpMethod, settings.URL) // standard deviation sampler is the default for backwards compatibility @@ -97,6 +101,7 @@ func (s *QueryData) Execute(ctx context.Context, req *backend.QueryDataRequest) if err != nil { return &result, err } + r := s.fetch(ctx, s.client, query, req.Headers) if r == nil { s.log.FromContext(ctx).Debug("Received nil response from runQuery", "query", query.Expr)