From c45c61cf931a2bbb0366f675dbf64fef2dfd70d3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 5 Oct 2022 23:57:29 +0300 Subject: [PATCH] app/vmalert: follow-up after f8ac55d70ada9ef8490b322abefb05f28f75e2e9 * Use vm_account_id and vm_project_id labels to be consistent with https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#multitenancy-via-labels * Document the feature that vmalert now exposes vm_account_id and vm_project_id labels if -clusterMode is set. * Use literal strings instead of string constants for vm_account_id and vm_project_id. This improves code readability. --- app/vmalert/README.md | 5 +++++ docs/vmalert.md | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/vmalert/README.md b/app/vmalert/README.md index 01e5fd42d..9402dfa43 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -331,6 +331,11 @@ groups: # Rules for accountID=456, projectID=789 ``` +The results of alerting and recording rules contain `vm_account_id` and `vm_project_id` labels +if `-clusterMode` is enabled. These labels can be used during [templating](https://docs.victoriametrics.com/vmalert.html#templating). +The results of alerting and recording rules with these labels can be stored to the corresponding tenants at VictoriaMetrics cluster +via [multitenant endpoint](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#multitenancy-via-labels). + If `-clusterMode` is enabled, then `-datasource.url`, `-remoteRead.url` and `-remoteWrite.url` must contain only the hostname without tenant id. For example: `-datasource.url=http://vmselect:8481`. `vmalert` automatically adds the specified tenant to urls per each recording rule in this case. diff --git a/docs/vmalert.md b/docs/vmalert.md index 56c8e7423..40a3be06e 100644 --- a/docs/vmalert.md +++ b/docs/vmalert.md @@ -335,6 +335,11 @@ groups: # Rules for accountID=456, projectID=789 ``` +The results of alerting and recording rules contain `vm_account_id` and `vm_project_id` labels +if `-clusterMode` is enabled. These labels can be used during [templating](https://docs.victoriametrics.com/vmalert.html#templating). +The results of alerting and recording rules with these labels can be stored to the corresponding tenants at VictoriaMetrics cluster +via [multitenant endpoint](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#multitenancy-via-labels). + If `-clusterMode` is enabled, then `-datasource.url`, `-remoteRead.url` and `-remoteWrite.url` must contain only the hostname without tenant id. For example: `-datasource.url=http://vmselect:8481`. `vmalert` automatically adds the specified tenant to urls per each recording rule in this case.