mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape/discovery/gce: do not pass filter arg when discovering zones
The filter arg isn't supported by zones API in GCE. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3202
This commit is contained in:
parent
05ed98c98b
commit
95f0266558
3 changed files with 6 additions and 3 deletions
|
@ -26,6 +26,7 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
|||
* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): add default alert list for vmalert's metrics. See [alerts-vmalert.yml](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/alerts-vmalert.yml).
|
||||
|
||||
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly return an empty result from [limit_offset](https://docs.victoriametrics.com/MetricsQL.html#limit_offset) if the `offset` arg exceeds the number of inner time series. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3312).
|
||||
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): properly discover GCE zones when `filter` option is set at [gce_sd_configs](https://docs.victoriametrics.com/sd_configs.html#gce_sd_configs). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3202).
|
||||
* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): properly display the requested graph on the requested time range when navigating from Prometheus URL in Grafana.
|
||||
* BUGFIX: reduce CPU usage spikes and memory usage spikes under high data ingestion rate introduced in [v1.83.0](https://docs.victoriametrics.com/CHANGELOG.html#v1830). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3343).
|
||||
|
||||
|
|
|
@ -58,7 +58,9 @@ func newAPIConfig(sdc *SDConfig) (*apiConfig, error) {
|
|||
logger.Infof("autodetected the current GCE zone: %q", zone)
|
||||
} else if len(zones) == 1 && zones[0] == "*" {
|
||||
// Autodetect zones for project.
|
||||
zs, err := getZonesForProject(client, project, sdc.Filter)
|
||||
// Do not pass sdc.Filter when discovering zones, since GCE doesn't support it.
|
||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3202
|
||||
zs, err := getZonesForProject(client, project)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot obtain zones for project %q: %w", project, err)
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@ import (
|
|||
"net/http"
|
||||
)
|
||||
|
||||
func getZonesForProject(client *http.Client, project, filter string) ([]string, error) {
|
||||
func getZonesForProject(client *http.Client, project string) ([]string, error) {
|
||||
// See https://cloud.google.com/compute/docs/reference/rest/v1/zones
|
||||
zonesURL := fmt.Sprintf("https://compute.googleapis.com/compute/v1/projects/%s/zones", project)
|
||||
var zones []string
|
||||
pageToken := ""
|
||||
for {
|
||||
data, err := getAPIResponse(client, zonesURL, filter, pageToken)
|
||||
data, err := getAPIResponse(client, zonesURL, "", pageToken)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot obtain zones: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue