@prometheus-io/lezer-promql 0.305.0 → 0.306.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/package.json +1 -1
- package/src/highlight.js +34 -0
- package/src/parser.js +184 -0
- package/src/parser.terms.js +160 -0
- package/src/promql.grammar +443 -0
- package/src/tokens.js +89 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
## main / unreleased
|
|
4
4
|
|
|
5
|
+
## 3.6.0-rc.1 / 2025-09-09
|
|
6
|
+
|
|
7
|
+
* [ENHANCEMENT] TSDB: Track stale series in the Head block via the `prometheus_tsdb_head_stale_series` metric. #16925
|
|
8
|
+
|
|
9
|
+
## 3.6.0-rc.0 / 2025-08-12
|
|
10
|
+
|
|
11
|
+
* [FEATURE] PromQL: Add `step()`, and `min()` and `max()` on durations, behind feature flag `promql-duration-expr`. #16777
|
|
12
|
+
* [FEATURE] API: Add a `/v1/status/tsdb/blocks` endpoint exposing metadata about loaded blocks. #16695
|
|
13
|
+
* [FEATURE] Templates: Add `toDuration()` and `now()` functions. #16619
|
|
14
|
+
* [ENHANCEMENT] Discovery: Add support for attaching namespace metadata to targets. #16831
|
|
15
|
+
* [ENHANCEMENT] OTLP: Support new `UnderscoreEscapingWithoutSuffixes` strategy via `otlp.translation_strategy`. #16849
|
|
16
|
+
* [ENHANCEMENT] OTLP: Support including scope metadata as metric labels via `otlp.promote_scope_metadata`. #16878
|
|
17
|
+
* [ENHANCEMENT] OTLP: Add `__type__` and `__unit__` labels when feature flag `type-and-unit-labels` is enabled. #16630
|
|
18
|
+
* [ENHANCEMENT] Tracing: Send the traceparent HTTP header during scrapes. #16425
|
|
19
|
+
* [ENHANCEMENT] UI: Add option to disable info and warning query messages under `Query page settings`. #16901
|
|
20
|
+
* [ENHANCEMENT] UI: Improve metadata handling for `_count/_sum/_bucket` suffixes. #16910
|
|
21
|
+
* [PERF] PromQL: Improve performance due to internal optimizations. #16797
|
|
22
|
+
* [BUGFIX] Config: Fix "unknown global name escaping method" error messages produced during config validation. #16801
|
|
23
|
+
* [BUGFIX] Discovery: Fix race condition during shutdown. #16820
|
|
24
|
+
* [BUGFIX] OTLP: Generate `target_info` samples between the earliest and latest samples per resource. #16737
|
|
25
|
+
* [BUGFIX] PromQL: Fail when `NaN` is passed as parameter to `topk()`, `bottomk()`, `limitk()` and `limit_ratio()`. #16725
|
|
26
|
+
* [BUGFIX] PromQL: Fix extrapolation for native counter histograms. #16828
|
|
27
|
+
* [BUGFIX] PromQL: Reduce numerical errors by disabling some optimizations. #16895
|
|
28
|
+
* [BUGFIX] PromQL: Fix inconsistencies when using native histograms in subqueries. #16879
|
|
29
|
+
* [BUGFIX] PromQL: Fix inconsistent annotations for `rate()` and `increase()` on histograms when feature flag `type-and-unit-labels` is enabled. #16915
|
|
30
|
+
* [BUGFIX] Scraping: Fix memory corruption in `slicelabels` builds. #16946
|
|
31
|
+
* [BUGFIX] TSDB: Fix panic on append when feature flag `created-timestamp-zero-ingestion` is enabled. #16332
|
|
32
|
+
* [BUGFIX] TSDB: Fix panic on append for native histograms with empty buckets. #16893
|
|
33
|
+
|
|
5
34
|
## 3.5.0 / 2025-07-14
|
|
6
35
|
|
|
7
36
|
* [FEATURE] PromQL: Add experimental type and unit metadata labels, behind feature flag `type-and-unit-labels`. #16228 #16632 #16718 #16743
|
|
@@ -246,6 +275,11 @@ This release includes new features such as a brand new UI and UTF-8 support enab
|
|
|
246
275
|
* [BUGFIX] Autoreload: Reload invalid yaml files. #14947
|
|
247
276
|
* [BUGFIX] Scrape: Do not override target parameter labels with config params. #11029
|
|
248
277
|
|
|
278
|
+
## 2.53.5 / 2025-06-30
|
|
279
|
+
|
|
280
|
+
* [ENHANCEMENT] TSDB: Add backward compatibility with the upcoming TSDB block index v3 #16762
|
|
281
|
+
* [BUGFIX] Top-level: Update GOGC before loading TSDB #16521
|
|
282
|
+
|
|
249
283
|
## 2.53.4 / 2025-03-18
|
|
250
284
|
|
|
251
285
|
* [BUGFIX] Runtime: fix GOGC is being set to 0 when installed with empty prometheus.yml file resulting high cpu usage. #16090
|
|
@@ -260,7 +294,7 @@ This release includes new features such as a brand new UI and UTF-8 support enab
|
|
|
260
294
|
Fix a bug where Prometheus would crash with a segmentation fault if a remote-read
|
|
261
295
|
request accessed a block on disk at about the same time as TSDB created a new block.
|
|
262
296
|
|
|
263
|
-
[BUGFIX] Remote-Read: Resolve occasional segmentation fault on query. #14515,#14523
|
|
297
|
+
* [BUGFIX] Remote-Read: Resolve occasional segmentation fault on query. #14515,#14523
|
|
264
298
|
|
|
265
299
|
## 2.55.1 / 2024-11-04
|
|
266
300
|
|
package/package.json
CHANGED
package/src/highlight.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 2022 The Prometheus Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
|
|
14
|
+
import {styleTags, tags} from "@lezer/highlight";
|
|
15
|
+
|
|
16
|
+
export const promQLHighLight = styleTags({
|
|
17
|
+
LineComment: tags.comment,
|
|
18
|
+
LabelName: tags.labelName,
|
|
19
|
+
StringLiteral: tags.string,
|
|
20
|
+
NumberDurationLiteral: tags.number,
|
|
21
|
+
NumberDurationLiteralInDurationContext: tags.number,
|
|
22
|
+
Identifier: tags.variableName,
|
|
23
|
+
'Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramAvg HistogramCount HistogramFraction HistogramQuantile HistogramSum DoubleExponentialSmoothing Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc SortByLabel SortByLabelDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year':
|
|
24
|
+
tags.function(tags.variableName),
|
|
25
|
+
'Avg Bottomk Count Count_values Group LimitK LimitRatio Max Min Quantile Stddev Stdvar Sum Topk': tags.operatorKeyword,
|
|
26
|
+
'By Without Bool On Ignoring GroupLeft GroupRight Offset Start End': tags.modifier,
|
|
27
|
+
'And Unless Or': tags.logicOperator,
|
|
28
|
+
'Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At': tags.operator,
|
|
29
|
+
UnaryOp: tags.arithmeticOperator,
|
|
30
|
+
'( )': tags.paren,
|
|
31
|
+
'[ ]': tags.squareBracket,
|
|
32
|
+
'{ }': tags.brace,
|
|
33
|
+
'⚠': tags.invalid,
|
|
34
|
+
})
|
package/src/parser.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import {LRParser} from "@lezer/lr"
|
|
3
|
+
import {specializeIdentifier, extendIdentifier} from "./tokens"
|
|
4
|
+
import {promQLHighLight} from "./highlight"
|
|
5
|
+
const spec_Identifier = {__proto__:null,absent_over_time:341, absent:343, abs:345, acos:347, acosh:349, asin:351, asinh:353, atan:355, atanh:357, avg_over_time:359, ceil:361, changes:363, clamp:365, clamp_max:367, clamp_min:369, cos:371, cosh:373, count_over_time:375, days_in_month:377, day_of_month:379, day_of_week:381, day_of_year:383, deg:385, delta:387, deriv:389, exp:391, floor:393, histogram_count:395, histogram_fraction:397, histogram_quantile:399, histogram_stddev:401, histogram_stdvar:403, histogram_sum:405, histogram_avg:407, double_exponential_smoothing:409, hour:411, idelta:413, increase:415, info:417, irate:419, label_replace:421, label_join:423, last_over_time:425, ln:427, log10:429, log2:431, mad_over_time:433, max_over_time:435, min_over_time:437, ts_of_max_over_time:439, ts_of_min_over_time:441, ts_of_last_over_time:443, minute:445, month:447, pi:449, predict_linear:451, present_over_time:453, quantile_over_time:455, rad:457, rate:459, resets:461, round:463, scalar:465, sgn:467, sin:469, sinh:471, sort:473, sort_desc:475, sort_by_label:477, sort_by_label_desc:479, sqrt:481, stddev_over_time:483, stdvar_over_time:485, sum_over_time:487, tan:489, tanh:491, timestamp:493, time:495, vector:497, year:499}
|
|
6
|
+
export const parser = LRParser.deserialize({
|
|
7
|
+
version: 14,
|
|
8
|
+
states: "9tOYQPOOO'}QPOOOOQO'#C|'#C|O(SQPO'#C{Q(_QQOOOOQO'#De'#DeO(YQPO'#DdOOQO'#F]'#F]O)lQPO'#FbOYQPO'#F_OYQPO'#FaO0jQSO'#FdO0uQQO'#FcOOQO'#Fc'#FcOOQO'#Fw'#FwOOQO'#Df'#DfOOQO'#Dh'#DhOOQO'#Di'#DiOOQO'#Dj'#DjOOQO'#Dk'#DkOOQO'#Dl'#DlOOQO'#Dm'#DmOOQO'#Dn'#DnOOQO'#Do'#DoOOQO'#Dp'#DpOOQO'#Dq'#DqOOQO'#Dr'#DrOOQO'#Ds'#DsOOQO'#Dt'#DtOOQO'#Du'#DuOOQO'#Dv'#DvOOQO'#Dw'#DwOOQO'#Dx'#DxOOQO'#Dy'#DyOOQO'#Dz'#DzOOQO'#D{'#D{OOQO'#D|'#D|OOQO'#D}'#D}OOQO'#EO'#EOOOQO'#EP'#EPOOQO'#EQ'#EQOOQO'#ER'#EROOQO'#ES'#ESOOQO'#ET'#ETOOQO'#EU'#E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#t#u#v#w$ZQ#z#]Q#{#^R$x$gd^OXY#T#s#t#u#v#w$ZR$O#_eYOXY#T#s#t#u#v#w$Zd]OXY#T#s#t#u#v#w$ZR#i[Q#hZV$l$U$n${Q$S#eT$T#f$kR$P#_Q$q$YR%P$qQ$[#mR$t$[S$V#f#hR$o$VQSOQ#bXQ#cYQ#m#TQ$`#sQ$a#tQ$b#uQ$c#vQ$d#wR$s$ZQ#s#WQ#t#XQ#u#YQ#v#ZR#w#[",
|
|
11
|
+
nodeNames: "⚠ Bool Ignoring On GroupLeft GroupRight Offset Atan2 Avg Bottomk Count CountValues Group Max Min Quantile LimitK LimitRatio Stddev Stdvar Sum Topk By Without And Or Unless Start End LineComment PromQL AggregateExpr AggregateOp AggregateModifier GroupingLabels LabelName QuotedLabelName StringLiteral FunctionCallBody BinaryExpr Pow BoolModifier MatchingModifierClause Mul Div Mod Add Sub Eql Gte Gtr Lte Lss Neq FunctionCall FunctionIdentifier AbsentOverTime Identifier Absent Abs Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramCount HistogramFraction HistogramQuantile HistogramStdDev HistogramStdVar HistogramSum HistogramAvg DoubleExponentialSmoothing Hour Idelta Increase Info Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MadOverTime MaxOverTime MinOverTime TsOfMaxOverTime TsOfMinOverTime TsOfLastOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc SortByLabel SortByLabelDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Timestamp Time Vector Year MatrixSelector NumberDurationLiteralInDurationContext NumberDurationLiteral OffsetExpr ParenExpr SubqueryExpr UnaryExpr UnaryOp VectorSelector LabelMatchers UnquotedLabelMatcher MatchOp EqlSingle EqlRegex NeqRegex QuotedLabelMatcher StepIn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g~!Q![*j#R#S*d~*zO|~~+P[&g~!O!P)o!Q![+u!g!h*W#R#S,m#W#X-X#X#Y*W#[#]-p#a#b.U#g#h.x#k#l/Z#l#m0d#m#n/u~+zZ&g~!O!P)o!Q![+u!g!h*W#R#S,m#W#X-X#X#Y*W#[#]-p#a#b.U#g#h.x#k#l/Z#m#n/u~,pP!Q![,s~,xT&g~!O!P)o!Q![,s!g!h*W#R#S,m#X#Y*W~-^P&g~!Q![-a~-dS!Q![-a#[#]-p#a#b.U#g#h.x~-uP&g~!Q![-x~-{R!Q![-x#a#b.U#g#h.x~.ZQ&g~!Q![.a#g#h.s~.dR!Q![.a#a#b.m#g#h.x~.pP#g#h.s~.xO&g~~.}P&g~!Q![/Q~/TQ!Q![/Q#a#b.m~/`P&g~!Q![/c~/fT!Q![/c#W#X-X#[#]-p#a#b.U#g#h.x~/zP&g~!Q![/}~0QU!Q![/}#W#X-X#[#]-p#a#b.U#g#h.x#k#l/Z~0gR!Q![0p!c!i0p#T#Z0p~0uR&g~!Q![0p!c!i0p#T#Z0pV1VT&iS!ZR!Q![1f![!]1f!c!}1f#R#S1f#T#o1fR1kT!ZR!Q![1f![!]1f!c!}1f#R#S1f#T#o1f~2PP!U~!_!`2S~2XO!T~~2^Q$ZP!_!`2d#r#s2iQ2iO!QQ~2nO$[~~2sP!S~!_!`2v~2{O!R~~3QO$`~V3XT!ZRsS!Q![3Q![!]1f!c!}3Q#R#S3Q#T#o3Q~3mO&d~~3rO&h~~3wOx~~3zTO#S3w#S#T%c#T;'S3w;'S;=`4Z<%lO3w~4^P;=`<%l3w~4fO&j~~4kO&k~",
|
|
20
|
+
tokenizers: [0, 1, 2],
|
|
21
|
+
topRules: {"PromQL":[0,30],"MetricName":[1,156]},
|
|
22
|
+
specialized: [{term: 57, get: (value, stack) => (specializeIdentifier(value, stack) << 1), external: specializeIdentifier},{term: 57, get: (value, stack) => (extendIdentifier(value, stack) << 1) | 1, external: extendIdentifier, extend: true},{term: 57, get: (value) => spec_Identifier[value] || -1}],
|
|
23
|
+
tokenPrec: 0
|
|
24
|
+
})
|
|
25
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
26
|
+
export const
|
|
27
|
+
inf = 161,
|
|
28
|
+
nan = 162,
|
|
29
|
+
Bool = 1,
|
|
30
|
+
Ignoring = 2,
|
|
31
|
+
On = 3,
|
|
32
|
+
GroupLeft = 4,
|
|
33
|
+
GroupRight = 5,
|
|
34
|
+
Offset = 6,
|
|
35
|
+
Atan2 = 7,
|
|
36
|
+
Avg = 8,
|
|
37
|
+
Bottomk = 9,
|
|
38
|
+
Count = 10,
|
|
39
|
+
CountValues = 11,
|
|
40
|
+
Group = 12,
|
|
41
|
+
Max = 13,
|
|
42
|
+
Min = 14,
|
|
43
|
+
Quantile = 15,
|
|
44
|
+
LimitK = 16,
|
|
45
|
+
LimitRatio = 17,
|
|
46
|
+
Stddev = 18,
|
|
47
|
+
Stdvar = 19,
|
|
48
|
+
Sum = 20,
|
|
49
|
+
Topk = 21,
|
|
50
|
+
By = 22,
|
|
51
|
+
Without = 23,
|
|
52
|
+
And = 24,
|
|
53
|
+
Or = 25,
|
|
54
|
+
Unless = 26,
|
|
55
|
+
Start = 27,
|
|
56
|
+
End = 28,
|
|
57
|
+
LineComment = 29,
|
|
58
|
+
PromQL = 30,
|
|
59
|
+
AggregateExpr = 31,
|
|
60
|
+
AggregateOp = 32,
|
|
61
|
+
AggregateModifier = 33,
|
|
62
|
+
GroupingLabels = 34,
|
|
63
|
+
LabelName = 35,
|
|
64
|
+
QuotedLabelName = 36,
|
|
65
|
+
StringLiteral = 37,
|
|
66
|
+
FunctionCallBody = 38,
|
|
67
|
+
BinaryExpr = 39,
|
|
68
|
+
Pow = 40,
|
|
69
|
+
BoolModifier = 41,
|
|
70
|
+
MatchingModifierClause = 42,
|
|
71
|
+
Mul = 43,
|
|
72
|
+
Div = 44,
|
|
73
|
+
Mod = 45,
|
|
74
|
+
Add = 46,
|
|
75
|
+
Sub = 47,
|
|
76
|
+
Eql = 48,
|
|
77
|
+
Gte = 49,
|
|
78
|
+
Gtr = 50,
|
|
79
|
+
Lte = 51,
|
|
80
|
+
Lss = 52,
|
|
81
|
+
Neq = 53,
|
|
82
|
+
FunctionCall = 54,
|
|
83
|
+
FunctionIdentifier = 55,
|
|
84
|
+
AbsentOverTime = 56,
|
|
85
|
+
Identifier = 57,
|
|
86
|
+
Absent = 58,
|
|
87
|
+
Abs = 59,
|
|
88
|
+
Acos = 60,
|
|
89
|
+
Acosh = 61,
|
|
90
|
+
Asin = 62,
|
|
91
|
+
Asinh = 63,
|
|
92
|
+
Atan = 64,
|
|
93
|
+
Atanh = 65,
|
|
94
|
+
AvgOverTime = 66,
|
|
95
|
+
Ceil = 67,
|
|
96
|
+
Changes = 68,
|
|
97
|
+
Clamp = 69,
|
|
98
|
+
ClampMax = 70,
|
|
99
|
+
ClampMin = 71,
|
|
100
|
+
Cos = 72,
|
|
101
|
+
Cosh = 73,
|
|
102
|
+
CountOverTime = 74,
|
|
103
|
+
DaysInMonth = 75,
|
|
104
|
+
DayOfMonth = 76,
|
|
105
|
+
DayOfWeek = 77,
|
|
106
|
+
DayOfYear = 78,
|
|
107
|
+
Deg = 79,
|
|
108
|
+
Delta = 80,
|
|
109
|
+
Deriv = 81,
|
|
110
|
+
Exp = 82,
|
|
111
|
+
Floor = 83,
|
|
112
|
+
HistogramCount = 84,
|
|
113
|
+
HistogramFraction = 85,
|
|
114
|
+
HistogramQuantile = 86,
|
|
115
|
+
HistogramStdDev = 87,
|
|
116
|
+
HistogramStdVar = 88,
|
|
117
|
+
HistogramSum = 89,
|
|
118
|
+
HistogramAvg = 90,
|
|
119
|
+
DoubleExponentialSmoothing = 91,
|
|
120
|
+
Hour = 92,
|
|
121
|
+
Idelta = 93,
|
|
122
|
+
Increase = 94,
|
|
123
|
+
Info = 95,
|
|
124
|
+
Irate = 96,
|
|
125
|
+
LabelReplace = 97,
|
|
126
|
+
LabelJoin = 98,
|
|
127
|
+
LastOverTime = 99,
|
|
128
|
+
Ln = 100,
|
|
129
|
+
Log10 = 101,
|
|
130
|
+
Log2 = 102,
|
|
131
|
+
MadOverTime = 103,
|
|
132
|
+
MaxOverTime = 104,
|
|
133
|
+
MinOverTime = 105,
|
|
134
|
+
TsOfMaxOverTime = 106,
|
|
135
|
+
TsOfMinOverTime = 107,
|
|
136
|
+
TsOfLastOverTime = 108,
|
|
137
|
+
Minute = 109,
|
|
138
|
+
Month = 110,
|
|
139
|
+
Pi = 111,
|
|
140
|
+
PredictLinear = 112,
|
|
141
|
+
PresentOverTime = 113,
|
|
142
|
+
QuantileOverTime = 114,
|
|
143
|
+
Rad = 115,
|
|
144
|
+
Rate = 116,
|
|
145
|
+
Resets = 117,
|
|
146
|
+
Round = 118,
|
|
147
|
+
Scalar = 119,
|
|
148
|
+
Sgn = 120,
|
|
149
|
+
Sin = 121,
|
|
150
|
+
Sinh = 122,
|
|
151
|
+
Sort = 123,
|
|
152
|
+
SortDesc = 124,
|
|
153
|
+
SortByLabel = 125,
|
|
154
|
+
SortByLabelDesc = 126,
|
|
155
|
+
Sqrt = 127,
|
|
156
|
+
StddevOverTime = 128,
|
|
157
|
+
StdvarOverTime = 129,
|
|
158
|
+
SumOverTime = 130,
|
|
159
|
+
Tan = 131,
|
|
160
|
+
Tanh = 132,
|
|
161
|
+
Timestamp = 133,
|
|
162
|
+
Time = 134,
|
|
163
|
+
Vector = 135,
|
|
164
|
+
Year = 136,
|
|
165
|
+
MatrixSelector = 137,
|
|
166
|
+
NumberDurationLiteralInDurationContext = 138,
|
|
167
|
+
NumberDurationLiteral = 139,
|
|
168
|
+
OffsetExpr = 140,
|
|
169
|
+
ParenExpr = 141,
|
|
170
|
+
SubqueryExpr = 142,
|
|
171
|
+
UnaryExpr = 143,
|
|
172
|
+
UnaryOp = 144,
|
|
173
|
+
VectorSelector = 145,
|
|
174
|
+
LabelMatchers = 146,
|
|
175
|
+
UnquotedLabelMatcher = 147,
|
|
176
|
+
MatchOp = 148,
|
|
177
|
+
EqlSingle = 149,
|
|
178
|
+
EqlRegex = 150,
|
|
179
|
+
NeqRegex = 151,
|
|
180
|
+
QuotedLabelMatcher = 152,
|
|
181
|
+
StepInvariantExpr = 153,
|
|
182
|
+
At = 154,
|
|
183
|
+
AtModifierPreprocessors = 155,
|
|
184
|
+
MetricName = 156
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
export const
|
|
3
|
+
inf = 161,
|
|
4
|
+
nan = 162,
|
|
5
|
+
Bool = 1,
|
|
6
|
+
Ignoring = 2,
|
|
7
|
+
On = 3,
|
|
8
|
+
GroupLeft = 4,
|
|
9
|
+
GroupRight = 5,
|
|
10
|
+
Offset = 6,
|
|
11
|
+
Atan2 = 7,
|
|
12
|
+
Avg = 8,
|
|
13
|
+
Bottomk = 9,
|
|
14
|
+
Count = 10,
|
|
15
|
+
CountValues = 11,
|
|
16
|
+
Group = 12,
|
|
17
|
+
Max = 13,
|
|
18
|
+
Min = 14,
|
|
19
|
+
Quantile = 15,
|
|
20
|
+
LimitK = 16,
|
|
21
|
+
LimitRatio = 17,
|
|
22
|
+
Stddev = 18,
|
|
23
|
+
Stdvar = 19,
|
|
24
|
+
Sum = 20,
|
|
25
|
+
Topk = 21,
|
|
26
|
+
By = 22,
|
|
27
|
+
Without = 23,
|
|
28
|
+
And = 24,
|
|
29
|
+
Or = 25,
|
|
30
|
+
Unless = 26,
|
|
31
|
+
Start = 27,
|
|
32
|
+
End = 28,
|
|
33
|
+
LineComment = 29,
|
|
34
|
+
PromQL = 30,
|
|
35
|
+
AggregateExpr = 31,
|
|
36
|
+
AggregateOp = 32,
|
|
37
|
+
AggregateModifier = 33,
|
|
38
|
+
GroupingLabels = 34,
|
|
39
|
+
LabelName = 35,
|
|
40
|
+
QuotedLabelName = 36,
|
|
41
|
+
StringLiteral = 37,
|
|
42
|
+
FunctionCallBody = 38,
|
|
43
|
+
BinaryExpr = 39,
|
|
44
|
+
Pow = 40,
|
|
45
|
+
BoolModifier = 41,
|
|
46
|
+
MatchingModifierClause = 42,
|
|
47
|
+
Mul = 43,
|
|
48
|
+
Div = 44,
|
|
49
|
+
Mod = 45,
|
|
50
|
+
Add = 46,
|
|
51
|
+
Sub = 47,
|
|
52
|
+
Eql = 48,
|
|
53
|
+
Gte = 49,
|
|
54
|
+
Gtr = 50,
|
|
55
|
+
Lte = 51,
|
|
56
|
+
Lss = 52,
|
|
57
|
+
Neq = 53,
|
|
58
|
+
FunctionCall = 54,
|
|
59
|
+
FunctionIdentifier = 55,
|
|
60
|
+
AbsentOverTime = 56,
|
|
61
|
+
Identifier = 57,
|
|
62
|
+
Absent = 58,
|
|
63
|
+
Abs = 59,
|
|
64
|
+
Acos = 60,
|
|
65
|
+
Acosh = 61,
|
|
66
|
+
Asin = 62,
|
|
67
|
+
Asinh = 63,
|
|
68
|
+
Atan = 64,
|
|
69
|
+
Atanh = 65,
|
|
70
|
+
AvgOverTime = 66,
|
|
71
|
+
Ceil = 67,
|
|
72
|
+
Changes = 68,
|
|
73
|
+
Clamp = 69,
|
|
74
|
+
ClampMax = 70,
|
|
75
|
+
ClampMin = 71,
|
|
76
|
+
Cos = 72,
|
|
77
|
+
Cosh = 73,
|
|
78
|
+
CountOverTime = 74,
|
|
79
|
+
DaysInMonth = 75,
|
|
80
|
+
DayOfMonth = 76,
|
|
81
|
+
DayOfWeek = 77,
|
|
82
|
+
DayOfYear = 78,
|
|
83
|
+
Deg = 79,
|
|
84
|
+
Delta = 80,
|
|
85
|
+
Deriv = 81,
|
|
86
|
+
Exp = 82,
|
|
87
|
+
Floor = 83,
|
|
88
|
+
HistogramCount = 84,
|
|
89
|
+
HistogramFraction = 85,
|
|
90
|
+
HistogramQuantile = 86,
|
|
91
|
+
HistogramStdDev = 87,
|
|
92
|
+
HistogramStdVar = 88,
|
|
93
|
+
HistogramSum = 89,
|
|
94
|
+
HistogramAvg = 90,
|
|
95
|
+
DoubleExponentialSmoothing = 91,
|
|
96
|
+
Hour = 92,
|
|
97
|
+
Idelta = 93,
|
|
98
|
+
Increase = 94,
|
|
99
|
+
Info = 95,
|
|
100
|
+
Irate = 96,
|
|
101
|
+
LabelReplace = 97,
|
|
102
|
+
LabelJoin = 98,
|
|
103
|
+
LastOverTime = 99,
|
|
104
|
+
Ln = 100,
|
|
105
|
+
Log10 = 101,
|
|
106
|
+
Log2 = 102,
|
|
107
|
+
MadOverTime = 103,
|
|
108
|
+
MaxOverTime = 104,
|
|
109
|
+
MinOverTime = 105,
|
|
110
|
+
TsOfMaxOverTime = 106,
|
|
111
|
+
TsOfMinOverTime = 107,
|
|
112
|
+
TsOfLastOverTime = 108,
|
|
113
|
+
Minute = 109,
|
|
114
|
+
Month = 110,
|
|
115
|
+
Pi = 111,
|
|
116
|
+
PredictLinear = 112,
|
|
117
|
+
PresentOverTime = 113,
|
|
118
|
+
QuantileOverTime = 114,
|
|
119
|
+
Rad = 115,
|
|
120
|
+
Rate = 116,
|
|
121
|
+
Resets = 117,
|
|
122
|
+
Round = 118,
|
|
123
|
+
Scalar = 119,
|
|
124
|
+
Sgn = 120,
|
|
125
|
+
Sin = 121,
|
|
126
|
+
Sinh = 122,
|
|
127
|
+
Sort = 123,
|
|
128
|
+
SortDesc = 124,
|
|
129
|
+
SortByLabel = 125,
|
|
130
|
+
SortByLabelDesc = 126,
|
|
131
|
+
Sqrt = 127,
|
|
132
|
+
StddevOverTime = 128,
|
|
133
|
+
StdvarOverTime = 129,
|
|
134
|
+
SumOverTime = 130,
|
|
135
|
+
Tan = 131,
|
|
136
|
+
Tanh = 132,
|
|
137
|
+
Timestamp = 133,
|
|
138
|
+
Time = 134,
|
|
139
|
+
Vector = 135,
|
|
140
|
+
Year = 136,
|
|
141
|
+
MatrixSelector = 137,
|
|
142
|
+
NumberDurationLiteralInDurationContext = 138,
|
|
143
|
+
NumberDurationLiteral = 139,
|
|
144
|
+
OffsetExpr = 140,
|
|
145
|
+
ParenExpr = 141,
|
|
146
|
+
SubqueryExpr = 142,
|
|
147
|
+
UnaryExpr = 143,
|
|
148
|
+
UnaryOp = 144,
|
|
149
|
+
VectorSelector = 145,
|
|
150
|
+
LabelMatchers = 146,
|
|
151
|
+
UnquotedLabelMatcher = 147,
|
|
152
|
+
MatchOp = 148,
|
|
153
|
+
EqlSingle = 149,
|
|
154
|
+
EqlRegex = 150,
|
|
155
|
+
NeqRegex = 151,
|
|
156
|
+
QuotedLabelMatcher = 152,
|
|
157
|
+
StepInvariantExpr = 153,
|
|
158
|
+
At = 154,
|
|
159
|
+
AtModifierPreprocessors = 155,
|
|
160
|
+
MetricName = 156
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
// Copyright 2021 The Prometheus Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
|
|
14
|
+
@top PromQL { expr }
|
|
15
|
+
@top MetricName { Identifier }
|
|
16
|
+
|
|
17
|
+
@precedence {
|
|
18
|
+
group,
|
|
19
|
+
pow @right,
|
|
20
|
+
mul @left
|
|
21
|
+
add @left,
|
|
22
|
+
eql @left,
|
|
23
|
+
and @left,
|
|
24
|
+
or @left
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
expr[@isGroup=Expr] {
|
|
28
|
+
AggregateExpr |
|
|
29
|
+
BinaryExpr |
|
|
30
|
+
FunctionCall |
|
|
31
|
+
MatrixSelector |
|
|
32
|
+
NumberDurationLiteral |
|
|
33
|
+
OffsetExpr |
|
|
34
|
+
ParenExpr |
|
|
35
|
+
StringLiteral |
|
|
36
|
+
SubqueryExpr |
|
|
37
|
+
UnaryExpr |
|
|
38
|
+
VectorSelector |
|
|
39
|
+
StepInvariantExpr
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
AggregateExpr {
|
|
43
|
+
AggregateOp AggregateModifier FunctionCallBody |
|
|
44
|
+
AggregateOp FunctionCallBody AggregateModifier |
|
|
45
|
+
AggregateOp FunctionCallBody
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
AggregateOp {
|
|
49
|
+
Avg |
|
|
50
|
+
Bottomk |
|
|
51
|
+
Count |
|
|
52
|
+
CountValues |
|
|
53
|
+
Group |
|
|
54
|
+
Max |
|
|
55
|
+
Min |
|
|
56
|
+
Quantile |
|
|
57
|
+
LimitK |
|
|
58
|
+
LimitRatio |
|
|
59
|
+
Stddev |
|
|
60
|
+
Stdvar |
|
|
61
|
+
Sum |
|
|
62
|
+
Topk
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
AggregateModifier {
|
|
66
|
+
By GroupingLabels |
|
|
67
|
+
Without GroupingLabels
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
BinaryExpr {
|
|
71
|
+
expr !pow Pow binModifiers expr |
|
|
72
|
+
expr !mul Mul binModifiers expr |
|
|
73
|
+
expr !mul Div binModifiers expr |
|
|
74
|
+
expr !mul Mod binModifiers expr |
|
|
75
|
+
expr !mul Atan2 binModifiers expr |
|
|
76
|
+
expr !add Add binModifiers expr |
|
|
77
|
+
expr !add Sub binModifiers expr |
|
|
78
|
+
expr !eql Eql binModifiers expr |
|
|
79
|
+
expr !eql Gte binModifiers expr |
|
|
80
|
+
expr !eql Gtr binModifiers expr |
|
|
81
|
+
expr !eql Lte binModifiers expr |
|
|
82
|
+
expr !eql Lss binModifiers expr |
|
|
83
|
+
expr !eql Neq binModifiers expr |
|
|
84
|
+
expr !and And binModifiers expr |
|
|
85
|
+
expr !and Unless binModifiers expr |
|
|
86
|
+
expr !or Or binModifiers expr
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
MatchingModifierClause {
|
|
90
|
+
(Ignoring | On) GroupingLabels
|
|
91
|
+
((GroupLeft | GroupRight) (!group GroupingLabels)?)?
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
BoolModifier { Bool }
|
|
95
|
+
|
|
96
|
+
binModifiers {
|
|
97
|
+
BoolModifier?
|
|
98
|
+
MatchingModifierClause?
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
GroupingLabels {
|
|
102
|
+
"(" ((LabelName | QuotedLabelName) ("," (LabelName | QuotedLabelName))* ","?)? ")"
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
FunctionCall {
|
|
106
|
+
FunctionIdentifier FunctionCallBody
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
FunctionIdentifier {
|
|
110
|
+
AbsentOverTime |
|
|
111
|
+
Absent |
|
|
112
|
+
Abs |
|
|
113
|
+
Acos |
|
|
114
|
+
Acosh |
|
|
115
|
+
Asin |
|
|
116
|
+
Asinh |
|
|
117
|
+
Atan |
|
|
118
|
+
Atanh |
|
|
119
|
+
AvgOverTime |
|
|
120
|
+
Ceil |
|
|
121
|
+
Changes |
|
|
122
|
+
Clamp |
|
|
123
|
+
ClampMax |
|
|
124
|
+
ClampMin |
|
|
125
|
+
Cos |
|
|
126
|
+
Cosh |
|
|
127
|
+
CountOverTime |
|
|
128
|
+
DaysInMonth |
|
|
129
|
+
DayOfMonth |
|
|
130
|
+
DayOfWeek |
|
|
131
|
+
DayOfYear |
|
|
132
|
+
Deg |
|
|
133
|
+
Delta |
|
|
134
|
+
Deriv |
|
|
135
|
+
Exp |
|
|
136
|
+
Floor |
|
|
137
|
+
HistogramCount |
|
|
138
|
+
HistogramFraction |
|
|
139
|
+
HistogramQuantile |
|
|
140
|
+
HistogramStdDev |
|
|
141
|
+
HistogramStdVar |
|
|
142
|
+
HistogramSum |
|
|
143
|
+
HistogramAvg |
|
|
144
|
+
DoubleExponentialSmoothing |
|
|
145
|
+
Hour |
|
|
146
|
+
Idelta |
|
|
147
|
+
Increase |
|
|
148
|
+
Info |
|
|
149
|
+
Irate |
|
|
150
|
+
LabelReplace |
|
|
151
|
+
LabelJoin |
|
|
152
|
+
LastOverTime |
|
|
153
|
+
Ln |
|
|
154
|
+
Log10 |
|
|
155
|
+
Log2 |
|
|
156
|
+
MadOverTime |
|
|
157
|
+
MaxOverTime |
|
|
158
|
+
MinOverTime |
|
|
159
|
+
TsOfMaxOverTime |
|
|
160
|
+
TsOfMinOverTime |
|
|
161
|
+
TsOfLastOverTime |
|
|
162
|
+
Minute |
|
|
163
|
+
Month |
|
|
164
|
+
Pi |
|
|
165
|
+
PredictLinear |
|
|
166
|
+
PresentOverTime |
|
|
167
|
+
QuantileOverTime |
|
|
168
|
+
Rad |
|
|
169
|
+
Rate |
|
|
170
|
+
Resets |
|
|
171
|
+
Round |
|
|
172
|
+
Scalar |
|
|
173
|
+
Sgn |
|
|
174
|
+
Sin |
|
|
175
|
+
Sinh |
|
|
176
|
+
Sort |
|
|
177
|
+
SortDesc |
|
|
178
|
+
SortByLabel |
|
|
179
|
+
SortByLabelDesc |
|
|
180
|
+
Sqrt |
|
|
181
|
+
StddevOverTime |
|
|
182
|
+
StdvarOverTime |
|
|
183
|
+
SumOverTime |
|
|
184
|
+
Tan |
|
|
185
|
+
Tanh |
|
|
186
|
+
Timestamp |
|
|
187
|
+
Time |
|
|
188
|
+
Vector |
|
|
189
|
+
Year
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
FunctionCallBody {
|
|
193
|
+
"(" (expr ("," expr)*)? ")"
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
ParenExpr {
|
|
197
|
+
"(" expr ")"
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
OffsetExpr {
|
|
201
|
+
expr Offset NumberDurationLiteralInDurationContext
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
MatrixSelector {
|
|
205
|
+
// TODO: Can this not be more specific than "expr"?
|
|
206
|
+
expr "[" NumberDurationLiteralInDurationContext "]"
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
SubqueryExpr {
|
|
210
|
+
expr "[" NumberDurationLiteralInDurationContext ":" ("" | NumberDurationLiteralInDurationContext) "]"
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
UnaryExpr {
|
|
214
|
+
!mul UnaryOp~signed expr
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
UnaryOp {
|
|
218
|
+
"-" |
|
|
219
|
+
"+"
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
VectorSelector {
|
|
223
|
+
Identifier LabelMatchers |
|
|
224
|
+
Identifier |
|
|
225
|
+
LabelMatchers
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
LabelMatchers {
|
|
229
|
+
"{" ((UnquotedLabelMatcher | QuotedLabelMatcher | QuotedLabelName)("," (UnquotedLabelMatcher | QuotedLabelMatcher | QuotedLabelName))* ","?)? "}"
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
MatchOp {
|
|
233
|
+
EqlSingle |
|
|
234
|
+
Neq |
|
|
235
|
+
EqlRegex |
|
|
236
|
+
NeqRegex
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
UnquotedLabelMatcher {
|
|
240
|
+
LabelName MatchOp StringLiteral
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
QuotedLabelMatcher {
|
|
244
|
+
QuotedLabelName MatchOp StringLiteral
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
QuotedLabelName {
|
|
248
|
+
StringLiteral
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
StepInvariantExpr {
|
|
252
|
+
expr At ( NumberDurationLiteral | AtModifierPreprocessors "(" ")" )
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
AtModifierPreprocessors {
|
|
256
|
+
Start | End
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
NumberDurationLiteral {
|
|
260
|
+
("-"|"+")?~signed (number | inf | nan)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
NumberDurationLiteralInDurationContext {
|
|
264
|
+
("-"|"+")?~signed (number | inf | nan)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@skip { whitespace | LineComment }
|
|
268
|
+
|
|
269
|
+
@tokens {
|
|
270
|
+
whitespace { std.whitespace+ }
|
|
271
|
+
LineComment { "#" ![\n]* }
|
|
272
|
+
|
|
273
|
+
number {
|
|
274
|
+
(std.digit+ (("_")? std.digit)* ("." std.digit+ (("_")? std.digit)*)? | "." std.digit+ (("_")? std.digit)*) (("e" | "E") ("+" | "-")? std.digit+ (("_")? std.digit)*)? |
|
|
275
|
+
"0x" (std.digit | $[a-fA-F])+ | duration
|
|
276
|
+
}
|
|
277
|
+
StringLiteral { // TODO: This is for JS, make this work for PromQL.
|
|
278
|
+
'"' (![\\\n"] | "\\" _)* '"'? |
|
|
279
|
+
"'" (![\\\n'] | "\\" _)* "'"? |
|
|
280
|
+
"`" ![`]* "`"
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
duration {
|
|
284
|
+
// Each line below is just the same regex repeated over and over, but each time with one of the units made non-optional,
|
|
285
|
+
// to ensure that at least one <number>+<unit> pair is provided and an empty string is not recognized as a valid duration.
|
|
286
|
+
( ( std.digit+ "y" ) ( std.digit+ "w" )? ( std.digit+ "d" )? ( std.digit+ "h" )? ( std.digit+ "m" )? ( std.digit+ "s" )? ( std.digit+ "ms" )? ) |
|
|
287
|
+
( ( std.digit+ "y" )? ( std.digit+ "w" ) ( std.digit+ "d" )? ( std.digit+ "h" )? ( std.digit+ "m" )? ( std.digit+ "s" )? ( std.digit+ "ms" )? ) |
|
|
288
|
+
( ( std.digit+ "y" )? ( std.digit+ "w" )? ( std.digit+ "d" ) ( std.digit+ "h" )? ( std.digit+ "m" )? ( std.digit+ "s" )? ( std.digit+ "ms" )? ) |
|
|
289
|
+
( ( std.digit+ "y" )? ( std.digit+ "w" )? ( std.digit+ "d" )? ( std.digit+ "h" ) ( std.digit+ "m" )? ( std.digit+ "s" )? ( std.digit+ "ms" )? ) |
|
|
290
|
+
( ( std.digit+ "y" )? ( std.digit+ "w" )? ( std.digit+ "d" )? ( std.digit+ "h" )? ( std.digit+ "m" ) ( std.digit+ "s" )? ( std.digit+ "ms" )? ) |
|
|
291
|
+
( ( std.digit+ "y" )? ( std.digit+ "w" )? ( std.digit+ "d" )? ( std.digit+ "h" )? ( std.digit+ "m" )? ( std.digit+ "s" ) ( std.digit+ "ms" )? ) |
|
|
292
|
+
( ( std.digit+ "y" )? ( std.digit+ "w" )? ( std.digit+ "d" )? ( std.digit+ "h" )? ( std.digit+ "m" )? ( std.digit+ "s" )? ( std.digit+ "ms" ) )
|
|
293
|
+
}
|
|
294
|
+
Identifier { (std.asciiLetter | "_" | ":") (std.asciiLetter | std.digit | "_" | ":" )*}
|
|
295
|
+
LabelName { (std.asciiLetter | "_") (std.asciiLetter | std.digit | "_")* }
|
|
296
|
+
|
|
297
|
+
// Operator
|
|
298
|
+
Sub { "-" }
|
|
299
|
+
Add { "+" }
|
|
300
|
+
Mul { "*" }
|
|
301
|
+
Mod { "%" }
|
|
302
|
+
Div { "/" }
|
|
303
|
+
Eql { "==" }
|
|
304
|
+
Neq { "!=" }
|
|
305
|
+
Lte { "<=" }
|
|
306
|
+
Lss { "<" }
|
|
307
|
+
Gte { ">=" }
|
|
308
|
+
Gtr { ">" }
|
|
309
|
+
EqlRegex { "=~" }
|
|
310
|
+
EqlSingle { "=" }
|
|
311
|
+
NeqRegex { "!~" }
|
|
312
|
+
Pow { "^" }
|
|
313
|
+
|
|
314
|
+
// Special Modifier
|
|
315
|
+
At { "@" }
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Keywords
|
|
319
|
+
|
|
320
|
+
@external specialize {Identifier} specializeIdentifier from "./tokens" {
|
|
321
|
+
inf,
|
|
322
|
+
nan,
|
|
323
|
+
Bool,
|
|
324
|
+
Ignoring,
|
|
325
|
+
On,
|
|
326
|
+
GroupLeft,
|
|
327
|
+
GroupRight,
|
|
328
|
+
Offset
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Contextual keywords
|
|
332
|
+
|
|
333
|
+
@external extend {Identifier} extendIdentifier from "./tokens" {
|
|
334
|
+
Atan2,
|
|
335
|
+
Avg,
|
|
336
|
+
Bottomk,
|
|
337
|
+
Count,
|
|
338
|
+
CountValues,
|
|
339
|
+
Group,
|
|
340
|
+
Max,
|
|
341
|
+
Min,
|
|
342
|
+
Quantile,
|
|
343
|
+
LimitK,
|
|
344
|
+
LimitRatio,
|
|
345
|
+
Stddev,
|
|
346
|
+
Stdvar,
|
|
347
|
+
Sum,
|
|
348
|
+
Topk,
|
|
349
|
+
By,
|
|
350
|
+
Without,
|
|
351
|
+
And,
|
|
352
|
+
Or,
|
|
353
|
+
Unless,
|
|
354
|
+
Start,
|
|
355
|
+
End
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@external propSource promQLHighLight from "./highlight"
|
|
359
|
+
|
|
360
|
+
// FunctionIdentifier definitions
|
|
361
|
+
Abs { condFn<"abs"> }
|
|
362
|
+
Absent { condFn<"absent"> }
|
|
363
|
+
AbsentOverTime { condFn<"absent_over_time"> }
|
|
364
|
+
Acos { condFn<"acos"> }
|
|
365
|
+
Acosh { condFn<"acosh"> }
|
|
366
|
+
Asin { condFn<"asin"> }
|
|
367
|
+
Asinh { condFn<"asinh">}
|
|
368
|
+
Atan { condFn<"atan"> }
|
|
369
|
+
Atanh { condFn<"atanh">}
|
|
370
|
+
AvgOverTime { condFn<"avg_over_time"> }
|
|
371
|
+
Ceil { condFn<"ceil"> }
|
|
372
|
+
Changes { condFn<"changes"> }
|
|
373
|
+
Clamp { condFn<"clamp"> }
|
|
374
|
+
ClampMax { condFn<"clamp_max"> }
|
|
375
|
+
ClampMin { condFn<"clamp_min"> }
|
|
376
|
+
Cos { condFn<"cos">}
|
|
377
|
+
Cosh { condFn<"cosh">}
|
|
378
|
+
CountOverTime { condFn<"count_over_time"> }
|
|
379
|
+
DaysInMonth { condFn<"days_in_month"> }
|
|
380
|
+
DayOfMonth { condFn<"day_of_month"> }
|
|
381
|
+
DayOfWeek { condFn<"day_of_week"> }
|
|
382
|
+
DayOfYear { condFn<"day_of_year"> }
|
|
383
|
+
Deg { condFn<"deg"> }
|
|
384
|
+
Delta { condFn<"delta"> }
|
|
385
|
+
Deriv { condFn<"deriv"> }
|
|
386
|
+
Exp { condFn<"exp"> }
|
|
387
|
+
Floor { condFn<"floor"> }
|
|
388
|
+
HistogramAvg { condFn<"histogram_avg"> }
|
|
389
|
+
HistogramCount { condFn<"histogram_count"> }
|
|
390
|
+
HistogramFraction { condFn<"histogram_fraction"> }
|
|
391
|
+
HistogramQuantile { condFn<"histogram_quantile"> }
|
|
392
|
+
HistogramStdDev { condFn<"histogram_stddev"> }
|
|
393
|
+
HistogramStdVar { condFn<"histogram_stdvar"> }
|
|
394
|
+
HistogramSum { condFn<"histogram_sum"> }
|
|
395
|
+
DoubleExponentialSmoothing { condFn<"double_exponential_smoothing"> }
|
|
396
|
+
Hour { condFn<"hour"> }
|
|
397
|
+
Idelta { condFn<"idelta"> }
|
|
398
|
+
Increase { condFn<"increase"> }
|
|
399
|
+
Info { condFn<"info"> }
|
|
400
|
+
Irate { condFn<"irate"> }
|
|
401
|
+
LabelReplace { condFn<"label_replace"> }
|
|
402
|
+
LabelJoin { condFn<"label_join"> }
|
|
403
|
+
LastOverTime {condFn<"last_over_time">}
|
|
404
|
+
Ln { condFn<"ln"> }
|
|
405
|
+
Log10 { condFn<"log10"> }
|
|
406
|
+
Log2 { condFn<"log2"> }
|
|
407
|
+
MadOverTime { condFn<"mad_over_time"> }
|
|
408
|
+
MaxOverTime { condFn<"max_over_time"> }
|
|
409
|
+
MinOverTime { condFn<"min_over_time"> }
|
|
410
|
+
TsOfMaxOverTime { condFn<"ts_of_max_over_time"> }
|
|
411
|
+
TsOfMinOverTime { condFn<"ts_of_min_over_time"> }
|
|
412
|
+
TsOfLastOverTime { condFn<"ts_of_last_over_time"> }
|
|
413
|
+
Minute { condFn<"minute"> }
|
|
414
|
+
Month { condFn<"month"> }
|
|
415
|
+
Pi { condFn<"pi">}
|
|
416
|
+
PredictLinear { condFn<"predict_linear"> }
|
|
417
|
+
PresentOverTime { condFn<"present_over_time"> }
|
|
418
|
+
QuantileOverTime { condFn<"quantile_over_time"> }
|
|
419
|
+
Rad { condFn<"rad"> }
|
|
420
|
+
Rate { condFn<"rate"> }
|
|
421
|
+
Resets { condFn<"resets"> }
|
|
422
|
+
Round { condFn<"round"> }
|
|
423
|
+
Scalar { condFn<"scalar"> }
|
|
424
|
+
Sgn { condFn<"sgn"> }
|
|
425
|
+
Sin { condFn<"sin">}
|
|
426
|
+
Sinh { condFn<"sinh"> }
|
|
427
|
+
Sort { condFn<"sort"> }
|
|
428
|
+
SortDesc { condFn<"sort_desc"> }
|
|
429
|
+
SortByLabel { condFn<"sort_by_label"> }
|
|
430
|
+
SortByLabelDesc { condFn<"sort_by_label_desc"> }
|
|
431
|
+
Sqrt { condFn<"sqrt"> }
|
|
432
|
+
StddevOverTime { condFn<"stddev_over_time"> }
|
|
433
|
+
StdvarOverTime { condFn<"stdvar_over_time"> }
|
|
434
|
+
SumOverTime { condFn<"sum_over_time"> }
|
|
435
|
+
Tan { condFn<"tan"> }
|
|
436
|
+
Tanh { condFn<"tanh">}
|
|
437
|
+
Time { condFn<"time"> }
|
|
438
|
+
Timestamp { condFn<"timestamp"> }
|
|
439
|
+
Vector { condFn<"vector"> }
|
|
440
|
+
Year { condFn<"year"> }
|
|
441
|
+
|
|
442
|
+
// Conditional function names (only parsed as function names when used as such).
|
|
443
|
+
condFn<term> { @extend<Identifier, term> }
|
package/src/tokens.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Copyright 2021 The Prometheus Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
And,
|
|
16
|
+
Avg,
|
|
17
|
+
Atan2,
|
|
18
|
+
Bool,
|
|
19
|
+
Bottomk,
|
|
20
|
+
By,
|
|
21
|
+
Count,
|
|
22
|
+
CountValues,
|
|
23
|
+
End,
|
|
24
|
+
Group,
|
|
25
|
+
GroupLeft,
|
|
26
|
+
GroupRight,
|
|
27
|
+
Ignoring,
|
|
28
|
+
inf,
|
|
29
|
+
Max,
|
|
30
|
+
Min,
|
|
31
|
+
nan,
|
|
32
|
+
Offset,
|
|
33
|
+
On,
|
|
34
|
+
Or,
|
|
35
|
+
Quantile,
|
|
36
|
+
LimitK,
|
|
37
|
+
LimitRatio,
|
|
38
|
+
Start,
|
|
39
|
+
Stddev,
|
|
40
|
+
Stdvar,
|
|
41
|
+
Sum,
|
|
42
|
+
Topk,
|
|
43
|
+
Unless,
|
|
44
|
+
Without,
|
|
45
|
+
} from './parser.terms.js';
|
|
46
|
+
|
|
47
|
+
const keywordTokens = {
|
|
48
|
+
inf: inf,
|
|
49
|
+
nan: nan,
|
|
50
|
+
bool: Bool,
|
|
51
|
+
ignoring: Ignoring,
|
|
52
|
+
on: On,
|
|
53
|
+
group_left: GroupLeft,
|
|
54
|
+
group_right: GroupRight,
|
|
55
|
+
offset: Offset,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const specializeIdentifier = (value, stack) => {
|
|
59
|
+
return keywordTokens[value.toLowerCase()] || -1;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const contextualKeywordTokens = {
|
|
63
|
+
avg: Avg,
|
|
64
|
+
atan2: Atan2,
|
|
65
|
+
bottomk: Bottomk,
|
|
66
|
+
count: Count,
|
|
67
|
+
count_values: CountValues,
|
|
68
|
+
group: Group,
|
|
69
|
+
max: Max,
|
|
70
|
+
min: Min,
|
|
71
|
+
quantile: Quantile,
|
|
72
|
+
limitk: LimitK,
|
|
73
|
+
limit_ratio: LimitRatio,
|
|
74
|
+
stddev: Stddev,
|
|
75
|
+
stdvar: Stdvar,
|
|
76
|
+
sum: Sum,
|
|
77
|
+
topk: Topk,
|
|
78
|
+
by: By,
|
|
79
|
+
without: Without,
|
|
80
|
+
and: And,
|
|
81
|
+
or: Or,
|
|
82
|
+
unless: Unless,
|
|
83
|
+
start: Start,
|
|
84
|
+
end: End,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const extendIdentifier = (value, stack) => {
|
|
88
|
+
return contextualKeywordTokens[value.toLowerCase()] || -1;
|
|
89
|
+
};
|