diff --git a/docs/changelog/CHANGELOG.md b/docs/changelog/CHANGELOG.md index 1cdb765805..8f914e2c5b 100644 --- a/docs/changelog/CHANGELOG.md +++ b/docs/changelog/CHANGELOG.md @@ -23,6 +23,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). * FEATURE [stream aggregation](https://docs.victoriametrics.com/stream-aggregation/): perform deduplication for all received data when specifying `-streamAggr.dedupInterval` or `-remoteWrite.streamAggr.dedupInterval` command-line flags are set. Previously, if the `-remoteWrite.streamAggr.config` or `-streamAggr.config` is set, only series that matched aggregation config were deduplicated. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6711#issuecomment-2288361213) for details. * FEATURE: all VictoriaMetrics [enterprise](https://docs.victoriametrics.com/enterprise/) components: add support of hot-reload for license key supplied by `-licenseFile` command-line flag. +* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent/) fix service discovery of Azure Virtual Machines for response contains `nextLink` in `Host:Port` format. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6912). * BUGFIX: [vmagent dashboard](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/dashboards/vmagent.json): fix legend captions for stream aggregation related panels. Before they were displaying wrong label names. * BUGFIX: [vmgateway](https://docs.victoriametrics.com/vmgateway/): add missing `datadog`, `newrelic`, `opentelemetry` and `pushgateway` routes to the `JWT` authorization routes. Allows prefixed (`promtheus/graphite`) routes for query requests. * BUGFIX: [Single-node VictoriaMetrics](https://docs.victoriametrics.com/) and `vmstorage` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/): fix metric `vm_object_references{type="indexdb"}`. Previously, it was overcounted. diff --git a/lib/promscrape/discovery/azure/api.go b/lib/promscrape/discovery/azure/api.go index e21257d697..a7087deee3 100644 --- a/lib/promscrape/discovery/azure/api.go +++ b/lib/promscrape/discovery/azure/api.go @@ -122,7 +122,7 @@ func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) { cfg := &apiConfig{ c: c, - apiServerHost: u.Host, + apiServerHost: u.Hostname(), port: port, resourceGroup: sdc.ResourceGroup, subscriptionID: sdc.SubscriptionID, diff --git a/lib/promscrape/discovery/azure/machine.go b/lib/promscrape/discovery/azure/machine.go index 491d80b365..a46da299da 100644 --- a/lib/promscrape/discovery/azure/machine.go +++ b/lib/promscrape/discovery/azure/machine.go @@ -96,8 +96,10 @@ func visitAllAPIObjects(ac *apiConfig, apiURL string, cb func(data json.RawMessa return fmt.Errorf("cannot parse nextLink from response %q: %w", lar.NextLink, err) } - if nextURL.Host != "" && nextURL.Host != ac.apiServerHost { - return fmt.Errorf("unexpected nextLink host %q, expecting %q", nextURL.Host, ac.apiServerHost) + // Sometimes Azure will respond a host with a port. Since all possible apiServer defined in cloudEnvironments do not include a port, + // it is best to check the host without the port. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6912 + if nextURL.Host != "" && nextURL.Hostname() != ac.apiServerHost { + return fmt.Errorf("unexpected nextLink host %q, expecting %q", nextURL.Hostname(), ac.apiServerHost) } nextLinkURI = nextURL.RequestURI() diff --git a/lib/promscrape/discovery/azure/machine_test.go b/lib/promscrape/discovery/azure/machine_test.go index 06710c192b..dccc371525 100644 --- a/lib/promscrape/discovery/azure/machine_test.go +++ b/lib/promscrape/discovery/azure/machine_test.go @@ -91,7 +91,7 @@ func TestGetVirtualMachinesSuccess(t *testing.T) { defer c.Stop() ac := &apiConfig{ c: c, - apiServerHost: u.Host, + apiServerHost: u.Hostname(), subscriptionID: "some-id", refreshToken: func() (string, time.Duration, error) { return "auth-token", 0, nil