Skip to content

Commit 5901dd9

Browse files
dashboard: set default Prometheus job
Set default Prometheus job to "tarantool". After this patch, it will be possible to import dashboard with community.ansible.ansible_dashboard, if Prometheus is configured to collect Tarantool metrics with "tarantool" job. This patch also changes all examples job names to "tarantool". Part of #138
1 parent 595ad3c commit 5901dd9

18 files changed

+561
-559
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
## Added
1010
- Options to build static dashboards
1111

12+
## Changed
13+
- Set default Prometheus job to `tarantool`
14+
1215

1316
## [1.3.0] - 2022-06-29
1417
Grafana revisions: [InfluxDB revision 13](https://grafana.com/api/dashboards/12567/revisions/13/download), [Prometheus revision 13](https://grafana.com/api/dashboards/13054/revisions/13/download), [InfluxDB TDG revision 2](https://grafana.com/api/dashboards/16405/revisions/2/download), [Prometheus TDG revision 2](https://grafana.com/api/dashboards/16406/revisions/2/download).

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
JOB ?= tarantool
12
RATE_TIME_RANGE ?= 2m
23
POLICY ?= autogen
34
OUTPUT_STATIC_DASHBOARD ?= dashboard.json
@@ -14,10 +15,7 @@ ifndef DATASOURCE
1415
@echo 1>&2 "DATASOURCE must be set"
1516
false
1617
endif
17-
ifndef JOB
18-
@echo 1>&2 "JOB must be set"
19-
false
20-
endif
18+
# JOB is optional, default is "tarantool"
2119
# RATE_TIME_RANGE is optional, default is "2m"
2220
jsonnet -J ./vendor -J . \
2321
--ext-str DATASOURCE=${DATASOURCE} \

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ To set up an InfluxDB dashboard for monitoring example app, use the following va
8181

8282
To set up an Prometheus dashboard for monitoring example app, use the following variables:
8383

84-
- `Job`: `tarantool_app`;
84+
- `Job`: `tarantool`;
8585
- `Rate time range`: `2m`.
8686

8787
### Monitoring local app
@@ -116,7 +116,7 @@ to install build dependencies and dependencies that are required to run tests lo
116116

117117
To build a static dashboard with no input and dynamic variables, run `make` commands.
118118
```bash
119-
make DATASOURCE=MyPrometheus JOB=MyApp \
119+
make DATASOURCE=Prometheus JOB=tarantool \
120120
OUTPUT_STATIC_DASHBOARD=mydashboard.json build-static-prometheus
121121
```
122122
Following targets are available:
@@ -127,7 +127,7 @@ Following targets are available:
127127

128128
Variables for Prometheus targets:
129129
- `DATASOURCE`: name of a Prometheus data source;
130-
- `JOB`: name of a Prometheus job collecting your application metrics;
130+
- `JOB` (optional, default `tarantool`): name of a Prometheus job collecting your application metrics;
131131
- `RATE_TIME_RANGE` (optional, default `2m`): rps computation rate time range;
132132
- `OUTPUT_STATIC_DASHBOARD` (optional, default `dashboard.json`): compiled dashboard file.
133133

dashboard/build/prometheus/dashboard.libsonnet

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ dashboard_raw(
1818
name='PROMETHEUS_JOB',
1919
label='Job',
2020
type='constant',
21-
pluginId=null,
22-
pluginName=null,
21+
value='tarantool',
2322
description='Prometheus Tarantool metrics job'
2423
).addInput(
2524
name='PROMETHEUS_RATE_TIME_RANGE',

dashboard/build/prometheus/tdg_dashboard.libsonnet

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ tdg_dashboard_raw(
1818
name='PROMETHEUS_JOB',
1919
label='Job',
2020
type='constant',
21-
pluginId=null,
22-
pluginName=null,
21+
value='tarantool',
2322
description='Prometheus Tarantool metrics job'
2423
).addInput(
2524
name='PROMETHEUS_RATE_TIME_RANGE',

doc/monitoring/grafana_dashboard.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ metrics path as it was configured on Tarantool instances:
7979
.. code-block:: yaml
8080
8181
scrape_configs:
82-
- job_name: "example_project"
82+
- job_name: tarantool
8383
static_configs:
8484
- targets:
8585
- "example_project:8081"

example_cluster/prometheus/alerts.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ groups:
179179
rules:
180180
# Alert for CRUD module request errors.
181181
- alert: CRUDHighErrorRate
182-
expr: rate(tnt_crud_stats_count{ job="tarantool_app", status="error" }[5m]) > 0.1
182+
expr: rate(tnt_crud_stats_count{ job="tarantool", status="error" }[5m]) > 0.1
183183
for: 1m
184184
labels:
185185
severity: critical
@@ -190,7 +190,7 @@ groups:
190190

191191
# Warning for CRUD module requests too long responses.
192192
- alert: CRUDHighLatency
193-
expr: tnt_crud_stats{ job="tarantool_app", quantile="0.99" } > 0.1
193+
expr: tnt_crud_stats{ job="tarantool", quantile="0.99" } > 0.1
194194
for: 1m
195195
labels:
196196
severity: warning
@@ -201,7 +201,7 @@ groups:
201201

202202
# Warning for too many map reduce CRUD module requests.
203203
- alert: CRUDHighMapReduceRate
204-
expr: rate(tnt_crud_map_reduces{ job="tarantool_app" }[5m]) > 0.1
204+
expr: rate(tnt_crud_map_reduces{ job="tarantool" }[5m]) > 0.1
205205
for: 1m
206206
labels:
207207
severity: warning
@@ -214,12 +214,12 @@ groups:
214214

215215
- name: tarantool-business
216216
rules:
217-
# Warning for any endpoint of an instance in tarantool_app job that responds too long.
217+
# Warning for any endpoint of an instance in tarantool job that responds too long.
218218
# Beware that metric name depends on name of the collector you use in HTTP metrics middleware
219219
# and request depends on type of this collector.
220220
# This example based on summary collector with default name.
221221
- alert: HTTPHighLatency
222-
expr: http_server_request_latency{ job="tarantool_app", quantile="0.99" } > 0.1
222+
expr: http_server_request_latency{ job="tarantool", quantile="0.99" } > 0.1
223223
for: 5m
224224
labels:
225225
severity: warning
@@ -228,12 +228,12 @@ groups:
228228
description: "Some {{ $labels.method }} requests to {{ $labels.path }} path with {{ $labels.status }} response status
229229
on '{{ $labels.alias }}' instance of job '{{ $labels.job }}' are processed too long."
230230

231-
# Warning for any endpoint of an instance in tarantool_app job that sends too much 4xx responses.
231+
# Warning for any endpoint of an instance in tarantool job that sends too much 4xx responses.
232232
# Beware that metric name depends on name of the collector you use in HTTP metrics middleware
233233
# and request depends on type of this collector.
234234
# This example based on summary collector with default name.
235235
- alert: HTTPHighClientErrorRateInstance
236-
expr: sum by (job, instance, method, path, alias) (rate(http_server_request_latency_count{ job="tarantool_app", status=~"^4\\d{2}$" }[5m])) > 10
236+
expr: sum by (job, instance, method, path, alias) (rate(http_server_request_latency_count{ job="tarantool", status=~"^4\\d{2}$" }[5m])) > 10
237237
for: 1m
238238
labels:
239239
severity: warning
@@ -242,12 +242,12 @@ groups:
242242
description: "Too many {{ $labels.method }} requests to {{ $labels.path }} path
243243
on '{{ $labels.alias }}' instance of job '{{ $labels.job }}' get client error (4xx) responses."
244244

245-
# Warning for any endpoint in tarantool_app job that sends too much 4xx responses (cluster overall).
245+
# Warning for any endpoint in tarantool job that sends too much 4xx responses (cluster overall).
246246
# Beware that metric name depends on name of the collector you use in HTTP metrics middleware
247247
# and request depends on type of this collector.
248248
# This example based on summary collector with default name.
249249
- alert: HTTPHighClientErrorRate
250-
expr: sum by (job, method, path) (rate(http_server_request_latency_count{ job="tarantool_app", status=~"^4\\d{2}$" }[5m])) > 20
250+
expr: sum by (job, method, path) (rate(http_server_request_latency_count{ job="tarantool", status=~"^4\\d{2}$" }[5m])) > 20
251251
for: 1m
252252
labels:
253253
severity: warning
@@ -256,12 +256,12 @@ groups:
256256
description: "Too many {{ $labels.method }} requests to {{ $labels.path }} path
257257
on instances of job '{{ $labels.job }}' get client error (4xx) responses."
258258

259-
# Warning for any endpoint of an instance in tarantool_app job that sends 5xx responses.
259+
# Warning for any endpoint of an instance in tarantool job that sends 5xx responses.
260260
# Beware that metric name depends on name of the collector you use in HTTP metrics middleware
261261
# and request depends on type of this collector.
262262
# This example based on summary collector with default name.
263263
- alert: HTTPServerErrors
264-
expr: sum by (job, instance, method, path, alias) (rate(http_server_request_latency_count{ job="tarantool_app", status=~"^5\\d{2}$" }[5m])) > 0
264+
expr: sum by (job, instance, method, path, alias) (rate(http_server_request_latency_count{ job="tarantool", status=~"^5\\d{2}$" }[5m])) > 0
265265
for: 1m
266266
labels:
267267
severity: warning
@@ -270,12 +270,12 @@ groups:
270270
description: "Some {{ $labels.method }} requests to {{ $labels.path }} path
271271
on '{{ $labels.alias }}' instance of job '{{ $labels.job }}' get server error (5xx) responses."
272272

273-
# Warning for any endpoint of a router instance (with "router" in alias) in tarantool_app job that gets too little requests.
273+
# Warning for any endpoint of a router instance (with "router" in alias) in tarantool job that gets too little requests.
274274
# Beware that metric name depends on name of the collector you use in HTTP metrics middleware
275275
# and request depends on type of this collector.
276276
# This example based on summary collector with default name.
277277
- alert: HTTPLowRequestRateRouter
278-
expr: sum by (job, instance, alias) (rate(http_server_request_latency_count{ job="tarantool_app", alias=~"^.*router.*$" }[5m])) < 10
278+
expr: sum by (job, instance, alias) (rate(http_server_request_latency_count{ job="tarantool", alias=~"^.*router.*$" }[5m])) < 10
279279
for: 5m
280280
labels:
281281
severity: warning

example_cluster/prometheus/prometheus.localapp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ scrape_configs:
2727
static_configs:
2828
- targets: ["localhost:9090"]
2929

30-
- job_name: "tarantool_app"
30+
- job_name: "tarantool"
3131
static_configs:
3232
- targets:
3333
- "host.docker.internal:8081"

example_cluster/prometheus/prometheus.tdg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ scrape_configs:
2727
static_configs:
2828
- targets: ["localhost:9090"]
2929

30-
- job_name: "tarantool_app"
30+
- job_name: "tarantool"
3131
static_configs:
3232
- targets:
3333
- "tdg:8080"

example_cluster/prometheus/prometheus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ scrape_configs:
2727
static_configs:
2828
- targets: ["localhost:9090"]
2929

30-
- job_name: "tarantool_app"
30+
- job_name: "tarantool"
3131
static_configs:
3232
- targets:
3333
- "app:8081"

0 commit comments

Comments
 (0)