From 0dcf6035b72ede2b3c34923e770a461a25fe5019 Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Mon, 7 Dec 2020 10:43:08 -0500 Subject: [PATCH] docs: update autoscaling docs for the new query interface (#8917) * update autoscaling docs for the new query interface * update default value for query_window in scaling policy --- website/pages/docs/autoscaling/plugins/apm.mdx | 17 +++-------------- website/pages/docs/autoscaling/policy.mdx | 4 ++++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/website/pages/docs/autoscaling/plugins/apm.mdx b/website/pages/docs/autoscaling/plugins/apm.mdx index 8742cfa1c..908cff252 100644 --- a/website/pages/docs/autoscaling/plugins/apm.mdx +++ b/website/pages/docs/autoscaling/plugins/apm.mdx @@ -15,9 +15,7 @@ scaling should occur. ## Prometheus APM Plugin Use [Prometheus][prometheus_io] metrics to scale your Nomad job task groups or -cluster. The query performed on Prometheus should return a single value. You can -use the [scalar][prometheus_scaler_function] function in your query to achieve -this. +cluster. ### Agent Configuration Options @@ -39,7 +37,7 @@ apm "prometheus" { ```hcl check { source = "prometheus" - query = "scalar(avg((haproxy_server_current_sessions{backend=\"http_back\"}) and (haproxy_server_up{backend=\"http_back\"} == 1)))" + query = "avg((haproxy_server_current_sessions{backend=\"http_back\"}) and (haproxy_server_up{backend=\"http_back\"} == 1))" ... } ``` @@ -74,20 +72,11 @@ configuration parameters take precedence over the environment variables. ```hcl check { source = "datadog" - query = "FROM=2m;TO=0m;QUERY=avg:proxy.backend.response.time{proxy-service:web-app}" + query = "avg:proxy.backend.response.time{proxy-service:web-app}" ... } ``` -The query consists of three sections, each separated using a `;` delimiter. More -information on the arguments can be found on the [Datadog site][datadog_timeseries]. - -- `FROM` - A time offset which indicates the start of the queried time period. - -- `TO` - A time offset which indicates the end of the queried time period. - -- `QUERY` - The query string to execute. - ## Nomad APM Plugin The Nomad APM plugin allows querying the Nomad API for metric data. This provides diff --git a/website/pages/docs/autoscaling/policy.mdx b/website/pages/docs/autoscaling/policy.mdx index 8866d6ef5..44b827eee 100644 --- a/website/pages/docs/autoscaling/policy.mdx +++ b/website/pages/docs/autoscaling/policy.mdx @@ -57,6 +57,9 @@ horizontal application scaling or horizontal cluster scaling. should return a single value. Detailed information on the configuration options can be found on the [APM Plugins][apm_plugin_docs] page. +- `query_window` - Defines how far back to query the APM for metrics. It should + be provided as a duration (e.g.: `"5s"`, `"1m"`). Defaults to `1m`. + - `strategy` - The strategy to use, and it's configuration when calculating the desired state based on the current count and the metric returned by the APM. Detailed information on the configuration options can be found on the @@ -84,6 +87,7 @@ policy { check "active_connections" { source = "prometheus" query = "scalar(open_connections_example_cache)" + query_window = "5m" strategy "target_value" { target = 10