mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
fixes all_tenants query option usage for openstack service discovery (#2184)
explicit use configuration parametr instead of conditional add https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2182
This commit is contained in:
parent
d924f4b7ba
commit
c90c1c4d54
2 changed files with 5 additions and 7 deletions
|
@ -33,7 +33,7 @@ type apiConfig struct {
|
||||||
// tokenLock guards creds refresh
|
// tokenLock guards creds refresh
|
||||||
tokenLock sync.Mutex
|
tokenLock sync.Mutex
|
||||||
creds *apiCredentials
|
creds *apiCredentials
|
||||||
// authTokenReq contins request body for apiCredentials
|
// authTokenReq contains request body for apiCredentials
|
||||||
authTokenReq []byte
|
authTokenReq []byte
|
||||||
// keystone endpoint
|
// keystone endpoint
|
||||||
endpoint *url.URL
|
endpoint *url.URL
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discoveryutils"
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discoveryutils"
|
||||||
)
|
)
|
||||||
|
@ -110,12 +111,9 @@ func (cfg *apiConfig) getServers() ([]server, error) {
|
||||||
}
|
}
|
||||||
computeURL := *creds.computeURL
|
computeURL := *creds.computeURL
|
||||||
computeURL.Path = path.Join(computeURL.Path, "servers", "detail")
|
computeURL.Path = path.Join(computeURL.Path, "servers", "detail")
|
||||||
// by default, query fetches data from all tenants
|
q := computeURL.Query()
|
||||||
if !cfg.allTenants {
|
q.Set("all_tenants", strconv.FormatBool(cfg.allTenants))
|
||||||
q := computeURL.Query()
|
computeURL.RawQuery = q.Encode()
|
||||||
q.Set("all_tenants", "false")
|
|
||||||
computeURL.RawQuery = q.Encode()
|
|
||||||
}
|
|
||||||
nextLink := computeURL.String()
|
nextLink := computeURL.String()
|
||||||
var servers []server
|
var servers []server
|
||||||
for {
|
for {
|
||||||
|
|
Loading…
Reference in a new issue