-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
121 lines (108 loc) · 1.88 KB
/
index.d.ts
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
import type { Parser } from "pegjs";
export type Duration = {
duration: number;
unit:
| "years"
| "weeks"
| "days"
| "hours"
| "minutes"
| "seconds"
| "milliseconds";
};
export type Expr =
| BinaryExpr
| number
| string
| AggregateExpr
| FunctionCall
| MatrixSelector
| VectorSelector;
export type FunctionCall = { func: FunctionIndentifier; body: Array<Expr>; }
export type BinaryExpr = { left: Expr; op: BinaryOp; right: Expr };
export type AggregateExpr = {
aggregator: AggregationOp;
body: Array<Expr>;
labels?: Array<string>;
aggregate_modifier?: "by" | "without";
};
export type VectorSelector = {
metric: string;
selectors?: Array<LabelMatcher>;
};
export type LabelMatcher = { label: string; op: MatchOp; value: string };
export type MatrixSelector = VectorSelector & { range: Array<Duration> };
export type BinaryOp =
| "-"
| "+"
| "*"
| "%"
| "/"
| "=="
| "!="
| "<="
| "<"
| ">="
| ">"
| "=~"
| "="
| "!~"
| "^";
export type MatchOp = "==" | "!=" | ">" | "<" | ">=" | "<=" | "=~" | "!~" | "=";
export type AggregationOp =
| "sum"
| "min"
| "max"
| "avg"
| "group"
| "stddev"
| "stdvar"
| "count"
| "count_values"
| "bottomk"
| "topk"
| "quantile";
export type FunctionIndentifier =
| "abs"
| "absent"
| "absent_over_time"
| "ceil"
| "changes"
| "clamp"
| "clamp_max"
| "clamp_min"
| "day_of_month"
| "day_of_week"
| "days_in_month"
| "delta"
| "deriv"
| "exp"
| "floor"
| "histogram_quantile"
| "holt_winters"
| "hour"
| "idelta"
| "increase"
| "irate"
| "label_join"
| "label_replace"
| "ln"
| "log2"
| "log10"
| "max"
| "minute"
| "month"
| "predict_linear"
| "rate"
| "resets"
| "round"
| "scalar"
| "sgn"
| "sort"
| "sort_desc"
| "sqrt"
| "time"
| "timestamp"
| "vector"
| "year";
export default Parser;