Elasticsearch/Prometheus: Set correct service namespace for SigV4 (#39439)

Makes sure to set the SigV4 service namespace for Elasticsearch and Prometheus.

Fixes #38440
This commit is contained in:
Marcus Efraimsson 2021-09-27 14:32:19 +02:00 committed by GitHub
parent bbf64722e4
commit 45a844e77e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -84,6 +84,11 @@ func newInstanceSettings() datasource.InstanceFactoryFunc {
return nil, fmt.Errorf("error getting http options: %w", err)
}
// Set SigV4 service namespace
if httpCliOpts.SigV4 != nil {
httpCliOpts.SigV4.Service = "es"
}
version, err := coerceVersion(jsonData["esVersion"])
if err != nil {

View File

@ -94,6 +94,11 @@ func newInstanceSettings() datasource.InstanceFactoryFunc {
return nil, fmt.Errorf("error getting http options: %w", err)
}
// Set SigV4 service namespace
if httpCliOpts.SigV4 != nil {
httpCliOpts.SigV4.Service = "aps"
}
httpMethod, ok := jsonData["httpMethod"].(string)
if !ok {
httpMethod = defaultHttpMethod