From e2358d3bd5bdf5c00f1f59e59c00d3bacf9e41b6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 8 May 2023 16:11:41 -0700 Subject: [PATCH] docs: clarify docs after 5ee344824ffe6509a5caaa3ddcdb0ccbd7a1de0d Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4183 --- docs/CHANGELOG.md | 2 +- docs/sd_configs.md | 12 ++++++------ lib/promscrape/discovery/consul/watch.go | 9 +++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index df47228ec..5a6c39e57 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -30,7 +30,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * FEATURE: [vmbackup](https://docs.victoriametrics.com/vmbackup.html): store backup creation and completion time in `backup_complete.ignore` file of backup contents. This is useful to determine point in time when backup was created and completed. * FEATURE: [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html): add `created_at` field to the output of `/api/v1/backups` API and `vmbackupmanager backup list` command. See this [doc](https://docs.victoriametrics.com/vmbackupmanager.html#api-methods) for data format details. * FEATURE: deprecate `-bigMergeConcurrency` command-line flag, since improper configuration for this flag frequently led to uncontrolled growth of unmerged parts, which, in turn, could lead to queries slowdown and increased CPU usage. The concurrency for [background merges](https://docs.victoriametrics.com/#storage) can be controlled via `-smallMergeConcurrency` command-line flag, though it isn't recommended to do in general case. -* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): support new filtering options `filter` and `node_filter` for [consul service discovery](https://docs.victoriametrics.com/sd_configs.html#consul_sd_configs). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4183) for details. +* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): support the ability to filter [consul_sd_configs](https://docs.victoriametrics.com/sd_configs.html#consul_sd_configs) targets in more optimal way via new `filter` option. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4183). * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): support new [consulagent service discovery](https://docs.victoriametrics.com/sd_configs.html#consulagent_sd_configs). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3953) for details. * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): emit a warning if `-remoteWrite.maxDiskUsagePerURL` command-line flag has too small value. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4195). * FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): add support for [different time formats](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#timestamp-formats) for `--vm-native-filter-time-start` and `--vm-native-filter-time-end` command-line flags. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4091). diff --git a/docs/sd_configs.md b/docs/sd_configs.md index 1096743e1..7345e1357 100644 --- a/docs/sd_configs.md +++ b/docs/sd_configs.md @@ -163,12 +163,12 @@ scrape_configs: # Individual tags are also available via __meta_consul_tag_ labels - see below. # tag_separator: "..." - # filter is optional filter for service nodes discovery request. - # Replaces tags and node_metadata options. - # consul supports it since 1.14 version - # list of supported filters https://developer.hashicorp.com/consul/api-docs/catalog#filtering-1 - # syntax examples https://developer.hashicorp.com/consul/api-docs/features/filtering - # filter: "..." + # filter is an optional filter for service discovery. + # Replaces tags and node_meta options. + # Consul supports it since 1.14 version. + # See the list of supported filters at https://developer.hashicorp.com/consul/api-docs/catalog#filtering-1 + # See filter examples at https://developer.hashicorp.com/consul/api-docs/features/filtering + # filter: "..." # allow_stale is an optional config, which allows stale Consul results. # See https://www.consul.io/api/features/consistency.html diff --git a/lib/promscrape/discovery/consul/watch.go b/lib/promscrape/discovery/consul/watch.go index 53cbb1038..ca17dd00c 100644 --- a/lib/promscrape/discovery/consul/watch.go +++ b/lib/promscrape/discovery/consul/watch.go @@ -64,19 +64,20 @@ func newConsulWatcher(client *discoveryutils.Client, sdc *SDConfig, datacenter, } serviceNodesQueryArgs := baseQueryArgs + // tag is supported only by /v1/health/service/... and isn't supported by /v1/catalog/services for _, tag := range sdc.Tags { serviceNodesQueryArgs += "&tag=" + url.QueryEscape(tag) } - // filter could be added only for baseQuery requests for /v1/catalog/services - // serviceNodesQueryArgs doesn't support it + serviceNamesQueryArgs := baseQueryArgs + // filter is supported only by /v1/catalog/services and isn't supported by /v1/health/service/... if len(sdc.Filter) > 0 { - baseQueryArgs += "&filter=" + url.QueryEscape(sdc.Filter) + serviceNamesQueryArgs += "&filter=" + url.QueryEscape(sdc.Filter) } cw := &consulWatcher{ client: client, - serviceNamesQueryArgs: baseQueryArgs, + serviceNamesQueryArgs: serviceNamesQueryArgs, serviceNodesQueryArgs: serviceNodesQueryArgs, watchServices: sdc.Services, watchTags: sdc.Tags,