[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 c3b333b762)
This commit is contained in:
Brendan O'Handley authored and GitHub committed 2023-11-06 12:06:18 -05:00
1 parent f29bfde02e
commit 194e2741a9
1 file changed
+5
+5
View File
@@ -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)