-
Notifications
You must be signed in to change notification settings - Fork 183
/
metricsconsts.go
457 lines (455 loc) · 13 KB
/
metricsconsts.go
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
package promql
const metricFunctions = `[
{
"fn": "abs",
"name": "Absolute",
"desc": "Returns the input vector with all datapoint values converted to their absolute value.",
"eg": "abs(avg (system.disk.used{*}))",
"isTimeRangeFunc": false
},
{
"fn": "sqrt",
"name": "Square root",
"desc": "calculates the square root of all elements in v.",
"eg": "sqrt(avg (system.disk.used{*}))",
"isTimeRangeFunc": false
},
{
"fn": "ceil",
"name": "Ceil",
"desc": "Rounds the datapoint values of all elements in v up to the nearest integer.",
"eg": "ceil(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "floor",
"name": "Floor",
"desc": "Rounds the datapoint values of all elements in v down to the nearest integer.",
"eg": "floor(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "round",
"name": "Round",
"desc": "Rounds the datapoint values of all elements in v to the nearest integer.",
"eg": "round(avg (system.disk.used)), round(avg (system.disk.used, 1/2))",
"isTimeRangeFunc": false
},
{
"fn": "exp",
"name": "Exponential",
"desc": "Calculates the exponential function for all elements in v.",
"eg": "exp(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "ln",
"name": "Natural logarithm",
"desc": "Calculates the natural logarithm for all elements in v.",
"eg": "ln(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "log2",
"name": "Binary logarithm",
"desc": "Calculates the binary logarithm for all elements in v.",
"eg": "log2(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "log10",
"name": "Decimal logarithm",
"desc": "Calculates the decimal logarithm for all elements in v.",
"eg": "log10(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "sgn",
"name": "Sign",
"desc": "Returns a vector with all sample values converted to their sign, defined as this: 1 if v is positive, -1 if v is negative and 0 if v is equal to zero.",
"eg": "sgn(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "deg",
"name": "Degree",
"desc": "Converts radians to degrees for all elements in v.",
"eg": "deg(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "rad",
"name": "Radian",
"desc": "converts degrees to radians for all elements in v.",
"eg": "rad(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "acos",
"name": "Arccosine (acos)",
"desc": "Calculates the arccosine of all elements in v.",
"eg": "acos(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "acosh",
"name": "Inverse hyperbolic cosine (acosh)",
"desc": "Calculates the inverse hyperbolic cosine of all elements in v.",
"eg": "acosh(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "asin",
"name": "Arcsine (asin)",
"desc": "Calculates the arcsine of all elements in v.",
"eg": "asin(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "asinh",
"name": "Inverse hyperbolic sine (asinh)",
"desc": "Calculates the inverse hyperbolic sine of all elements in v.",
"eg": "asinh(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "atan",
"name": "Arctangent (atan)",
"desc": "Calculates the arctangent of all elements in v.",
"eg": "atan(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "atanh",
"name": "Inverse hyperbolic tangent (atanh)",
"desc": "Calculates the inverse hyperbolic tangent of all elements in v.",
"eg": "atanh(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "cos",
"name": "Cosine (cos)",
"desc": "Calculates the cosine of all elements in v.",
"eg": "cos(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "cosh",
"name": "Hyperbolic cosine (cosh)",
"desc": "Calculates the hyperbolic cosine of all elements in v.",
"eg": "cosh(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "sin",
"name": "Sine (sin)",
"desc": "Calculates the sine of all elements in v.",
"eg": "sin(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "sinh",
"name": "Hyperbolic sine (sinh)",
"desc": "Calculates the hyperbolic sine of all elements in v.",
"eg": "sinh(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "tan",
"name": "Tangent (tan)",
"desc": "Calculates the tangent of all elements in v.",
"eg": "tan(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "tanh",
"name": "Hyperbolic tangent (tanh)",
"desc": "Calculates the hyperbolic tangent of all elements in v.",
"eg": "tanh(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "clamp",
"name": "Clamp",
"desc": "Clamps the sample values of all elements in v to have a lower limit of min and an upper limit of max.",
"eg": "clamp(avg (system.disk.used), 0, 99)",
"isTimeRangeFunc": false
},
{
"fn": "clamp_max",
"name": "Clamp Max",
"desc": "Clamps the sample values of all elements in v to have an upper limit of max.",
"eg": "clamp_max(avg (system.disk.used), 99)",
"isTimeRangeFunc": false
},
{
"fn": "clamp_min",
"name": "Clamp Min",
"desc": "Clamps the sample values of all elements in v to have a lower limit of min.",
"eg": "clamp_min(avg (system.disk.used), 0)",
"isTimeRangeFunc": false
},
{
"fn": "timestamp",
"name": "Timestamp",
"desc": "Returns the timestamp of each of the samples of the given vector as the number of seconds since January 1, 1970 UTC.",
"eg": "timestamp(avg (system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "rate",
"name": "Rate",
"desc": "Calculates the per-second average rate of increase of the time series in the range vector.",
"eg": "rate(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "irate",
"name": "Instant Rate",
"desc": "Calculates the per-second instant rate of increase of the time series in the range vector",
"eg": "irate(http_requests_total[5m])",
"isTimeRangeFunc": true
},
{
"fn": "increase",
"name": "Increase",
"desc": "Calculates the increase in the time series in the range vector",
"eg": "increase(http_requests_total[5m])",
"isTimeRangeFunc": true
},
{
"fn": "delta",
"name": "Delta",
"desc": "Calculates the difference between the first and last value of each time series element in a range vector v",
"eg": "delta(cpu_temp_celsius[2h])",
"isTimeRangeFunc": true
},
{
"fn": "idelta",
"name": "Instant Delta",
"desc": "Calculates the difference between the last two samples in the range vector v",
"eg": "idelta(cpu_temp_celsius[2h])",
"isTimeRangeFunc": true
},
{
"fn": "predict_linear",
"name": "Predict Linear",
"desc": "Predicts the value of time series t seconds from now, based on the range vector v",
"eg": "predict_linear(avg (system.disk.used[60m]), 1000)",
"isTimeRangeFunc": true
},
{
"fn": "deriv",
"name": "Derivative",
"desc": "Calculates the per-second derivative of the time series in a range vector v, using simple linear regression",
"eg": "deriv(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "changes",
"name": "Changes",
"desc": "Returns the number of times its value has changed within the provided time range as an instant vector.",
"eg": "changes(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "resets",
"name": "Resets",
"desc": "returns the number of counter resets within the provided time range as an instant vector.",
"eg": "resets(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "avg_over_time",
"name": "Average Over Time",
"desc": "The average value of all points in the specified interval.",
"eg": "avg_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "min_over_time",
"name": "Minimum Over Time",
"desc": "The minimum value of all points in the specified interval.",
"eg": "min_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "max_over_time",
"name": "Maximum Over Time",
"desc": "The maximum value of all points in the specified interval.",
"eg": "max_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "sum_over_time",
"name": "Sum Over Time",
"desc": "The sum of all values in the specified interval.",
"eg": "sum_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "count_over_time",
"name": "Count Over Time",
"desc": "The count of all values in the specified interval.",
"eg": "count_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "hour",
"name": "Hour",
"desc": "Extracts the hour of a timestamp, represented as the number of hours since midnight.",
"eg": "hour(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "minute",
"name": "Minute",
"desc": "Extracts the minute of a timestamp, represented as the number of minutes since the last hour.",
"eg": "minute(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "month",
"name": "Month",
"desc": "Extracts the month of a timestamp, represented as a number from 1 (January) to 12 (December).",
"eg": "month(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "year",
"name": "Year",
"desc": "Extracts the year of a timestamp.",
"eg": "year(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "day_of_month",
"name": "Day of Month",
"desc": "Extracts the day of the month from a timestamp, represented as a number from 1 to 31.",
"eg": "day_of_month(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "day_of_week",
"name": "Day of Week",
"desc": "Extracts the day of the week from a timestamp, represented as a number from 0 (Sunday) to 6 inclusive.",
"eg": "day_of_week(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "day_of_year",
"name": "Day of Year",
"desc": "Extracts the day of the year from a timestamp, represented as a number from 1 to 366.",
"eg": "day_of_year(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "days_in_month",
"name": "Days in Month",
"desc": "Returns the number of days in the month of a timestamp.",
"eg": "days_in_month(timestamp(system.disk.used))",
"isTimeRangeFunc": false
},
{
"fn": "quantile_over_time",
"name": "Quantile Over Time",
"desc": "The φ-quantile (0 ≤ φ ≤ 1) of the values in the specified interval.",
"eg": "quantile_over_time(0.6, avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "stddev_over_time",
"name": "Standard deviation Over Time",
"desc": "The population standard deviation of the values in the specified interval.",
"eg": "stddev_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "stdvar_over_time",
"name": "Standard variance Over Time",
"desc": "The population standard variance of the values in the specified interval.",
"eg": "stdvar_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "last_over_time",
"name": "Last Over Time",
"desc": " the most recent point value in the specified interval.",
"eg": "last_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "present_over_time",
"name": "Present Over Time",
"desc": "The value 1 for any series in the specified interval.",
"eg": "present_over_time(avg (system.disk.used[5m]))",
"isTimeRangeFunc": true
},
{
"fn": "sum",
"name": "Sum",
"desc": "Calculate sum over dimensions.",
"eg": "sum(system.disk.used)",
"isTimeRangeFunc": false
},
{
"fn": "min",
"name": "Minimum",
"desc": "Select minimum over dimensions.",
"eg": "min(system.disk.used)",
"isTimeRangeFunc": false
},
{
"fn": "max",
"name": "Maximum",
"desc": "Select maximum over dimensions.",
"eg": "max(system.disk.used)",
"isTimeRangeFunc": false
},
{
"fn": "avg",
"name": "Average",
"desc": "Calculate the average over dimensions.",
"eg": "avg(system.disk.used)",
"isTimeRangeFunc": false
},
{
"fn": "group",
"name": "Group",
"desc": "All values in the resulting vector are 1.",
"eg": "group(system.disk.used)",
"isTimeRangeFunc": false
},
{
"fn": "stddev",
"name": "Standard deviation",
"desc": "Calculate population standard deviation over dimensions.",
"eg": "stddev(system.disk.used)",
"isTimeRangeFunc": false
},
{
"fn": "stdvar",
"name": "Standard variance",
"desc": "Calculate population standard variance over dimensions.",
"eg": "stdvar(system.disk.used)",
"isTimeRangeFunc": false
},
{
"fn": "count",
"name": "Count",
"desc": "Count number of elements in the vector.",
"eg": "count(system.disk.used)",
"isTimeRangeFunc": false
}
]`
const PromQLBuildInfo = `{
"status": "success",
"data": {
"version": "2.23.1",
"revision": "cb7cbad5f9a2823a622aaa668833ca04f50a0ea7",
"branch": "master",
"buildUser": "julius@desktop",
"buildDate": "20060102-15:04:05",
"goVersion": "go1.22.2"
}
}`