-
Notifications
You must be signed in to change notification settings - Fork 121
/
Copy pathflamegraph_and_tracing_support.json
150 lines (150 loc) · 5.74 KB
/
flamegraph_and_tracing_support.json
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "https://github.com/Altinity/clickhouse-grafana/issues/508",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "vertamedia-clickhouse-datasource",
"uid": "PFA2E00E697AAEA0A"
},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"links": [
{
"targetBlank": true,
"title": "Trace Visualizations",
"url": "https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/traces/"
}
],
"targets": [
{
"add_metadata": true,
"database": "system",
"datasource": {
"type": "vertamedia-clickhouse-datasource",
"uid": "PFA2E00E697AAEA0A"
},
"dateColDataType": "finish_date",
"dateTimeColDataType": "intDiv(finish_time_us,1000000)",
"dateTimeType": "TIMESTAMP",
"editorMode": "builder",
"extrapolate": false,
"format": "traces",
"formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
"intervalFactor": 1,
"query": "SELECT\r\n trace_id AS traceID,\r\n span_id AS spanID,\r\n operation_name AS operationName,\r\n parent_span_id AS parentSpanID,\r\n 'clickhouse' AS serviceName,\r\n intDiv(finish_time_us - start_time_us, 1000) AS duration,\r\n intDiv(start_time_us,1000) AS startTime,\r\n attribute AS tags,\r\n map('hostName',hostname) AS serviceTags\r\nFROM\r\n $table\r\nWHERE $timeFilter\r\nORDER BY traceID, startTime",
"rawQuery": "/* grafana dashboard=FlameGraph and Tracing support, user=1 */ SELECT\r\n trace_id AS traceID,\r\n span_id AS spanID,\r\n operation_name AS operationName,\r\n parent_span_id AS parentSpanID,\r\n hostname AS serviceName,\r\n intDiv(finish_time_us - start_time_us, 1000) AS duration,\r\n intDiv(start_time_us,1000) AS startTime,\r\n attribute AS tags,\r\n map() AS serviceTags\r\nFROM\r\n system.opentelemetry_span_log\r\nWHERE finish_date >= toDate(1713432368) AND finish_date <= toDate(1713453968) AND intDiv(finish_time_us,1000000) >= 1713432368 AND intDiv(finish_time_us,1000000) <= 1713453968",
"refId": "A",
"round": "0s",
"showFormattedSQL": false,
"showHelp": false,
"skip_comments": false,
"step": "",
"table": "opentelemetry_span_log"
}
],
"title": "Traces Example",
"type": "traces"
},
{
"datasource": {
"type": "vertamedia-clickhouse-datasource",
"uid": "PFA2E00E697AAEA0A"
},
"description": "",
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 8
},
"id": 1,
"links": [
{
"targetBlank": true,
"title": "system.trace_log",
"url": "https://clickhouse.com/docs/en/operations/system-tables/trace_log"
},
{
"title": "Collect flamegraph",
"url": "https://kb.altinity.com/altinity-kb-queries-and-syntax/trace_log/"
},
{
"targetBlank": true,
"title": "Expected fields",
"url": "https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/flame-graph/#data-api"
}
],
"targets": [
{
"add_metadata": true,
"database": "system",
"datasource": {
"type": "vertamedia-clickhouse-datasource",
"uid": "PFA2E00E697AAEA0A"
},
"dateColDataType": "event_date",
"dateTimeColDataType": "event_time",
"dateTimeType": "DATETIME",
"editorMode": "builder",
"extrapolate": false,
"format": "flamegraph",
"formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
"intervalFactor": 1,
"query": "SELECT length(trace) - level_num AS level, label, count() AS value, 0 self \r\nFROM $table \r\nARRAY JOIN arrayEnumerate(trace) AS level_num, \r\narrayMap(x -> if(addressToSymbol(x) != '', demangle(addressToSymbol(x)), 'unknown') , trace) AS label \r\nWHERE trace_type='Real' AND $timeFilter\r\nGROUP BY level, label, trace\r\nORDER BY trace, level\r\n",
"rawQuery": "/* grafana dashboard=FlameGraph and Tracing support, user=1 */ SELECT level, label, count() AS value, 0 self \r\nFROM system.trace_log \r\nARRAY JOIN arrayEnumerate(trace) AS level, \r\narrayMap(x -> demangle(addressToSymbol(x) ), trace) AS label \r\nWHERE trace_type='Real' AND event_date >= toDate(1713685956) AND event_date <= toDate(1713707556) AND event_time >= toDateTime(1713685956) AND event_time <= toDateTime(1713707556)\r\nGROUP BY ALL;",
"refId": "A",
"round": "0s",
"showFormattedSQL": false,
"showHelp": false,
"skip_comments": false,
"step": "",
"table": "trace_log"
}
],
"title": "flamegraph example",
"type": "flamegraph"
}
],
"refresh": "",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-1m",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "FlameGraph and Tracing support",
"uid": "edimrzy0cijnkf",
"version": 4,
"weekStart": ""
}