From 5ec9e491038c823778391341286b4e1d6a2909a6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 25 Mar 2021 17:54:55 +0200 Subject: [PATCH] docs/vmagent.md: add an example for `-remoteWrite.label` --- app/vmagent/README.md | 10 +++++++--- app/vmagent/remotewrite/relabel.go | 2 +- docs/vmagent.md | 10 +++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/vmagent/README.md b/app/vmagent/README.md index 235ea25f0..3b00d5153 100644 --- a/app/vmagent/README.md +++ b/app/vmagent/README.md @@ -197,8 +197,12 @@ The file pointed by `-promscrape.config` may contain `%{ENV_VAR}` placeholders w Labels can be added to metrics by the following mechanisms: -* The `global -> external_labels` section in `-promscrape.config` file. These labels are added only to metrics scraped from targets configured in the `-promscrape.config` file. -* The `-remoteWrite.label` command-line flag. These labels are added to all the collected metrics before sending them to `-remoteWrite.url`. +* The `global -> external_labels` section in `-promscrape.config` file. These labels are added only to metrics scraped from targets configured in the `-promscrape.config` file. They aren't added to metrics collected via other [data ingestion protocols](https://victoriametrics.github.io/#how-to-import-time-series-data). +* The `-remoteWrite.label` command-line flag. These labels are added to all the collected metrics before sending them to `-remoteWrite.url`. For example, the following command will start `vmagent`, which will add `{datacenter="foobar"}` label to all the metrics pushed to all the configured remote storage systems (all the `-remoteWrite.url` flag values): + +``` +/path/to/vmagent -remoteWrite.label=datacenter=foobar ... +``` ## Relabeling @@ -642,7 +646,7 @@ See the docs at https://victoriametrics.github.io/vmagent.html . -remoteWrite.flushInterval duration Interval for flushing the data to remote storage. This option takes effect only when less than 10K data points per second are pushed to -remoteWrite.url (default 1s) -remoteWrite.label array - Optional label in the form 'name=value' to add to all the metrics before sending them to -remoteWrite.url. Pass multiple -remoteWrite.label flags in order to add multiple flags to metrics before sending them to remote storage + Optional label in the form 'name=value' to add to all the metrics before sending them to -remoteWrite.url. Pass multiple -remoteWrite.label flags in order to add multiple labels to metrics before sending them to remote storage Supports array of values separated by comma or specified via multiple flags. -remoteWrite.maxBlockSize size The maximum size in bytes of unpacked request to send to remote storage. It shouldn't exceed -maxInsertRequestSize from VictoriaMetrics diff --git a/app/vmagent/remotewrite/relabel.go b/app/vmagent/remotewrite/relabel.go index ad7c967f6..7c05e9af8 100644 --- a/app/vmagent/remotewrite/relabel.go +++ b/app/vmagent/remotewrite/relabel.go @@ -14,7 +14,7 @@ import ( var ( unparsedLabelsGlobal = flagutil.NewArray("remoteWrite.label", "Optional label in the form 'name=value' to add to all the metrics before sending them to -remoteWrite.url. "+ - "Pass multiple -remoteWrite.label flags in order to add multiple flags to metrics before sending them to remote storage") + "Pass multiple -remoteWrite.label flags in order to add multiple labels to metrics before sending them to remote storage") relabelConfigPathGlobal = flag.String("remoteWrite.relabelConfig", "", "Optional path to file with relabel_config entries. These entries are applied to all the metrics "+ "before sending them to -remoteWrite.url. See https://victoriametrics.github.io/vmagent.html#relabeling for details") relabelConfigPaths = flagutil.NewArray("remoteWrite.urlRelabelConfig", "Optional path to relabel config for the corresponding -remoteWrite.url") diff --git a/docs/vmagent.md b/docs/vmagent.md index 235ea25f0..3b00d5153 100644 --- a/docs/vmagent.md +++ b/docs/vmagent.md @@ -197,8 +197,12 @@ The file pointed by `-promscrape.config` may contain `%{ENV_VAR}` placeholders w Labels can be added to metrics by the following mechanisms: -* The `global -> external_labels` section in `-promscrape.config` file. These labels are added only to metrics scraped from targets configured in the `-promscrape.config` file. -* The `-remoteWrite.label` command-line flag. These labels are added to all the collected metrics before sending them to `-remoteWrite.url`. +* The `global -> external_labels` section in `-promscrape.config` file. These labels are added only to metrics scraped from targets configured in the `-promscrape.config` file. They aren't added to metrics collected via other [data ingestion protocols](https://victoriametrics.github.io/#how-to-import-time-series-data). +* The `-remoteWrite.label` command-line flag. These labels are added to all the collected metrics before sending them to `-remoteWrite.url`. For example, the following command will start `vmagent`, which will add `{datacenter="foobar"}` label to all the metrics pushed to all the configured remote storage systems (all the `-remoteWrite.url` flag values): + +``` +/path/to/vmagent -remoteWrite.label=datacenter=foobar ... +``` ## Relabeling @@ -642,7 +646,7 @@ See the docs at https://victoriametrics.github.io/vmagent.html . -remoteWrite.flushInterval duration Interval for flushing the data to remote storage. This option takes effect only when less than 10K data points per second are pushed to -remoteWrite.url (default 1s) -remoteWrite.label array - Optional label in the form 'name=value' to add to all the metrics before sending them to -remoteWrite.url. Pass multiple -remoteWrite.label flags in order to add multiple flags to metrics before sending them to remote storage + Optional label in the form 'name=value' to add to all the metrics before sending them to -remoteWrite.url. Pass multiple -remoteWrite.label flags in order to add multiple labels to metrics before sending them to remote storage Supports array of values separated by comma or specified via multiple flags. -remoteWrite.maxBlockSize size The maximum size in bytes of unpacked request to send to remote storage. It shouldn't exceed -maxInsertRequestSize from VictoriaMetrics