1
1
import React from 'react'
2
- import { Card } from '@grafana/ui'
2
+ import { Card } from '@grafana/ui'
3
3
4
4
export const QueryHelp = ( ) => (
5
- < div style = { { padding : '10px 0' } } >
5
+ < div style = { { padding : '10px 0' } } >
6
6
< div >
7
7
< h3 > Format Options:</ h3 >
8
8
< h4 > Table(default):</ h4 >
@@ -16,128 +16,128 @@ export const QueryHelp = () => (
16
16
< Card >
17
17
< Card . Heading > $__interval</ Card . Heading >
18
18
< Card . Description >
19
- Get the appropriate time interval from Grafana panel then parse it like `1 seconds` < br />
20
- And the possible units are: milliseconds/seconds/minutes/hours/days < br />
21
- Example: < br />
22
- SELECT speed FROM test WHERE time >= NOW() - INTERVAL '$__interval'< br />
23
- Be parsed as: < br />
24
- SELECT speed FROM test WHERE time >= NOW() - INTERVAL '1 seconds'
19
+ Get the appropriate time interval from Grafana panel then parse it like `1 seconds` < br />
20
+ And the possible units are: milliseconds/seconds/minutes/hours/days < br />
21
+ Example: < br />
22
+ SELECT speed FROM test WHERE time >= NOW() - INTERVAL '$__interval'< br />
23
+ Be parsed as: < br />
24
+ SELECT speed FROM test WHERE time >= NOW() - INTERVAL '1 seconds'
25
25
</ Card . Description >
26
26
</ Card >
27
27
28
28
< Card >
29
29
< Card . Heading > $__dateBin</ Card . Heading >
30
30
< Card . Description >
31
- Group the data according to the appropriate time interval< br />
32
- Example: < br />
33
- SELECT $__dateBin(time) as timepoint FROM demo.test GROUP BY timepoint < br />
34
- Be parsed as: < br />
35
- SELECT date_bin(interval '5 second', time, timestamp '1970-01-01T00:00:00Z') as timepoint FROM demo.test GROUP BY timepoint
31
+ Group the data according to the appropriate time interval< br />
32
+ Example: < br />
33
+ SELECT $__dateBin(time) as timepoint FROM demo.test GROUP BY timepoint < br />
34
+ Be parsed as: < br />
35
+ SELECT date_bin('5 second', time, timestamp '1970-01-01T00:00:00Z') as timepoint FROM demo.test GROUP BY timepoint
36
36
</ Card . Description >
37
37
</ Card >
38
38
39
39
< Card >
40
40
< Card . Heading > $__dateBinAlias</ Card . Heading >
41
41
< Card . Description >
42
- Group the data according to the appropriate time interval, use `_binned` suffix< br />
43
- Example: < br />
44
- SELECT $__dateBinAlias(time) FROM demo.test GROUP BY time_binned < br />
45
- Be parsed as: < br />
46
- SELECT date_bin(interval '5 second', time, timestamp '1970-01-01T00:00:00Z') as time_binned FROM demo.test GROUP BY ts_binned
42
+ Group the data according to the appropriate time interval, use `_binned` suffix< br />
43
+ Example: < br />
44
+ SELECT $__dateBinAlias(time) FROM demo.test GROUP BY time_binned < br />
45
+ Be parsed as: < br />
46
+ SELECT date_bin('5 second', time, timestamp '1970-01-01T00:00:00Z') as time_binned FROM demo.test GROUP BY ts_binned
47
47
</ Card . Description >
48
48
</ Card >
49
49
50
50
< Card >
51
51
< Card . Heading > $__timeFrom</ Card . Heading >
52
52
< Card . Description >
53
- Represent the start time selected for the Grafana panel< br />
54
- Example: < br />
55
- SELECT * FROM demo.test WHERE time >= $__timeFrom< br />
56
- Be parsed as: < br />
57
- SELECT * FROM demo.test WHERE time >= cast('2024-07-30T06:40:39Z' as timestamp)
53
+ Represent the start time selected for the Grafana panel< br />
54
+ Example: < br />
55
+ SELECT * FROM demo.test WHERE time >= $__timeFrom< br />
56
+ Be parsed as: < br />
57
+ SELECT * FROM demo.test WHERE time >= cast('2024-07-30T06:40:39Z' as timestamp)
58
58
</ Card . Description >
59
59
</ Card >
60
60
61
61
< Card >
62
62
< Card . Heading > $__timeTo</ Card . Heading >
63
63
< Card . Description >
64
- Represent the end time selected for the Grafana panel< br />
65
- Example: < br />
66
- SELECT * FROM demo.test WHERE time >= $__timeTo< br />
67
- Be parsed as: < br />
68
- SELECT * FROM demo.test WHERE time >= cast('2024-07-30T06:40:39Z' as timestamp)
64
+ Represent the end time selected for the Grafana panel< br />
65
+ Example: < br />
66
+ SELECT * FROM demo.test WHERE time >= $__timeTo< br />
67
+ Be parsed as: < br />
68
+ SELECT * FROM demo.test WHERE time >= cast('2024-07-30T06:40:39Z' as timestamp)
69
69
</ Card . Description >
70
70
</ Card >
71
71
72
72
< Card >
73
73
< Card . Heading > $__timeFilter(time)</ Card . Heading >
74
74
< Card . Description >
75
- Represent the range time selected for the Grafana panel< br />
76
- Example: < br />
77
- SELECT * from demo.test WHERE $__timeFilter(time) < br />
78
- Be parsed as: < br />
79
- SELECT * from demo.test WHERE time >= '2024-07-30T07:36:07Z' AND time <= '2024-07-30T10:36:07Z' < br />
80
- Equal to: < br />
81
- SELECT * from demo.test WHERE time >= $timeFrom AND time <= $__timeTo
75
+ Represent the range time selected for the Grafana panel< br />
76
+ Example: < br />
77
+ SELECT * from demo.test WHERE $__timeFilter(time) < br />
78
+ Be parsed as: < br />
79
+ SELECT * from demo.test WHERE time >= '2024-07-30T07:36:07Z' AND time <= '2024-07-30T10:36:07Z' < br />
80
+ Equal to: < br />
81
+ SELECT * from demo.test WHERE time >= $timeFrom AND time <= $__timeTo
82
82
</ Card . Description >
83
83
</ Card >
84
84
85
85
< Card >
86
86
< Card . Heading > $__timeGroup(time, year)</ Card . Heading >
87
87
< Card . Description >
88
- Group the extracted partial time of the time field, the time field values: year/month/day/hour/minute< br />
89
- Example: < br />
90
- SELECT $__timeGroup(time, year) FROM demo.test< br />
91
- Be parsed as: < br />
92
- SELECT datepart('year', time),datepart('month', time),datepart('day', time),datepart('hour', time),datepart('minute', time) FROM demo.test
88
+ Group the extracted partial time of the time field, the time field values: year/month/day/hour/minute< br />
89
+ Example: < br />
90
+ SELECT $__timeGroup(time, year) FROM demo.test< br />
91
+ Be parsed as: < br />
92
+ SELECT datepart('year', time),datepart('month', time),datepart('day', time),datepart('hour', time),datepart('minute', time) FROM demo.test
93
93
</ Card . Description >
94
94
</ Card >
95
95
96
96
< Card >
97
97
< Card . Heading > $__timeGroupAlias(time, year)</ Card . Heading >
98
98
< Card . Description >
99
- Group the extracted partial time of the time field, use alias prefix `time_`, the time field values: year/month/day/hour/minute< br />
100
- Example: < br />
101
- SELECT $__timeGroupAlias(time, year) FROM demo.test< br />
102
- Be parsed as: < br />
103
- SELECT datepart('year', time) as time_year,datepart('month', time) as time_month,datepart('day', time) as time_day,datepart('hour', time) as time_hour,datepart('minute', time) as time_minute FROM demo.test
99
+ Group the extracted partial time of the time field, use alias prefix `time_`, the time field values: year/month/day/hour/minute< br />
100
+ Example: < br />
101
+ SELECT $__timeGroupAlias(time, year) FROM demo.test< br />
102
+ Be parsed as: < br />
103
+ SELECT datepart('year', time) as time_year,datepart('month', time) as time_month,datepart('day', time) as time_day,datepart('hour', time) as time_hour,datepart('minute', time) as time_minute FROM demo.test
104
104
</ Card . Description >
105
105
</ Card >
106
106
107
107
< Card >
108
108
< Card . Heading > $__timeRangeFrom(time)</ Card . Heading >
109
109
< Card . Description >
110
- Represent the start time selected for the Grafana panel< br />
111
- Example: < br />
112
- SELECT * FROM demo.test where $__timeRangeFrom(time)< br />
113
- Be parsed as: < br />
114
- SELECT * FROM demo.test where time >= '2024-07-30T07:29:46Z'
110
+ Represent the start time selected for the Grafana panel< br />
111
+ Example: < br />
112
+ SELECT * FROM demo.test where $__timeRangeFrom(time)< br />
113
+ Be parsed as: < br />
114
+ SELECT * FROM demo.test where time >= '2024-07-30T07:29:46Z'
115
115
</ Card . Description >
116
116
</ Card >
117
117
118
118
< Card >
119
119
< Card . Heading > $__timeRangeTo(time)</ Card . Heading >
120
120
< Card . Description >
121
- Represent the end time selected for the Grafana panel< br />
122
- Example: < br />
123
- SELECT * FROM demo.test where $__timeRangeTo(time)< br />
124
- Be parsed as: < br />
125
- SELECT * FROM demo.test where time <= '2024-07-30T07:29:46Z'
121
+ Represent the end time selected for the Grafana panel< br />
122
+ Example: < br />
123
+ SELECT * FROM demo.test where $__timeRangeTo(time)< br />
124
+ Be parsed as: < br />
125
+ SELECT * FROM demo.test where time <= '2024-07-30T07:29:46Z'
126
126
</ Card . Description >
127
127
</ Card >
128
128
129
-
129
+
130
130
131
131
< Card >
132
132
< Card . Heading > $__timeRange(time)</ Card . Heading >
133
133
< Card . Description >
134
- Represent the range time selected for the Grafana panel < br />
135
- Example: < br />
136
- SELECT * FROM demo.test where $__timeRange(time)< br />
137
- Be parsed as: < br />
138
- SELECT * FROM demo.test where time >= '2024-07-30T07:37:41Z' AND time <= '2024-07-30T10:37:41Z' < br />
139
- Equal to: < br />
140
- SELECT * FROM demo.test where $__timeRangeFrom(time) AND $__timeRangeTo(time)
134
+ Represent the range time selected for the Grafana panel < br />
135
+ Example: < br />
136
+ SELECT * FROM demo.test where $__timeRange(time)< br />
137
+ Be parsed as: < br />
138
+ SELECT * FROM demo.test where time >= '2024-07-30T07:37:41Z' AND time <= '2024-07-30T10:37:41Z' < br />
139
+ Equal to: < br />
140
+ SELECT * FROM demo.test where $__timeRangeFrom(time) AND $__timeRangeTo(time)
141
141
</ Card . Description >
142
142
</ Card >
143
143
</ div >
0 commit comments