Skip to content

Commit

Permalink
docs: update autoscaling docs for the new query interface (#8917)
Browse files Browse the repository at this point in the history
* update autoscaling docs for the new query interface
* update default value for query_window in scaling policy
  • Loading branch information
lgfa29 authored Dec 7, 2020
1 parent 582d3b7 commit 0dcf603
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 3 additions & 14 deletions website/pages/docs/autoscaling/plugins/apm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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))"
...
}
```
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions website/pages/docs/autoscaling/policy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,6 +87,7 @@ policy {
check "active_connections" {
source = "prometheus"
query = "scalar(open_connections_example_cache)"
query_window = "5m"
strategy "target_value" {
target = 10
Expand Down

0 comments on commit 0dcf603

Please sign in to comment.