@perses-dev/prometheus-plugin 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59
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/dist/cjs/components/PromQL.js +10 -8
- package/dist/cjs/components/index.js +10 -8
- package/dist/cjs/index.js +33 -19
- package/dist/cjs/model/index.js +14 -13
- package/dist/cjs/model/parse-sample-values.js +6 -2
- package/dist/cjs/model/prometheus-client.js +43 -8
- package/dist/cjs/model/prometheus-selectors.js +12 -4
- package/dist/cjs/model/time.js +15 -9
- package/dist/cjs/plugins/MatcherEditor.js +14 -12
- package/dist/cjs/plugins/PrometheusDatasourceEditor.js +610 -0
- package/dist/cjs/plugins/prometheus-datasource.js +59 -8
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +49 -24
- package/dist/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +44 -24
- package/dist/cjs/plugins/prometheus-time-series-query/index.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/query-editor-model.js +44 -11
- package/dist/cjs/plugins/prometheus-variables.js +69 -63
- package/dist/cjs/plugins/types.js +7 -0
- package/dist/cjs/plugins/variable.js +9 -7
- package/dist/cjs/utils/index.js +10 -8
- package/dist/cjs/utils/utils.js +13 -7
- package/dist/components/PromQL.d.ts +2 -3
- package/dist/components/PromQL.d.ts.map +1 -1
- package/dist/components/PromQL.js +1 -1
- package/dist/components/PromQL.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/api-types.d.ts +11 -11
- package/dist/model/api-types.d.ts.map +1 -1
- package/dist/model/api-types.js.map +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +0 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/parse-sample-values.d.ts +1 -1
- package/dist/model/parse-sample-values.d.ts.map +1 -1
- package/dist/model/parse-sample-values.js.map +1 -1
- package/dist/model/prometheus-client.d.ts +4 -0
- package/dist/model/prometheus-client.d.ts.map +1 -1
- package/dist/model/prometheus-client.js +27 -3
- package/dist/model/prometheus-client.js.map +1 -1
- package/dist/model/prometheus-selectors.js.map +1 -1
- package/dist/model/time.js +2 -2
- package/dist/model/time.js.map +1 -1
- package/dist/plugins/MatcherEditor.d.ts +2 -3
- package/dist/plugins/MatcherEditor.d.ts.map +1 -1
- package/dist/plugins/MatcherEditor.js +1 -1
- package/dist/plugins/MatcherEditor.js.map +1 -1
- package/dist/plugins/{PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts → PrometheusDatasourceEditor.d.ts} +1 -2
- package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +1 -0
- package/dist/plugins/PrometheusDatasourceEditor.js +556 -0
- package/dist/plugins/PrometheusDatasourceEditor.js.map +1 -0
- package/dist/plugins/prometheus-datasource.d.ts +2 -7
- package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
- package/dist/plugins/prometheus-datasource.js +55 -6
- package/dist/plugins/prometheus-datasource.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts +1 -2
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +41 -18
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js +37 -19
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/index.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts +11 -2
- package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.js +38 -10
- package/dist/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts +4 -4
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.js +3 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -1
- package/dist/plugins/prometheus-variables.d.ts.map +1 -1
- package/dist/plugins/prometheus-variables.js +37 -37
- package/dist/plugins/prometheus-variables.js.map +1 -1
- package/dist/plugins/types.d.ts +12 -5
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +1 -1
- package/dist/plugins/types.js.map +1 -1
- package/dist/plugins/variable.d.ts +2 -2
- package/dist/plugins/variable.d.ts.map +1 -1
- package/dist/plugins/variable.js +2 -2
- package/dist/plugins/variable.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils.d.ts +2 -2
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +4 -4
- package/dist/utils/utils.js.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/model/templating.js +0 -26
- package/dist/cjs/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +0 -392
- package/dist/cjs/plugins/PrometheusDatasourceEditor/index.js +0 -29
- package/dist/cjs/plugins/PrometheusDatasourceEditor/types.js +0 -16
- package/dist/model/templating.d.ts +0 -6
- package/dist/model/templating.d.ts.map +0 -1
- package/dist/model/templating.js +0 -20
- package/dist/model/templating.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +0 -342
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts +0 -3
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.js +0 -16
- package/dist/plugins/PrometheusDatasourceEditor/index.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts +0 -20
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.js +0 -15
- package/dist/plugins/PrometheusDatasourceEditor/types.js.map +0 -1
|
@@ -21,20 +21,26 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
PrometheusLabelNamesVariable: ()
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
PrometheusLabelNamesVariable: function() {
|
|
25
|
+
return PrometheusLabelNamesVariable;
|
|
26
|
+
},
|
|
27
|
+
PrometheusLabelValuesVariable: function() {
|
|
28
|
+
return PrometheusLabelValuesVariable;
|
|
29
|
+
},
|
|
30
|
+
PrometheusPromQLVariable: function() {
|
|
31
|
+
return PrometheusPromQLVariable;
|
|
32
|
+
}
|
|
27
33
|
});
|
|
28
|
-
const
|
|
29
|
-
const
|
|
34
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
35
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
30
36
|
const _material = require("@mui/material");
|
|
31
37
|
const _immer = require("immer");
|
|
32
38
|
const _model = require("../model");
|
|
33
39
|
const _components = require("../components");
|
|
34
|
-
const
|
|
40
|
+
const _MatcherEditor = require("./MatcherEditor");
|
|
35
41
|
function PrometheusLabelValuesVariableEditor(props) {
|
|
36
|
-
const { onChange
|
|
37
|
-
const { datasource
|
|
42
|
+
const { onChange, value } = props;
|
|
43
|
+
const { datasource } = value;
|
|
38
44
|
const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : _model.DEFAULT_PROM;
|
|
39
45
|
const handleDatasourceChange = (next)=>{
|
|
40
46
|
if ((0, _model.isPrometheusDatasourceSelector)(next)) {
|
|
@@ -46,18 +52,18 @@ function PrometheusLabelValuesVariableEditor(props) {
|
|
|
46
52
|
}
|
|
47
53
|
throw new Error('Got unexpected non-Prometheus datasource selector');
|
|
48
54
|
};
|
|
49
|
-
var
|
|
50
|
-
return /*#__PURE__*/ (0,
|
|
55
|
+
var _props_value_matchers;
|
|
56
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
51
57
|
spacing: 2,
|
|
52
58
|
children: [
|
|
53
|
-
/*#__PURE__*/ (0,
|
|
59
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.FormControl, {
|
|
54
60
|
margin: "dense",
|
|
55
61
|
children: [
|
|
56
|
-
/*#__PURE__*/ (0,
|
|
62
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
|
|
57
63
|
id: "prom-datasource-label",
|
|
58
64
|
children: "Prometheus Datasource"
|
|
59
65
|
}),
|
|
60
|
-
/*#__PURE__*/ (0,
|
|
66
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
61
67
|
datasourcePluginKind: "PrometheusDatasource",
|
|
62
68
|
value: selectedDatasource,
|
|
63
69
|
onChange: handleDatasourceChange,
|
|
@@ -67,22 +73,22 @@ function PrometheusLabelValuesVariableEditor(props) {
|
|
|
67
73
|
})
|
|
68
74
|
]
|
|
69
75
|
}),
|
|
70
|
-
/*#__PURE__*/ (0,
|
|
76
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
71
77
|
label: "Label Name",
|
|
72
78
|
required: true,
|
|
73
|
-
value: props.value.
|
|
79
|
+
value: props.value.labelName,
|
|
74
80
|
onChange: (e)=>{
|
|
75
81
|
props.onChange({
|
|
76
82
|
...props.value,
|
|
77
|
-
|
|
83
|
+
labelName: e.target.value
|
|
78
84
|
});
|
|
79
85
|
},
|
|
80
86
|
InputProps: {
|
|
81
87
|
readOnly: props.isReadonly
|
|
82
88
|
}
|
|
83
89
|
}),
|
|
84
|
-
/*#__PURE__*/ (0,
|
|
85
|
-
matchers: (
|
|
90
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_MatcherEditor.MatcherEditor, {
|
|
91
|
+
matchers: (_props_value_matchers = props.value.matchers) !== null && _props_value_matchers !== void 0 ? _props_value_matchers : [],
|
|
86
92
|
onChange: (e)=>{
|
|
87
93
|
props.onChange({
|
|
88
94
|
...props.value,
|
|
@@ -95,8 +101,8 @@ function PrometheusLabelValuesVariableEditor(props) {
|
|
|
95
101
|
});
|
|
96
102
|
}
|
|
97
103
|
function PrometheusLabelNamesVariableEditor(props) {
|
|
98
|
-
const { onChange
|
|
99
|
-
const { datasource
|
|
104
|
+
const { onChange, value } = props;
|
|
105
|
+
const { datasource } = value;
|
|
100
106
|
const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : _model.DEFAULT_PROM;
|
|
101
107
|
const handleDatasourceChange = (next)=>{
|
|
102
108
|
if ((0, _model.isPrometheusDatasourceSelector)(next)) {
|
|
@@ -108,18 +114,18 @@ function PrometheusLabelNamesVariableEditor(props) {
|
|
|
108
114
|
}
|
|
109
115
|
throw new Error('Got unexpected non-Prometheus datasource selector');
|
|
110
116
|
};
|
|
111
|
-
var
|
|
112
|
-
return /*#__PURE__*/ (0,
|
|
117
|
+
var _props_value_matchers;
|
|
118
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
113
119
|
spacing: 2,
|
|
114
120
|
children: [
|
|
115
|
-
/*#__PURE__*/ (0,
|
|
121
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.FormControl, {
|
|
116
122
|
margin: "dense",
|
|
117
123
|
children: [
|
|
118
|
-
/*#__PURE__*/ (0,
|
|
124
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
|
|
119
125
|
id: "prom-datasource-label",
|
|
120
126
|
children: "Prometheus Datasource"
|
|
121
127
|
}),
|
|
122
|
-
/*#__PURE__*/ (0,
|
|
128
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
123
129
|
datasourcePluginKind: "PrometheusDatasource",
|
|
124
130
|
value: selectedDatasource,
|
|
125
131
|
onChange: handleDatasourceChange,
|
|
@@ -129,8 +135,8 @@ function PrometheusLabelNamesVariableEditor(props) {
|
|
|
129
135
|
})
|
|
130
136
|
]
|
|
131
137
|
}),
|
|
132
|
-
/*#__PURE__*/ (0,
|
|
133
|
-
matchers: (
|
|
138
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_MatcherEditor.MatcherEditor, {
|
|
139
|
+
matchers: (_props_value_matchers = props.value.matchers) !== null && _props_value_matchers !== void 0 ? _props_value_matchers : [],
|
|
134
140
|
isReadonly: props.isReadonly,
|
|
135
141
|
onChange: (e)=>{
|
|
136
142
|
props.onChange({
|
|
@@ -143,10 +149,10 @@ function PrometheusLabelNamesVariableEditor(props) {
|
|
|
143
149
|
});
|
|
144
150
|
}
|
|
145
151
|
function PrometheusPromQLVariableEditor(props) {
|
|
146
|
-
const { onChange
|
|
147
|
-
const { datasource
|
|
152
|
+
const { onChange, value } = props;
|
|
153
|
+
const { datasource } = value;
|
|
148
154
|
const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : _model.DEFAULT_PROM;
|
|
149
|
-
const { data: client
|
|
155
|
+
const { data: client } = (0, _pluginsystem.useDatasourceClient)(selectedDatasource);
|
|
150
156
|
const promURL = client === null || client === void 0 ? void 0 : client.options.datasourceUrl;
|
|
151
157
|
const handleDatasourceChange = (next)=>{
|
|
152
158
|
if ((0, _model.isPrometheusDatasourceSelector)(next)) {
|
|
@@ -158,17 +164,17 @@ function PrometheusPromQLVariableEditor(props) {
|
|
|
158
164
|
}
|
|
159
165
|
throw new Error('Got unexpected non-Prometheus datasource selector');
|
|
160
166
|
};
|
|
161
|
-
return /*#__PURE__*/ (0,
|
|
167
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
162
168
|
spacing: 2,
|
|
163
169
|
children: [
|
|
164
|
-
/*#__PURE__*/ (0,
|
|
170
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.FormControl, {
|
|
165
171
|
margin: "dense",
|
|
166
172
|
children: [
|
|
167
|
-
/*#__PURE__*/ (0,
|
|
173
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
|
|
168
174
|
id: "prom-datasource-label",
|
|
169
175
|
children: "Prometheus Datasource"
|
|
170
176
|
}),
|
|
171
|
-
/*#__PURE__*/ (0,
|
|
177
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
172
178
|
datasourcePluginKind: _model.PROM_DATASOURCE_KIND,
|
|
173
179
|
value: selectedDatasource,
|
|
174
180
|
onChange: handleDatasourceChange,
|
|
@@ -178,7 +184,7 @@ function PrometheusPromQLVariableEditor(props) {
|
|
|
178
184
|
})
|
|
179
185
|
]
|
|
180
186
|
}),
|
|
181
|
-
/*#__PURE__*/ (0,
|
|
187
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.PromQLEditor, {
|
|
182
188
|
completeConfig: {
|
|
183
189
|
remote: {
|
|
184
190
|
url: promURL
|
|
@@ -194,36 +200,36 @@ function PrometheusPromQLVariableEditor(props) {
|
|
|
194
200
|
readOnly: props.isReadonly,
|
|
195
201
|
width: "100%"
|
|
196
202
|
}),
|
|
197
|
-
/*#__PURE__*/ (0,
|
|
203
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
198
204
|
label: "Label Name",
|
|
199
|
-
value: props.value.
|
|
205
|
+
value: props.value.labelName,
|
|
200
206
|
InputProps: {
|
|
201
207
|
readOnly: props.isReadonly
|
|
202
208
|
},
|
|
203
209
|
onChange: (e)=>{
|
|
204
210
|
props.onChange({
|
|
205
211
|
...props.value,
|
|
206
|
-
|
|
212
|
+
labelName: e.target.value
|
|
207
213
|
});
|
|
208
214
|
}
|
|
209
215
|
})
|
|
210
216
|
]
|
|
211
217
|
});
|
|
212
218
|
}
|
|
213
|
-
function capturingMatrix(matrix,
|
|
219
|
+
function capturingMatrix(matrix, labelName) {
|
|
214
220
|
const captured = new Set();
|
|
215
221
|
for (const sample of matrix.result){
|
|
216
|
-
const value = sample.metric[
|
|
222
|
+
const value = sample.metric[labelName];
|
|
217
223
|
if (value !== undefined) {
|
|
218
224
|
captured.add(value);
|
|
219
225
|
}
|
|
220
226
|
}
|
|
221
227
|
return Array.from(captured.values());
|
|
222
228
|
}
|
|
223
|
-
function capturingVector(vector,
|
|
229
|
+
function capturingVector(vector, labelName) {
|
|
224
230
|
const captured = new Set();
|
|
225
231
|
for (const sample of vector.result){
|
|
226
|
-
const value = sample.metric[
|
|
232
|
+
const value = sample.metric[labelName];
|
|
227
233
|
if (value !== undefined) {
|
|
228
234
|
captured.add(value);
|
|
229
235
|
}
|
|
@@ -241,11 +247,11 @@ function capturingVector(vector, label_name) {
|
|
|
241
247
|
};
|
|
242
248
|
const PrometheusLabelNamesVariable = {
|
|
243
249
|
getVariableOptions: async (spec, ctx)=>{
|
|
244
|
-
var
|
|
245
|
-
const client = await ctx.datasourceStore.getDatasourceClient((
|
|
246
|
-
const match = spec.matchers ? spec.matchers.map((m)=>(0,
|
|
250
|
+
var _spec_datasource;
|
|
251
|
+
const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : _model.DEFAULT_PROM);
|
|
252
|
+
const match = spec.matchers ? spec.matchers.map((m)=>(0, _pluginsystem.replaceTemplateVariables)(m, ctx.variables)) : undefined;
|
|
247
253
|
const timeRange = (0, _model.getPrometheusTimeRange)(ctx.timeRange);
|
|
248
|
-
const { data: options
|
|
254
|
+
const { data: options } = await client.labelNames({
|
|
249
255
|
'match[]': match,
|
|
250
256
|
...timeRange
|
|
251
257
|
});
|
|
@@ -254,9 +260,9 @@ const PrometheusLabelNamesVariable = {
|
|
|
254
260
|
};
|
|
255
261
|
},
|
|
256
262
|
dependsOn: (spec)=>{
|
|
257
|
-
var
|
|
263
|
+
var _spec_matchers;
|
|
258
264
|
return {
|
|
259
|
-
variables: ((
|
|
265
|
+
variables: ((_spec_matchers = spec.matchers) === null || _spec_matchers === void 0 ? void 0 : _spec_matchers.map((m)=>(0, _pluginsystem.parseTemplateVariables)(m)).flat()) || []
|
|
260
266
|
};
|
|
261
267
|
},
|
|
262
268
|
OptionsEditorComponent: PrometheusLabelNamesVariableEditor,
|
|
@@ -265,12 +271,12 @@ const PrometheusLabelNamesVariable = {
|
|
|
265
271
|
const PrometheusLabelValuesVariable = {
|
|
266
272
|
getVariableOptions: async (spec, ctx)=>{
|
|
267
273
|
const pluginDef = spec;
|
|
268
|
-
var
|
|
269
|
-
const client = await ctx.datasourceStore.getDatasourceClient((
|
|
270
|
-
const match = pluginDef.matchers ? pluginDef.matchers.map((m)=>(0,
|
|
274
|
+
var _spec_datasource;
|
|
275
|
+
const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : _model.DEFAULT_PROM);
|
|
276
|
+
const match = pluginDef.matchers ? pluginDef.matchers.map((m)=>(0, _pluginsystem.replaceTemplateVariables)(m, ctx.variables)) : undefined;
|
|
271
277
|
const timeRange = (0, _model.getPrometheusTimeRange)(ctx.timeRange);
|
|
272
|
-
const { data: options
|
|
273
|
-
labelName: (0,
|
|
278
|
+
const { data: options } = await client.labelValues({
|
|
279
|
+
labelName: (0, _pluginsystem.replaceTemplateVariables)(pluginDef.labelName, ctx.variables),
|
|
274
280
|
'match[]': match,
|
|
275
281
|
...timeRange
|
|
276
282
|
});
|
|
@@ -279,25 +285,25 @@ const PrometheusLabelValuesVariable = {
|
|
|
279
285
|
};
|
|
280
286
|
},
|
|
281
287
|
dependsOn: (spec)=>{
|
|
282
|
-
var
|
|
288
|
+
var _spec_matchers;
|
|
283
289
|
return {
|
|
284
|
-
variables: ((
|
|
290
|
+
variables: ((_spec_matchers = spec.matchers) === null || _spec_matchers === void 0 ? void 0 : _spec_matchers.map((m)=>(0, _pluginsystem.parseTemplateVariables)(m)).flat().concat((0, _pluginsystem.parseTemplateVariables)(spec.labelName))) || []
|
|
285
291
|
};
|
|
286
292
|
},
|
|
287
293
|
OptionsEditorComponent: PrometheusLabelValuesVariableEditor,
|
|
288
294
|
createInitialOptions: ()=>({
|
|
289
|
-
|
|
295
|
+
labelName: ''
|
|
290
296
|
})
|
|
291
297
|
};
|
|
292
298
|
const PrometheusPromQLVariable = {
|
|
293
299
|
getVariableOptions: async (spec, ctx)=>{
|
|
294
|
-
var
|
|
295
|
-
const client = await ctx.datasourceStore.getDatasourceClient((
|
|
300
|
+
var _spec_datasource;
|
|
301
|
+
const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : _model.DEFAULT_PROM);
|
|
296
302
|
// TODO we may want to manage a range query as well.
|
|
297
|
-
const { data: options
|
|
298
|
-
query: (0,
|
|
303
|
+
const { data: options } = await client.instantQuery({
|
|
304
|
+
query: (0, _pluginsystem.replaceTemplateVariables)(spec.expr, ctx.variables)
|
|
299
305
|
});
|
|
300
|
-
const labelName = (0,
|
|
306
|
+
const labelName = (0, _pluginsystem.replaceTemplateVariables)(spec.labelName, ctx.variables);
|
|
301
307
|
let values = [];
|
|
302
308
|
if ((options === null || options === void 0 ? void 0 : options.resultType) === 'matrix') {
|
|
303
309
|
values = capturingMatrix(options, labelName);
|
|
@@ -310,12 +316,12 @@ const PrometheusPromQLVariable = {
|
|
|
310
316
|
},
|
|
311
317
|
dependsOn: (spec)=>{
|
|
312
318
|
return {
|
|
313
|
-
variables: (0,
|
|
319
|
+
variables: (0, _pluginsystem.parseTemplateVariables)(spec.expr).concat((0, _pluginsystem.parseTemplateVariables)(spec.labelName))
|
|
314
320
|
};
|
|
315
321
|
},
|
|
316
322
|
OptionsEditorComponent: PrometheusPromQLVariableEditor,
|
|
317
323
|
createInitialOptions: ()=>({
|
|
318
324
|
expr: '',
|
|
319
|
-
|
|
325
|
+
labelName: ''
|
|
320
326
|
})
|
|
321
327
|
};
|
|
@@ -14,3 +14,10 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(exports, "DEFAULT_SCRAPE_INTERVAL", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return DEFAULT_SCRAPE_INTERVAL;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const DEFAULT_SCRAPE_INTERVAL = '1m';
|
|
@@ -16,9 +16,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "StaticListVariable", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return StaticListVariable;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
function StaticListVariableOptionEditor(props) {
|
|
24
26
|
const value = props.value.values.map((v)=>{
|
|
@@ -38,8 +40,8 @@ function StaticListVariableOptionEditor(props) {
|
|
|
38
40
|
})
|
|
39
41
|
});
|
|
40
42
|
};
|
|
41
|
-
return /*#__PURE__*/ (0,
|
|
42
|
-
children: /*#__PURE__*/ (0,
|
|
43
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
44
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
|
|
43
45
|
onPaste: (e)=>{
|
|
44
46
|
// Append new values on paste
|
|
45
47
|
const v = e.clipboardData.getData('text/plain');
|
|
@@ -56,7 +58,7 @@ function StaticListVariableOptionEditor(props) {
|
|
|
56
58
|
freeSolo: true,
|
|
57
59
|
clearOnBlur: true,
|
|
58
60
|
readOnly: props.isReadonly,
|
|
59
|
-
renderInput: (params)=>/*#__PURE__*/ (0,
|
|
61
|
+
renderInput: (params)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
60
62
|
...params,
|
|
61
63
|
label: "Values",
|
|
62
64
|
placeholder: "Values",
|
|
@@ -67,8 +69,8 @@ function StaticListVariableOptionEditor(props) {
|
|
|
67
69
|
}
|
|
68
70
|
const StaticListVariable = {
|
|
69
71
|
getVariableOptions: async (spec)=>{
|
|
70
|
-
var
|
|
71
|
-
const values = (
|
|
72
|
+
var _spec_values;
|
|
73
|
+
const values = (_spec_values = spec.values) === null || _spec_values === void 0 ? void 0 : _spec_values.map((v)=>{
|
|
72
74
|
if (typeof v === 'string') {
|
|
73
75
|
return {
|
|
74
76
|
label: v,
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./utils"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
package/dist/cjs/utils/utils.js
CHANGED
|
@@ -21,16 +21,22 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
formatSeriesName: ()
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
formatSeriesName: function() {
|
|
25
|
+
return formatSeriesName;
|
|
26
|
+
},
|
|
27
|
+
getFormattedPrometheusSeriesName: function() {
|
|
28
|
+
return getFormattedPrometheusSeriesName;
|
|
29
|
+
},
|
|
30
|
+
getUniqueKeyForPrometheusResult: function() {
|
|
31
|
+
return getUniqueKeyForPrometheusResult;
|
|
32
|
+
}
|
|
27
33
|
});
|
|
28
34
|
const _core = require("@perses-dev/core");
|
|
29
35
|
function formatSeriesName(inputFormat, seriesLabels) {
|
|
30
36
|
const resolveLabelsRegex = /\{\{\s*(.+?)\s*\}\}/g;
|
|
31
37
|
return inputFormat.replace(resolveLabelsRegex, (_match, token)=>{
|
|
32
|
-
var
|
|
33
|
-
const resolvedValue = (
|
|
38
|
+
var _seriesLabels_token;
|
|
39
|
+
const resolvedValue = (_seriesLabels_token = seriesLabels[token]) !== null && _seriesLabels_token !== void 0 ? _seriesLabels_token : '';
|
|
34
40
|
return resolvedValue;
|
|
35
41
|
});
|
|
36
42
|
}
|
|
@@ -50,7 +56,7 @@ function formatSeriesName(inputFormat, seriesLabels) {
|
|
|
50
56
|
});
|
|
51
57
|
return `{${labelStrings.join(',')}}`;
|
|
52
58
|
}
|
|
53
|
-
function getUniqueKeyForPrometheusResult(metricLabels, { removeExprWrap
|
|
59
|
+
function getUniqueKeyForPrometheusResult(metricLabels, { removeExprWrap } = {}) {
|
|
54
60
|
const metricNameKey = '__name__';
|
|
55
61
|
if (metricLabels) {
|
|
56
62
|
if (Object.prototype.hasOwnProperty.call(metricLabels, metricNameKey)) {
|
|
@@ -75,7 +81,7 @@ function getFormattedPrometheusSeriesName(query, metric, formatter) {
|
|
|
75
81
|
if (name === '' || (0, _core.isEmptyObject)(metric)) {
|
|
76
82
|
name = query;
|
|
77
83
|
}
|
|
78
|
-
// Query editor allows you to define an optional
|
|
84
|
+
// Query editor allows you to define an optional seriesNameFormat property.
|
|
79
85
|
// This controls the regex used to customize legend and tooltip display.
|
|
80
86
|
const formattedName = formatter ? formatSeriesName(formatter, metric) : name;
|
|
81
87
|
return {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
3
2
|
import { CompleteConfiguration } from '@prometheus-io/codemirror-promql';
|
|
4
|
-
export
|
|
3
|
+
export type PromQLEditorProps = {
|
|
5
4
|
completeConfig: CompleteConfiguration;
|
|
6
5
|
} & Omit<ReactCodeMirrorProps, 'theme' | 'extensions'>;
|
|
7
|
-
export declare function PromQLEditor({ completeConfig, ...rest }: PromQLEditorProps): JSX.Element;
|
|
6
|
+
export declare function PromQLEditor({ completeConfig, ...rest }: PromQLEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
//# sourceMappingURL=PromQL.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromQL.d.ts","sourceRoot":"","sources":["../../src/components/PromQL.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PromQL.d.ts","sourceRoot":"","sources":["../../src/components/PromQL.tsx"],"names":[],"mappings":"AAaA,OAAmB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAmB,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAK1F,MAAM,MAAM,iBAAiB,GAAG;IAAE,cAAc,EAAE,qBAAqB,CAAA;CAAE,GAAG,IAAI,CAC9E,oBAAoB,EACpB,OAAO,GAAG,YAAY,CACvB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,2CAqB1E"}
|
|
@@ -16,7 +16,7 @@ import { PromQLExtension } from '@prometheus-io/codemirror-promql';
|
|
|
16
16
|
import { EditorView } from '@codemirror/view';
|
|
17
17
|
import { useTheme } from '@mui/material';
|
|
18
18
|
import { useMemo } from 'react';
|
|
19
|
-
export function PromQLEditor({ completeConfig
|
|
19
|
+
export function PromQLEditor({ completeConfig, ...rest }) {
|
|
20
20
|
const theme = useTheme();
|
|
21
21
|
const isDarkMode = theme.palette.mode === 'dark';
|
|
22
22
|
const promQLExtension = useMemo(()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/PromQL.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport CodeMirror, { ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { PromQLExtension, CompleteConfiguration } from '@prometheus-io/codemirror-promql';\nimport { EditorView } from '@codemirror/view';\nimport { useTheme } from '@mui/material';\nimport { useMemo } from 'react';\n\nexport type PromQLEditorProps = { completeConfig: CompleteConfiguration } & Omit<\n ReactCodeMirrorProps,\n 'theme' | 'extensions'\n>;\n\nexport function PromQLEditor({ completeConfig, ...rest }: PromQLEditorProps) {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const promQLExtension = useMemo(() => {\n return new PromQLExtension().activateLinter(false).setComplete(completeConfig).asExtension();\n }, [completeConfig]);\n\n return (\n <CodeMirror\n {...rest}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n }}\n extensions={[EditorView.lineWrapping, promQLExtension]}\n />\n );\n}\n"],"names":["CodeMirror","PromQLExtension","EditorView","useTheme","useMemo","PromQLEditor","completeConfig","rest","theme","isDarkMode","palette","mode","promQLExtension","activateLinter","setComplete","asExtension","style","border","divider","basicSetup","highlightActiveLine","highlightActiveLineGutter","foldGutter","extensions","lineWrapping"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../src/components/PromQL.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport CodeMirror, { ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { PromQLExtension, CompleteConfiguration } from '@prometheus-io/codemirror-promql';\nimport { EditorView } from '@codemirror/view';\nimport { useTheme } from '@mui/material';\nimport { useMemo } from 'react';\n\nexport type PromQLEditorProps = { completeConfig: CompleteConfiguration } & Omit<\n ReactCodeMirrorProps,\n 'theme' | 'extensions'\n>;\n\nexport function PromQLEditor({ completeConfig, ...rest }: PromQLEditorProps) {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const promQLExtension = useMemo(() => {\n return new PromQLExtension().activateLinter(false).setComplete(completeConfig).asExtension();\n }, [completeConfig]);\n\n return (\n <CodeMirror\n {...rest}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n }}\n extensions={[EditorView.lineWrapping, promQLExtension]}\n />\n );\n}\n"],"names":["CodeMirror","PromQLExtension","EditorView","useTheme","useMemo","PromQLEditor","completeConfig","rest","theme","isDarkMode","palette","mode","promQLExtension","activateLinter","setComplete","asExtension","style","border","divider","basicSetup","highlightActiveLine","highlightActiveLineGutter","foldGutter","extensions","lineWrapping"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,gBAA0C,wBAAwB;AACzE,SAASC,eAAe,QAA+B,mCAAmC;AAC1F,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,OAAO,QAAQ,QAAQ;AAOhC,OAAO,SAASC,aAAa,EAAEC,cAAc,EAAE,GAAGC,MAAyB;IACzE,MAAMC,QAAQL;IACd,MAAMM,aAAaD,MAAME,OAAO,CAACC,IAAI,KAAK;IAE1C,MAAMC,kBAAkBR,QAAQ;QAC9B,OAAO,IAAIH,kBAAkBY,cAAc,CAAC,OAAOC,WAAW,CAACR,gBAAgBS,WAAW;IAC5F,GAAG;QAACT;KAAe;IAEnB,qBACE,KAACN;QACE,GAAGO,IAAI;QACRS,OAAO;YAAEC,QAAQ,CAAC,UAAU,EAAET,MAAME,OAAO,CAACQ,OAAO,CAAC,CAAC;QAAC;QACtDV,OAAOC,aAAa,SAAS;QAC7BU,YAAY;YACVC,qBAAqB;YACrBC,2BAA2B;YAC3BC,YAAY;QACd;QACAC,YAAY;YAACrB,WAAWsB,YAAY;YAAEZ;SAAgB;;AAG5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PromQL';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PromQL';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,WAAW"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PrometheusTimeSeriesQuery } from './plugins/prometheus-time-series-query';\n// @TODO: Move this to a more generic location;\nimport { StaticListVariable } from './plugins/variable';\nimport {\n PrometheusLabelNamesVariable,\n PrometheusLabelValuesVariable,\n PrometheusPromQLVariable,\n} from './plugins/prometheus-variables';\nimport { PrometheusDatasource } from './plugins/prometheus-datasource';\n\n// Export plugins under the same name as the kinds they handle from the plugin.json\nexport {\n PrometheusTimeSeriesQuery,\n StaticListVariable,\n PrometheusLabelNamesVariable,\n PrometheusLabelValuesVariable,\n PrometheusPromQLVariable,\n PrometheusDatasource,\n};\n\n// For consumers to leverage in DatasourceStoreProvider onCreate\nexport * from './model/prometheus-client';\nexport * from './model/api-types';\n\nexport * from './plugins/types';\n"],"names":["PrometheusTimeSeriesQuery","StaticListVariable","PrometheusLabelNamesVariable","PrometheusLabelValuesVariable","PrometheusPromQLVariable","PrometheusDatasource"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,yBAAyB,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PrometheusTimeSeriesQuery } from './plugins/prometheus-time-series-query';\n// @TODO: Move this to a more generic location;\nimport { StaticListVariable } from './plugins/variable';\nimport {\n PrometheusLabelNamesVariable,\n PrometheusLabelValuesVariable,\n PrometheusPromQLVariable,\n} from './plugins/prometheus-variables';\nimport { PrometheusDatasource } from './plugins/prometheus-datasource';\n\n// Export plugins under the same name as the kinds they handle from the plugin.json\nexport {\n PrometheusTimeSeriesQuery,\n StaticListVariable,\n PrometheusLabelNamesVariable,\n PrometheusLabelValuesVariable,\n PrometheusPromQLVariable,\n PrometheusDatasource,\n};\n\n// For consumers to leverage in DatasourceStoreProvider onCreate\nexport * from './model/prometheus-client';\nexport * from './model/api-types';\n\nexport * from './plugins/types';\n"],"names":["PrometheusTimeSeriesQuery","StaticListVariable","PrometheusLabelNamesVariable","PrometheusLabelValuesVariable","PrometheusPromQLVariable","PrometheusDatasource"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,yBAAyB,QAAQ,yCAAyC;AACnF,+CAA+C;AAC/C,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,SACEC,4BAA4B,EAC5BC,6BAA6B,EAC7BC,wBAAwB,QACnB,iCAAiC;AACxC,SAASC,oBAAoB,QAAQ,kCAAkC;AAEvE,mFAAmF;AACnF,SACEL,yBAAyB,EACzBC,kBAAkB,EAClBC,4BAA4B,EAC5BC,6BAA6B,EAC7BC,wBAAwB,EACxBC,oBAAoB,GACpB;AAEF,gEAAgE;AAChE,cAAc,4BAA4B;AAC1C,cAAc,oBAAoB;AAElC,cAAc,kBAAkB"}
|
|
@@ -12,11 +12,11 @@ export interface ErrorResponse<T> {
|
|
|
12
12
|
errorType: string;
|
|
13
13
|
error: string;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
15
|
+
export type ApiResponse<T> = SuccessResponse<T> | ErrorResponse<T>;
|
|
16
|
+
export type DurationSeconds = number;
|
|
17
|
+
export type UnixTimestampSeconds = number;
|
|
18
|
+
export type ValueTuple = [unixTimeSeconds: UnixTimestampSeconds, sampleValue: string];
|
|
19
|
+
export type Metric = Record<string, string>;
|
|
20
20
|
export interface VectorData {
|
|
21
21
|
resultType: 'vector';
|
|
22
22
|
result: Array<{
|
|
@@ -40,7 +40,7 @@ export interface InstantQueryRequestParameters {
|
|
|
40
40
|
time?: UnixTimestampSeconds;
|
|
41
41
|
timeout?: DurationString;
|
|
42
42
|
}
|
|
43
|
-
export
|
|
43
|
+
export type InstantQueryResponse = ApiResponse<MatrixData | VectorData | ScalarData>;
|
|
44
44
|
export interface RangeQueryRequestParameters {
|
|
45
45
|
query: string;
|
|
46
46
|
start: UnixTimestampSeconds;
|
|
@@ -48,26 +48,26 @@ export interface RangeQueryRequestParameters {
|
|
|
48
48
|
step: DurationSeconds;
|
|
49
49
|
timeout?: DurationString;
|
|
50
50
|
}
|
|
51
|
-
export
|
|
51
|
+
export type RangeQueryResponse = ApiResponse<MatrixData>;
|
|
52
52
|
export interface SeriesRequestParameters {
|
|
53
53
|
'match[]': string[];
|
|
54
54
|
start: UnixTimestampSeconds;
|
|
55
55
|
end: UnixTimestampSeconds;
|
|
56
56
|
}
|
|
57
|
-
export
|
|
57
|
+
export type SeriesResponse = ApiResponse<Metric[]>;
|
|
58
58
|
export interface LabelNamesRequestParameters {
|
|
59
59
|
start?: UnixTimestampSeconds;
|
|
60
60
|
end?: UnixTimestampSeconds;
|
|
61
61
|
'match[]'?: string[];
|
|
62
62
|
}
|
|
63
|
-
export
|
|
63
|
+
export type LabelNamesResponse = ApiResponse<string[]>;
|
|
64
64
|
export interface LabelValuesRequestParameters {
|
|
65
65
|
labelName: string;
|
|
66
66
|
start?: UnixTimestampSeconds;
|
|
67
67
|
end?: UnixTimestampSeconds;
|
|
68
68
|
'match[]'?: string[];
|
|
69
69
|
}
|
|
70
|
-
export
|
|
70
|
+
export type LabelValuesResponse = ApiResponse<string[]>;
|
|
71
71
|
export interface MetricMetadata {
|
|
72
72
|
type: string;
|
|
73
73
|
help: string;
|
|
@@ -77,5 +77,5 @@ export interface MetricMetadataRequestParameters {
|
|
|
77
77
|
limit?: number;
|
|
78
78
|
metric?: string;
|
|
79
79
|
}
|
|
80
|
-
export
|
|
80
|
+
export type MetricMetadataResponse = ApiResponse<Record<string, MetricMetadata[]>>;
|
|
81
81
|
//# sourceMappingURL=api-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../src/model/api-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,
|
|
1
|
+
{"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../src/model/api-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/api-types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DurationString } from '@perses-dev/core';\n\n// Just reuse dashboard model's type and re-export\nexport type { DurationString };\n\nexport interface SuccessResponse<T> {\n status: 'success';\n data: T;\n rawResponse?: Response;\n warnings?: string[];\n}\n\nexport interface ErrorResponse<T> {\n status: 'error';\n data?: T;\n errorType: string;\n error: string;\n}\n\nexport type ApiResponse<T> = SuccessResponse<T> | ErrorResponse<T>;\n\nexport type DurationSeconds = number;\n\nexport type UnixTimestampSeconds = number;\n\nexport type ValueTuple = [unixTimeSeconds: UnixTimestampSeconds, sampleValue: string];\n\nexport type Metric = Record<string, string>;\n\nexport interface VectorData {\n resultType: 'vector';\n result: Array<{\n metric: Metric;\n value: ValueTuple;\n }>;\n}\n\nexport interface MatrixData {\n resultType: 'matrix';\n result: Array<{\n metric: Metric;\n values: ValueTuple[];\n }>;\n}\n\nexport interface ScalarData {\n resultType: 'scalar';\n result: ValueTuple;\n}\n\nexport interface InstantQueryRequestParameters {\n query: string;\n time?: UnixTimestampSeconds;\n timeout?: DurationString;\n}\n\nexport type InstantQueryResponse = ApiResponse<MatrixData | VectorData | ScalarData>;\n\nexport interface RangeQueryRequestParameters {\n query: string;\n start: UnixTimestampSeconds;\n end: UnixTimestampSeconds;\n step: DurationSeconds;\n timeout?: DurationString;\n}\n\nexport type RangeQueryResponse = ApiResponse<MatrixData>;\n\nexport interface SeriesRequestParameters {\n 'match[]': string[];\n start: UnixTimestampSeconds;\n end: UnixTimestampSeconds;\n}\n\nexport type SeriesResponse = ApiResponse<Metric[]>;\n\nexport interface LabelNamesRequestParameters {\n start?: UnixTimestampSeconds;\n end?: UnixTimestampSeconds;\n 'match[]'?: string[];\n}\n\nexport type LabelNamesResponse = ApiResponse<string[]>;\n\nexport interface LabelValuesRequestParameters {\n labelName: string;\n start?: UnixTimestampSeconds;\n end?: UnixTimestampSeconds;\n 'match[]'?: string[];\n}\n\nexport type LabelValuesResponse = ApiResponse<string[]>;\n\nexport interface MetricMetadata {\n type: string;\n help: string;\n unit?: string;\n}\n\nexport interface MetricMetadataRequestParameters {\n limit?: number;\n metric?: string;\n}\n\nexport type MetricMetadataResponse = ApiResponse<Record<string, MetricMetadata[]>>;\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;
|
|
1
|
+
{"version":3,"sources":["../../src/model/api-types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DurationString } from '@perses-dev/core';\n\n// Just reuse dashboard model's type and re-export\nexport type { DurationString };\n\nexport interface SuccessResponse<T> {\n status: 'success';\n data: T;\n rawResponse?: Response;\n warnings?: string[];\n}\n\nexport interface ErrorResponse<T> {\n status: 'error';\n data?: T;\n errorType: string;\n error: string;\n}\n\nexport type ApiResponse<T> = SuccessResponse<T> | ErrorResponse<T>;\n\nexport type DurationSeconds = number;\n\nexport type UnixTimestampSeconds = number;\n\nexport type ValueTuple = [unixTimeSeconds: UnixTimestampSeconds, sampleValue: string];\n\nexport type Metric = Record<string, string>;\n\nexport interface VectorData {\n resultType: 'vector';\n result: Array<{\n metric: Metric;\n value: ValueTuple;\n }>;\n}\n\nexport interface MatrixData {\n resultType: 'matrix';\n result: Array<{\n metric: Metric;\n values: ValueTuple[];\n }>;\n}\n\nexport interface ScalarData {\n resultType: 'scalar';\n result: ValueTuple;\n}\n\nexport interface InstantQueryRequestParameters {\n query: string;\n time?: UnixTimestampSeconds;\n timeout?: DurationString;\n}\n\nexport type InstantQueryResponse = ApiResponse<MatrixData | VectorData | ScalarData>;\n\nexport interface RangeQueryRequestParameters {\n query: string;\n start: UnixTimestampSeconds;\n end: UnixTimestampSeconds;\n step: DurationSeconds;\n timeout?: DurationString;\n}\n\nexport type RangeQueryResponse = ApiResponse<MatrixData>;\n\nexport interface SeriesRequestParameters {\n 'match[]': string[];\n start: UnixTimestampSeconds;\n end: UnixTimestampSeconds;\n}\n\nexport type SeriesResponse = ApiResponse<Metric[]>;\n\nexport interface LabelNamesRequestParameters {\n start?: UnixTimestampSeconds;\n end?: UnixTimestampSeconds;\n 'match[]'?: string[];\n}\n\nexport type LabelNamesResponse = ApiResponse<string[]>;\n\nexport interface LabelValuesRequestParameters {\n labelName: string;\n start?: UnixTimestampSeconds;\n end?: UnixTimestampSeconds;\n 'match[]'?: string[];\n}\n\nexport type LabelValuesResponse = ApiResponse<string[]>;\n\nexport interface MetricMetadata {\n type: string;\n help: string;\n unit?: string;\n}\n\nexport interface MetricMetadataRequestParameters {\n limit?: number;\n metric?: string;\n}\n\nexport type MetricMetadataResponse = ApiResponse<Record<string, MetricMetadata[]>>;\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA0GjC,WAAmF"}
|
package/dist/model/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC"}
|