Skip to content

Commit aba4dc9

Browse files
Add CPU time getrusage panels
Closes #71
1 parent dc044a6 commit aba4dc9

File tree

5 files changed

+686
-71
lines changed

5 files changed

+686
-71
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Cartridge issues panels and "Cluster overview" row
1414
- Network activity row and panels
1515
- Non-CRUD operations panels
16+
- CPU time getrusage panels
1617

1718
## Changed
1819
- Update metrics version to 0.9.0

tarantool/cpu.libsonnet

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
local grafana = import 'grafonnet/grafana.libsonnet';
2+
3+
local graph = grafana.graphPanel;
4+
local influxdb = grafana.influxdb;
5+
local prometheus = grafana.prometheus;
6+
7+
{
8+
local getrusage_cpu_time_graph(
9+
title,
10+
description,
11+
datasource,
12+
policy,
13+
measurement,
14+
job,
15+
rate_time_range,
16+
metric_name,
17+
) = graph.new(
18+
title=title,
19+
description=description,
20+
datasource=datasource,
21+
22+
format='s',
23+
labelY1='time per minute',
24+
fill=0,
25+
decimals=3,
26+
decimalsY1=3,
27+
sort='decreasing',
28+
legend_alignAsTable=true,
29+
legend_avg=true,
30+
legend_current=true,
31+
legend_max=true,
32+
legend_values=true,
33+
legend_sort='current',
34+
legend_sortDesc=true,
35+
).addTarget(
36+
if datasource == '${DS_PROMETHEUS}' then
37+
prometheus.target(
38+
expr=std.format('rate(%s{job=~"%s"}[%s])',
39+
[metric_name, job, rate_time_range]),
40+
legendFormat='{{alias}}',
41+
)
42+
else if datasource == '${DS_INFLUXDB}' then
43+
influxdb.target(
44+
policy=policy,
45+
measurement=measurement,
46+
group_tags=['label_pairs_alias'],
47+
alias='$tag_label_pairs_alias',
48+
).where('metric_name', '=', metric_name)
49+
.selectField('value').addConverter('mean').addConverter('non_negative_derivative', ['1s'])
50+
),
51+
52+
getrusage_cpu_user_time(
53+
title='CPU user time',
54+
description=|||
55+
This is the average amount of time per minute
56+
spent by instance process executing in user mode.
57+
Metrics obtained using `getrusage()` call.
58+
|||,
59+
datasource=null,
60+
policy=null,
61+
measurement=null,
62+
job=null,
63+
rate_time_range=null,
64+
):: getrusage_cpu_time_graph(
65+
title=title,
66+
description=description,
67+
datasource=datasource,
68+
policy=policy,
69+
measurement=measurement,
70+
job=job,
71+
rate_time_range=rate_time_range,
72+
metric_name='tnt_cpu_user_time',
73+
),
74+
75+
getrusage_cpu_system_time(
76+
title='CPU system time',
77+
description=|||
78+
This is the average amount of time per minute
79+
spent by instance process executing in kernel mode.
80+
Metrics obtained using `getrusage()` call.
81+
|||,
82+
datasource=null,
83+
policy=null,
84+
measurement=null,
85+
job=null,
86+
rate_time_range=null,
87+
):: getrusage_cpu_time_graph(
88+
title=title,
89+
description=description,
90+
datasource=datasource,
91+
policy=policy,
92+
measurement=measurement,
93+
job=job,
94+
rate_time_range=rate_time_range,
95+
metric_name='tnt_cpu_system_time',
96+
),
97+
}

tarantool/dashboard.libsonnet

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local grafana = import 'grafonnet/grafana.libsonnet';
22

33
local cluster = import 'cluster.libsonnet';
4+
local cpu = import 'cpu.libsonnet';
45
local http = import 'http.libsonnet';
56
local memory_misc = import 'memory_misc.libsonnet';
67
local net = import 'net.libsonnet';
@@ -258,21 +259,45 @@ local row = grafana.row;
258259
{ w: 8, h: 8, x: 16, y: 60 + offset },
259260
)
260261
.addPanel(
261-
row.new(title='Tarantool memory miscellaneous'),
262+
row.new(title='Tarantool CPU statistics'),
262263
{ w: 24, h: 1, x: 0, y: 68 + offset }
263264
)
265+
.addPanel(
266+
cpu.getrusage_cpu_user_time(
267+
datasource=datasource,
268+
policy=policy,
269+
measurement=measurement,
270+
job=job,
271+
rate_time_range=rate_time_range,
272+
),
273+
{ w: 12, h: 8, x: 0, y: 69 + offset },
274+
)
275+
.addPanel(
276+
cpu.getrusage_cpu_system_time(
277+
datasource=datasource,
278+
policy=policy,
279+
measurement=measurement,
280+
job=job,
281+
rate_time_range=rate_time_range,
282+
),
283+
{ w: 12, h: 8, x: 12, y: 69 + offset },
284+
)
285+
.addPanel(
286+
row.new(title='Tarantool memory miscellaneous'),
287+
{ w: 24, h: 1, x: 0, y: 77 + offset }
288+
)
264289
.addPanel(
265290
memory_misc.lua_memory(
266291
datasource=datasource,
267292
policy=policy,
268293
measurement=measurement,
269294
job=job,
270295
),
271-
{ w: 24, h: 8, x: 0, y: 69 + offset },
296+
{ w: 24, h: 8, x: 0, y: 78 + offset },
272297
)
273298
.addPanel(
274299
row.new(title='Tarantool operations statistics'),
275-
{ w: 24, h: 1, x: 0, y: 77 + offset }
300+
{ w: 24, h: 1, x: 0, y: 86 + offset }
276301
)
277302
.addPanel(
278303
operations.space_select_rps(
@@ -282,7 +307,7 @@ local row = grafana.row;
282307
job=job,
283308
rate_time_range=rate_time_range,
284309
),
285-
{ w: 8, h: 8, x: 0, y: 78 + offset },
310+
{ w: 8, h: 8, x: 0, y: 87 + offset },
286311
)
287312
.addPanel(
288313
operations.space_insert_rps(
@@ -292,7 +317,7 @@ local row = grafana.row;
292317
job=job,
293318
rate_time_range=rate_time_range,
294319
),
295-
{ w: 8, h: 8, x: 8, y: 78 + offset },
320+
{ w: 8, h: 8, x: 8, y: 87 + offset },
296321
)
297322
.addPanel(
298323
operations.space_replace_rps(
@@ -302,7 +327,7 @@ local row = grafana.row;
302327
job=job,
303328
rate_time_range=rate_time_range,
304329
),
305-
{ w: 8, h: 8, x: 16, y: 78 + offset },
330+
{ w: 8, h: 8, x: 16, y: 87 + offset },
306331
)
307332
.addPanel(
308333
operations.space_upsert_rps(
@@ -312,7 +337,7 @@ local row = grafana.row;
312337
job=job,
313338
rate_time_range=rate_time_range,
314339
),
315-
{ w: 8, h: 8, x: 0, y: 86 + offset },
340+
{ w: 8, h: 8, x: 0, y: 97 + offset },
316341
)
317342
.addPanel(
318343
operations.space_update_rps(
@@ -322,7 +347,7 @@ local row = grafana.row;
322347
job=job,
323348
rate_time_range=rate_time_range,
324349
),
325-
{ w: 8, h: 8, x: 8, y: 86 + offset },
350+
{ w: 8, h: 8, x: 8, y: 97 + offset },
326351
)
327352
.addPanel(
328353
operations.space_delete_rps(
@@ -332,7 +357,7 @@ local row = grafana.row;
332357
job=job,
333358
rate_time_range=rate_time_range,
334359
),
335-
{ w: 8, h: 8, x: 16, y: 86 + offset },
360+
{ w: 8, h: 8, x: 16, y: 97 + offset },
336361
)
337362
.addPanel(
338363
operations.call_rps(
@@ -342,7 +367,7 @@ local row = grafana.row;
342367
job=job,
343368
rate_time_range=rate_time_range,
344369
),
345-
{ w: 8, h: 8, x: 0, y: 94 + offset },
370+
{ w: 8, h: 8, x: 0, y: 103 + offset },
346371
)
347372
.addPanel(
348373
operations.eval_rps(
@@ -352,7 +377,7 @@ local row = grafana.row;
352377
job=job,
353378
rate_time_range=rate_time_range,
354379
),
355-
{ w: 8, h: 8, x: 8, y: 94 + offset },
380+
{ w: 8, h: 8, x: 8, y: 103 + offset },
356381
)
357382
.addPanel(
358383
operations.error_rps(
@@ -362,7 +387,7 @@ local row = grafana.row;
362387
job=job,
363388
rate_time_range=rate_time_range,
364389
),
365-
{ w: 8, h: 8, x: 16, y: 94 + offset },
390+
{ w: 8, h: 8, x: 16, y: 103 + offset },
366391
)
367392
.addPanel(
368393
operations.auth_rps(
@@ -372,7 +397,7 @@ local row = grafana.row;
372397
job=job,
373398
rate_time_range=rate_time_range,
374399
),
375-
{ w: 8, h: 8, x: 0, y: 102 + offset },
400+
{ w: 8, h: 8, x: 0, y: 111 + offset },
376401
)
377402
.addPanel(
378403
operations.SQL_prepare_rps(
@@ -382,7 +407,7 @@ local row = grafana.row;
382407
job=job,
383408
rate_time_range=rate_time_range,
384409
),
385-
{ w: 8, h: 8, x: 8, y: 102 + offset },
410+
{ w: 8, h: 8, x: 8, y: 111 + offset },
386411
)
387412
.addPanel(
388413
operations.SQL_execute_rps(
@@ -392,6 +417,6 @@ local row = grafana.row;
392417
job=job,
393418
rate_time_range=rate_time_range,
394419
),
395-
{ w: 8, h: 8, x: 16, y: 102 + offset },
420+
{ w: 8, h: 8, x: 16, y: 111 + offset },
396421
),
397422
}

0 commit comments

Comments
 (0)