forked from VictoriaMetrics/metricsql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transform.go
120 lines (116 loc) · 4.12 KB
/
transform.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
package metricsql
import (
"strings"
)
var transformFuncs = map[string]bool{
"": true, // empty func is a synonym to union
"abs": true,
"absent": true,
"acos": true,
"acosh": true,
"asin": true,
"asinh": true,
"atan": true,
"atanh": true,
"bitmap_and": true,
"bitmap_or": true,
"bitmap_xor": true,
"buckets_limit": true,
"ceil": true,
"clamp": true,
"clamp_max": true,
"clamp_min": true,
"cos": true,
"cosh": true,
"day_of_month": true,
"day_of_week": true,
"days_in_month": true,
"deg": true,
"drop_common_labels": true,
"end": true,
"exp": true,
"floor": true,
"histogram_avg": true,
"histogram_quantile": true,
"histogram_quantiles": true,
"histogram_share": true,
"histogram_stddev": true,
"histogram_stdvar": true,
"hour": true,
"interpolate": true,
"keep_last_value": true,
"keep_next_value": true,
"label_copy": true,
"label_del": true,
"label_graphite_group": true,
"label_join": true,
"label_keep": true,
"label_lowercase": true,
"label_map": true,
"label_match": true,
"label_mismatch": true,
"label_move": true,
"label_replace": true,
"label_set": true,
"label_transform": true,
"label_uppercase": true,
"label_value": true,
"limit_offset": true,
"ln": true,
"log2": true,
"log10": true,
"minute": true,
"month": true,
"now": true,
"pi": true,
"prometheus_buckets": true,
"rad": true,
"rand": true,
"rand_exponential": true,
"rand_normal": true,
"range_avg": true,
"range_first": true,
"range_last": true,
"range_linear_regression": true,
"range_max": true,
"range_min": true,
"range_normalize": true,
"range_quantile": true,
"range_stddev": true,
"range_stdvar": true,
"range_sum": true,
"range_trim_spikes": true,
"remove_resets": true,
"round": true,
"running_avg": true,
"running_max": true,
"running_min": true,
"running_sum": true,
"scalar": true,
"sgn": true,
"sin": true,
"sinh": true,
"smooth_exponential": true,
"sort": true,
"sort_by_label": true,
"sort_by_label_desc": true,
"sort_by_label_numeric": true,
"sort_by_label_numeric_desc": true,
"sort_desc": true,
"sqrt": true,
"start": true,
"step": true,
"tan": true,
"tanh": true,
"time": true,
// "timestamp" has been moved to rollup funcs. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415
"timezone_offset": true,
"union": true,
"vector": true,
"year": true,
}
// IsTransformFunc returns whether funcName is known transform function.
func IsTransformFunc(funcName string) bool {
s := strings.ToLower(funcName)
return transformFuncs[s]
}