-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmetrics.yaml
94 lines (94 loc) · 2.47 KB
/
metrics.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
groups:
- metrics:
- name: tables_size_bytes
description: Current table size in bytes
metric: Gauge
observation: bytes
- name: table_parts
description: Current parts in table
metric: Gauge
observation: parts
- name: table_rows
description: Current rows in table
metric: Gauge
observation: rows
labels:
- database
- table
query:
select
database,
table,
sum(bytes) as bytes,
count() as parts,
sum(rows) as rows
from system.parts
where active = 1
group by database, table
- metrics:
- name: query_read_rows
description: Read rows of past queries
observation: read_rows
metric: Histogram
buckets: Exponential
start: 1
factor: 10
count: 10
- description: Read bytes of past queries
name: query_read_bytes
observation: read_rows
metric: Histogram
buckets: Exponential
start: 1
factor: 10
count: 10
- description: Written rows of past queries
name: query_written_rows
observation: read_bytes
metric: Histogram
buckets: Exponential
start: 1
factor: 10
count: 10
- description: Written bytes of past queries
name: query_written_bytes
observation: written_rows
metric: Histogram
buckets: Exponential
start: 1
factor: 10
count: 10
- description: Memory usage of past queries
name: query_memory_usage
observation: written_bytes
metric: Histogram
buckets: Exponential
start: 1
factor: 10
count: 10
- description: Run time of past queries in seconds
name: query_duration_s
observation: memory_usage
metric: Histogram
buckets: Exponential
start: 1
factor: 10
count: 10
period_s: 30
labels:
- type
- user
query:
SELECT
type,
user,
sum(read_rows) AS read_rows,
sum(read_bytes) AS read_bytes,
sum(written_rows) AS written_rows,
sum(written_bytes) AS written_bytes,
sum(memory_usage) AS memory_usage,
sum(query_duration_ms)/1000 AS query_duration_s
FROM system.query_log
WHERE type != 'QueryStart'
AND event_time > subtractSeconds(now(), 30)
GROUP BY user, type