Prometheus: Set httpMethod as POST for new query client when not defined (#77503)

set httpMethod as POST for new query client when not defined
This commit is contained in:
Brendan O'Handley 2023-11-03 10:16:02 -04:00 committed by GitHub
parent ef7b583169
commit 6b729389b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)