From 304996bc082e53296a7c294494613fcd6f5fa66e Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Thu, 14 Nov 2024 18:21:35 +0800 Subject: [PATCH] docs/vmalert: clarify some vmalert flags Some flags are shared between datasourceURL and remoteReadURL, some flags are not valid for victoriaLogs as the datasource. --- app/vmalert/datasource/client_prom.go | 3 ++- app/vmalert/datasource/init.go | 6 +++--- docs/vmalert.md | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/vmalert/datasource/client_prom.go b/app/vmalert/datasource/client_prom.go index 4747e8c51..08dd6d72e 100644 --- a/app/vmalert/datasource/client_prom.go +++ b/app/vmalert/datasource/client_prom.go @@ -16,7 +16,8 @@ import ( var ( disablePathAppend = flag.Bool("remoteRead.disablePathAppend", false, "Whether to disable automatic appending of '/api/v1/query' or '/select/logsql/stats_query' path "+ "to the configured -datasource.url and -remoteRead.url") - disableStepParam = flag.Bool("datasource.disableStepParam", false, "Whether to disable adding 'step' param to the issued instant queries. "+ + disableStepParam = flag.Bool("datasource.disableStepParam", false, "Whether to disable adding 'step' param in instant queries to the configured -datasource.url and -remoteRead.url. "+ + "Only valid for prometheus datasource. "+ "This might be useful when using vmalert with datasources that do not support 'step' param for instant queries, like Google Managed Prometheus. "+ "It is not recommended to enable this flag if you use vmalert with VictoriaMetrics.") ) diff --git a/app/vmalert/datasource/init.go b/app/vmalert/datasource/init.go index 4e163ab71..1ef18762a 100644 --- a/app/vmalert/datasource/init.go +++ b/app/vmalert/datasource/init.go @@ -51,7 +51,7 @@ var ( lookBack = flag.Duration("datasource.lookback", 0, `Deprecated: please adjust "-search.latencyOffset" at datasource side `+ `or specify "latency_offset" in rule group's params. Lookback defines how far into the past to look when evaluating queries. `+ `For example, if the datasource.lookback=5m then param "time" with value now()-5m will be added to every query.`) - queryStep = flag.Duration("datasource.queryStep", 5*time.Minute, "How far a value can fallback to when evaluating queries. "+ + queryStep = flag.Duration("datasource.queryStep", 5*time.Minute, "How far a value can fallback to when evaluating queries to the configured -datasource.url and -remoteRead.url. Only valid for prometheus datasource. "+ "For example, if -datasource.queryStep=15s then param \"step\" with value \"15s\" will be added to every query. "+ "If set to 0, rule's evaluation interval will be used instead.") queryTimeAlignment = flag.Bool("datasource.queryTimeAlignment", true, `Deprecated: please use "eval_alignment" in rule group instead. `+ @@ -62,8 +62,8 @@ var ( idleConnectionTimeout = flag.Duration("datasource.idleConnTimeout", 50*time.Second, `Defines a duration for idle (keep-alive connections) to exist. Consider setting this value less than "-http.idleConnTimeout". It must prevent possible "write: broken pipe" and "read: connection reset by peer" errors.`) disableKeepAlive = flag.Bool("datasource.disableKeepAlive", false, `Whether to disable long-lived connections to the datasource. `+ `If true, disables HTTP keep-alive and will only use the connection to the server for a single HTTP request.`) - roundDigits = flag.Int("datasource.roundDigits", 0, `Adds "round_digits" GET param to datasource requests. `+ - `In VM "round_digits" limits the number of digits after the decimal point in response values.`) + roundDigits = flag.Int("datasource.roundDigits", 0, `Adds "round_digits" GET param to datasource requests which limits the number of digits after the decimal point in response values. `+ + `Only valid for VictoriaMetrics as the datasource.`) ) // InitSecretFlags must be called after flag.Parse and before any logging diff --git a/docs/vmalert.md b/docs/vmalert.md index 94e03a03b..78f051e3a 100644 --- a/docs/vmalert.md +++ b/docs/vmalert.md @@ -1052,7 +1052,7 @@ The shortlist of configuration flags is the following: -datasource.disableKeepAlive Whether to disable long-lived connections to the datasource. If true, disables HTTP keep-alive and will only use the connection to the server for a single HTTP request. -datasource.disableStepParam - Whether to disable adding 'step' param to the issued instant queries. This might be useful when using vmalert with datasources that do not support 'step' param for instant queries, like Google Managed Prometheus. It is not recommended to enable this flag if you use vmalert with VictoriaMetrics. + Whether to disable adding 'step' param in instant queries to the configured -datasource.url and -remoteRead.url. Only valid for prometheus datasource. This might be useful when using vmalert with datasources that do not support 'step' param for instant queries, like Google Managed Prometheus. It is not recommended to enable this flag if you use vmalert with VictoriaMetrics. -datasource.headers string Optional HTTP extraHeaders to send with each request to the corresponding -datasource.url. For example, -datasource.headers='My-Auth:foobar' would send 'My-Auth: foobar' HTTP header with every request to the corresponding -datasource.url. Multiple headers must be delimited by '^^': -datasource.headers='header1:value1^^header2:value2' -datasource.idleConnTimeout duration @@ -1074,11 +1074,11 @@ The shortlist of configuration flags is the following: -datasource.oauth2.tokenUrl string Optional OAuth2 tokenURL to use for -datasource.url -datasource.queryStep duration - How far a value can fallback to when evaluating queries. For example, if -datasource.queryStep=15s then param "step" with value "15s" will be added to every query. If set to 0, rule's evaluation interval will be used instead. (default 5m0s) + How far a value can fallback to when evaluating queries to the configured -datasource.url and -remoteRead.url. Only valid for prometheus datasource. For example, if -datasource.queryStep=15s then param "step" with value "15s" will be added to every query. If set to 0, rule's evaluation interval will be used instead. (default 5m0s) -datasource.queryTimeAlignment Deprecated: please use "eval_alignment" in rule group instead. Whether to align "time" parameter with evaluation interval. Alignment supposed to produce deterministic results despite number of vmalert replicas or time they were started. See more details at https://github.com/VictoriaMetrics/VictoriaMetrics/pull/1257 (default true) -datasource.roundDigits int - Adds "round_digits" GET param to datasource requests. In VM "round_digits" limits the number of digits after the decimal point in response values. + Adds "round_digits" GET param to datasource requests which limits the number of digits after the decimal point in response values. Only valid for VictoriaMetrics as the datasource. -datasource.showURL Whether to avoid stripping sensitive information such as auth headers or passwords from URLs in log messages or UI and exported metrics. It is hidden by default, since it can contain sensitive info such as auth key -datasource.tlsCAFile string