Skip to content

Commit 605eb20

Browse files
dashboard: support title customization
Support title customization for dynamic code build and static build with make.
1 parent 143ed2c commit 605eb20

19 files changed

+93220
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
### Added
10+
- Dashboard title customization
11+
912
### Changed
1013
- Replace LuaJit deprecated metrics with new ones
1114
- Set Prometheus `job` dynamically

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ POLICY ?= autogen
33
MEASUREMENT ?= tarantool_http
44
WITH_INSTANCE_VARIABLE ?= FALSE
55
OUTPUT_STATIC_DASHBOARD ?= dashboard.json
6+
TITLE ?=
67

78
.PHONY: build-deps
89
build-deps:
@@ -18,10 +19,13 @@ ifndef DATASOURCE
1819
endif
1920
# JOB is optional, default is "tarantool"
2021
# WITH_INSTANCE_VARIABLE is optional, default is "FALSE"
22+
# TITLE is optional, default is "Tarantool dashboard" for plain dashboard
23+
# and "Tarantool Data Grid dashboard" for TDG one
2124
jsonnet -J ./vendor -J . \
2225
--ext-str DATASOURCE=${DATASOURCE} \
2326
--ext-str JOB=${JOB} \
2427
--ext-str WITH_INSTANCE_VARIABLE=${WITH_INSTANCE_VARIABLE} \
28+
--ext-str TITLE='${TITLE}' \
2529
dashboard/build/prometheus/${DASHBOARD_BUILD_SOURCE} -o ${OUTPUT_STATIC_DASHBOARD}
2630

2731
.PHONY: build-static-prometheus
@@ -41,11 +45,14 @@ endif
4145
# POLICY is optional, default is "autogen"
4246
# MEASUREMENT is optional, default is "tarantool_http"
4347
# WITH_INSTANCE_VARIABLE is optional, default is "FALSE"
48+
# TITLE is optional, default is "Tarantool dashboard" for plain dashboard
49+
# and "Tarantool Data Grid dashboard" for TDG one
4450
jsonnet -J ./vendor -J . \
4551
--ext-str DATASOURCE=${DATASOURCE} \
4652
--ext-str POLICY=${POLICY} \
4753
--ext-str MEASUREMENT=${MEASUREMENT} \
4854
--ext-str WITH_INSTANCE_VARIABLE=${WITH_INSTANCE_VARIABLE} \
55+
--ext-str TITLE='${TITLE}' \
4956
dashboard/build/influxdb/${DASHBOARD_BUILD_SOURCE} -o ${OUTPUT_STATIC_DASHBOARD}
5057

5158
.PHONY: build-static-influxdb

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Variables for Prometheus targets:
113113
- `JOB` (optional, default `tarantool`): name of a Prometheus job collecting your application metrics;
114114
- `WITH_INSTANCE_VARIABLE` (optional, default `FALSE`): build a dashboard with variable which
115115
can be used to select displayed cluster instances;
116+
- `TITLE` (optional, default `"Tarantool dashboard"` for plain dashboard
117+
and `"Tarantool Data Grid dashobard"` for TDG dashboard): dashboard title;
116118
- `OUTPUT_STATIC_DASHBOARD` (optional, default `dashboard.json`): compiled dashboard file.
117119

118120
Variables for InfluxDB targets:
@@ -121,6 +123,8 @@ Variables for InfluxDB targets:
121123
- `MEASUREMENT` (optional, default `tarantool_http`): name of a InfluxDB measurement with your application metrics;
122124
- `WITH_INSTANCE_VARIABLE` (optional, default `FALSE`): build a dashboard with variable which
123125
can be used to select displayed cluster instances;
126+
- `TITLE` (optional, default `"Tarantool dashboard"` for plain dashboard
127+
and `"Tarantool Data Grid dashobard"` for TDG dashboard): dashboard title;
124128
- `OUTPUT_STATIC_DASHBOARD` (optional, default `dashboard.json`): compiled dashboard file.
125129

126130
With `WITH_INSTANCE_VARIABLE=FALSE`, dashboard will contain no dynamic variables and Grafana alerts can be used.

dashboard/build/influxdb/dashboard_raw.libsonnet

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ local dashboard = import 'dashboard/dashboard.libsonnet';
44
local section = import 'dashboard/section.libsonnet';
55
local variable = import 'dashboard/variable.libsonnet';
66

7-
function(datasource, policy, measurement, alias) dashboard.new(
7+
function(
8+
datasource,
9+
policy,
10+
measurement,
11+
alias,
12+
title='',
13+
) dashboard.new(
814
grafana.dashboard.new(
9-
title='Tarantool dashboard',
15+
// Cannot use in-built means to work with defaults due to possible ext vars.
16+
title=(if title != '' then title else 'Tarantool dashboard'),
1017
description='Dashboard for Tarantool application and database server monitoring, based on grafonnet library.',
1118
editable=true,
1219
schemaVersion=21,

dashboard/build/influxdb/dashboard_static.jsonnet

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ local DATASOURCE = std.extVar('DATASOURCE');
77
local POLICY = std.extVar('POLICY');
88
local MEASUREMENT = std.extVar('MEASUREMENT');
99
local WITH_INSTANCE_VARIABLE = (std.asciiUpper(std.extVar('WITH_INSTANCE_VARIABLE')) == 'TRUE');
10+
local TITLE = std.extVar('TITLE');
1011

1112
if WITH_INSTANCE_VARIABLE then
1213
dashboard_raw(
1314
datasource=DATASOURCE,
1415
policy=POLICY,
1516
measurement=MEASUREMENT,
1617
alias=variable.influxdb.alias,
18+
title=TITLE,
1719
).addTemplate(
1820
grafana.template.new(
1921
name='alias',
@@ -38,4 +40,5 @@ else
3840
policy=std.extVar('POLICY'),
3941
measurement=std.extVar('MEASUREMENT'),
4042
alias='/^.*$/',
43+
title=TITLE,
4144
).build()

dashboard/build/influxdb/tdg_dashboard_raw.libsonnet

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ local dashboard = import 'dashboard/dashboard.libsonnet';
44
local section = import 'dashboard/section.libsonnet';
55
local variable = import 'dashboard/variable.libsonnet';
66

7-
function(datasource, policy, measurement, alias) dashboard.new(
7+
function(
8+
datasource,
9+
policy,
10+
measurement,
11+
alias,
12+
title='',
13+
) dashboard.new(
814
grafana.dashboard.new(
9-
title='Tarantool Data Grid dashboard',
15+
// Cannot use in-built means to work with defaults due to possible ext vars.
16+
title=(if title != '' then title else 'Tarantool Data Grid dashboard'),
1017
description='Dashboard for Tarantool Data Grid ver. 2 application monitoring, based on grafonnet library.',
1118
editable=true,
1219
schemaVersion=21,

dashboard/build/influxdb/tdg_dashboard_static.jsonnet

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ local DATASOURCE = std.extVar('DATASOURCE');
77
local POLICY = std.extVar('POLICY');
88
local MEASUREMENT = std.extVar('MEASUREMENT');
99
local WITH_INSTANCE_VARIABLE = (std.asciiUpper(std.extVar('WITH_INSTANCE_VARIABLE')) == 'TRUE');
10+
local TITLE = std.extVar('TITLE');
1011

1112
if WITH_INSTANCE_VARIABLE then
1213
tdg_dashboard_raw(
1314
datasource=DATASOURCE,
1415
policy=POLICY,
1516
measurement=MEASUREMENT,
1617
alias=variable.influxdb.alias,
18+
title=TITLE,
1719
).addTemplate(
1820
grafana.template.new(
1921
name='alias',
@@ -38,4 +40,5 @@ else
3840
policy=std.extVar('POLICY'),
3941
measurement=std.extVar('MEASUREMENT'),
4042
alias='/^.*$/',
43+
title=TITLE,
4144
).build()

dashboard/build/prometheus/dashboard_raw.libsonnet

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ local dashboard = import 'dashboard/dashboard.libsonnet';
44
local section = import 'dashboard/section.libsonnet';
55
local variable = import 'dashboard/variable.libsonnet';
66

7-
function(datasource, job, alias) dashboard.new(
7+
function(
8+
datasource,
9+
job,
10+
alias,
11+
title='',
12+
) dashboard.new(
813
grafana.dashboard.new(
9-
title='Tarantool dashboard',
14+
// Cannot use in-built means to work with defaults due to possible ext vars.
15+
title=(if title != '' then title else 'Tarantool dashboard'),
1016
description='Dashboard for Tarantool application and database server monitoring, based on grafonnet library.',
1117
editable=true,
1218
schemaVersion=21,

dashboard/build/prometheus/dashboard_static.jsonnet

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ local variable = import 'dashboard/variable.libsonnet';
66
local DATASOURCE = std.extVar('DATASOURCE');
77
local JOB = std.extVar('JOB');
88
local WITH_INSTANCE_VARIABLE = (std.asciiUpper(std.extVar('WITH_INSTANCE_VARIABLE')) == 'TRUE');
9+
local TITLE = std.extVar('TITLE');
910

1011
if WITH_INSTANCE_VARIABLE then
1112
dashboard_raw(
1213
datasource=DATASOURCE,
1314
job=JOB,
1415
alias=variable.prometheus.alias,
16+
title=TITLE,
1517
).addTemplate(
1618
grafana.template.new(
1719
name='alias',
@@ -29,4 +31,5 @@ else
2931
datasource=DATASOURCE,
3032
job=JOB,
3133
alias='.*',
34+
title=TITLE,
3235
).build()

dashboard/build/prometheus/tdg_dashboard_raw.libsonnet

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ local dashboard = import 'dashboard/dashboard.libsonnet';
44
local section = import 'dashboard/section.libsonnet';
55
local variable = import 'dashboard/variable.libsonnet';
66

7-
function(datasource, job, alias) dashboard.new(
7+
function(
8+
datasource,
9+
job,
10+
alias,
11+
title='',
12+
) dashboard.new(
813
grafana.dashboard.new(
9-
title='Tarantool Data Grid dashboard',
14+
// Cannot use in-built means to work with defaults due to possible ext vars.
15+
title=(if title != '' then title else 'Tarantool Data Grid dashboard'),
1016
description='Dashboard for Tarantool Data Grid ver. 2 application monitoring, based on grafonnet library.',
1117
editable=true,
1218
schemaVersion=21,

0 commit comments

Comments
 (0)