Skip to content

Commit 386148a

Browse files
dashboard: set InfluxDB policy dynamically
After this patch, user may choose InfluxDB policy from the list of policies instead of manually setting up a constant policy on import. Part of #185
1 parent b2d8727 commit 386148a

File tree

9 files changed

+621
-588
lines changed

9 files changed

+621
-588
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Replace LuaJit deprecated metrics with new ones
1111
- Set Prometheus `job` dynamically
1212
- Set InfluxDB `measurement` dynamically
13+
- Set InfluxDB `policy` dynamically
1314

1415

1516
## [1.5.0] - 2022-09-22

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,12 @@ Refer to dashboard [documentation page](https://www.tarantool.io/en/doc/latest/b
4040
- paste the dashboard JSON file contents, or
4141
- upload the dashboard JSON file.
4242

43-
3. Set dashboard name, folder, uid, choose corresponding datasource from drop-down list and set datasource-related query parameters.
43+
3. Set dashboard name, folder, uid and choose corresponding datasource from drop-down list.
4444

4545
![Dashboard import variables](doc/monitoring/images/grafana_import_setup.png)
4646

47-
You need to set the following variables for InfluxDB datasource:
48-
49-
- `Policy` (default valie is `autogen`).
50-
51-
Datasource variables can be obtained from your datasource configuration.
5247
You can choose `job` variable value for Prometheus datasource after import.
53-
You can choose `measurement` variable value for InfluxDB datasource after import.
54-
Variables for example monitoring cluster are described in [Monitoring cluster](#monitoring-cluster) section.
48+
You can choose `policy` and `measurement` variable values for InfluxDB datasource after import.
5549

5650

5751
## Monitoring cluster
@@ -70,10 +64,6 @@ We recommend using the exact versions we use in experimental cluster (e.g. Grafa
7064
After start, Grafana UI will be available at [localhost:3000](http://localhost:3000/).
7165
You can also interact with Prometheus at [localhost:9090](http://localhost:9090/) and InfluxDB at [localhost:8086](http://localhost:8086/).
7266

73-
To set up an InfluxDB dashboard for monitoring example app, use the following variables:
74-
75-
- `Policy`: `default`.
76-
7767
### Monitoring local app
7868

7969
If you want to monitor Tarantool cluster deployed on your local host, you can use monitoring cluster similar to example app one.

dashboard/build/influxdb/dashboard.libsonnet

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ dashboard_raw(
1515
pluginId='influxdb',
1616
pluginName='InfluxDB',
1717
description='InfluxDB Tarantool metrics bank'
18-
).addInput(
19-
name='INFLUXDB_POLICY',
20-
label='Policy',
21-
type='constant',
22-
value='autogen',
23-
description='InfluxDB Tarantool metrics policy'
18+
).addTemplate(
19+
grafana.template.new(
20+
name='policy',
21+
datasource=variable.datasource.influxdb,
22+
query='SHOW RETENTION POLICIES',
23+
label='Retention policy',
24+
refresh='load',
25+
)
2426
).addTemplate(
2527
grafana.template.new(
2628
name='measurement',

dashboard/build/influxdb/tdg_dashboard.libsonnet

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ tdg_dashboard_raw(
1515
pluginId='influxdb',
1616
pluginName='InfluxDB',
1717
description='InfluxDB Tarantool metrics bank'
18-
).addInput(
19-
name='INFLUXDB_POLICY',
20-
label='Policy',
21-
type='constant',
22-
value='autogen',
23-
description='InfluxDB Tarantool metrics policy'
18+
).addTemplate(
19+
grafana.template.new(
20+
name='policy',
21+
datasource=variable.datasource.influxdb,
22+
query='SHOW RETENTION POLICIES',
23+
label='Retention policy',
24+
refresh='load',
25+
)
2426
).addTemplate(
2527
grafana.template.new(
2628
name='measurement',

dashboard/variable.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
alias: '$alias',
1313
},
1414
influxdb: {
15-
policy: '${INFLUXDB_POLICY}',
15+
policy: '$policy',
1616
measurement: '$measurement',
1717
alias: '/^$alias$/',
1818
},

doc/monitoring/grafana_dashboard.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ To import a specific dashboard, choose one of the following options:
207207
- paste the dashboard JSON file contents, or
208208
- upload the dashboard JSON file.
209209

210-
Set dashboard name, folder, uid (if needed), and datasource-related query parameters
211-
(InfluxDB source and policy or Prometheus source).
210+
Set dashboard name, folder, uid (if needed) and datasource.
212211

213212
.. image:: images/grafana_import_setup.png
214213
:align: left

0 commit comments

Comments
 (0)