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
This commit is contained in:
Luiz Aoqui
2020-12-07 10:43:08 -05:00
committed by GitHub
parent 582d3b7092
commit 0dcf6035b7
2 changed files with 7 additions and 14 deletions

View File

@@ -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

View File

@@ -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