@perses-dev/prometheus-plugin 0.39.0 → 0.40.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/dist/cjs/components/PromQL.js +9 -7
- package/dist/cjs/components/index.js +10 -8
- package/dist/cjs/index.js +33 -19
- package/dist/cjs/model/index.js +15 -13
- package/dist/cjs/model/parse-sample-values.js +6 -2
- package/dist/cjs/model/prometheus-client.js +24 -5
- package/dist/cjs/model/prometheus-selectors.js +13 -5
- package/dist/cjs/model/templating.js +7 -5
- package/dist/cjs/model/time.js +14 -8
- package/dist/cjs/plugins/MatcherEditor.js +13 -11
- package/dist/cjs/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +127 -63
- package/dist/cjs/plugins/PrometheusDatasourceEditor/index.js +11 -9
- package/dist/cjs/plugins/PrometheusDatasourceEditor/types.js +7 -0
- package/dist/cjs/plugins/prometheus-datasource.js +53 -7
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +44 -20
- package/dist/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +39 -21
- package/dist/cjs/plugins/prometheus-time-series-query/index.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/query-editor-model.js +42 -9
- package/dist/cjs/plugins/prometheus-variables.js +60 -54
- package/dist/cjs/plugins/variable.js +9 -7
- package/dist/cjs/utils/index.js +10 -8
- package/dist/cjs/utils/utils.js +12 -6
- 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/index.js.map +1 -1
- package/dist/model/parse-sample-values.js.map +1 -1
- package/dist/model/prometheus-client.d.ts.map +1 -1
- package/dist/model/prometheus-client.js +9 -0
- package/dist/model/prometheus-client.js.map +1 -1
- package/dist/model/prometheus-selectors.js +1 -1
- package/dist/model/prometheus-selectors.js.map +1 -1
- package/dist/model/templating.js.map +1 -1
- package/dist/model/time.js +1 -1
- package/dist/model/time.js.map +1 -1
- package/dist/plugins/MatcherEditor.js.map +1 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts.map +1 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +95 -33
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js.map +1 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.js.map +1 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts +6 -4
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts.map +1 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.js +1 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.js.map +1 -1
- package/dist/plugins/prometheus-datasource.d.ts +3 -2
- package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
- package/dist/plugins/prometheus-datasource.js +48 -4
- 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.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +32 -10
- 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 +32 -16
- 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 +10 -1
- 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 +36 -8
- 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 +2 -2
- 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.map +1 -1
- package/dist/plugins/prometheus-variables.js +27 -27
- package/dist/plugins/prometheus-variables.js.map +1 -1
- package/dist/plugins/types.d.ts +2 -2
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js.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 +1 -1
- package/dist/utils/utils.js +3 -3
- package/dist/utils/utils.js.map +1 -1
- package/package.json +6 -6
|
@@ -16,15 +16,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PrometheusDatasourceEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PrometheusDatasourceEditor;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
23
25
|
const _material = require("@mui/material");
|
|
24
|
-
const _react = /*#__PURE__*/
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
27
|
+
const _Minus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Minus"));
|
|
28
|
+
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
29
|
+
const _types = require("./types");
|
|
30
|
+
function _interop_require_default(obj) {
|
|
28
31
|
return obj && obj.__esModule ? obj : {
|
|
29
32
|
default: obj
|
|
30
33
|
};
|
|
@@ -37,7 +40,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
37
40
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
38
41
|
})(nodeInterop);
|
|
39
42
|
}
|
|
40
|
-
function
|
|
43
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
41
44
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
42
45
|
return obj;
|
|
43
46
|
}
|
|
@@ -69,7 +72,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
69
72
|
return newObj;
|
|
70
73
|
}
|
|
71
74
|
function PrometheusDatasourceEditor(props) {
|
|
72
|
-
var
|
|
75
|
+
var _value_proxy, _value_proxy1, _value_proxy2, _value_proxy3;
|
|
73
76
|
const { value , onChange , isReadonly } = props;
|
|
74
77
|
const strDirect = 'Direct access';
|
|
75
78
|
const strProxy = 'Proxy';
|
|
@@ -95,32 +98,38 @@ function PrometheusDatasourceEditor(props) {
|
|
|
95
98
|
const tabs = [
|
|
96
99
|
{
|
|
97
100
|
label: strDirect,
|
|
98
|
-
content: /*#__PURE__*/ (0,
|
|
99
|
-
children: /*#__PURE__*/ (0,
|
|
101
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
102
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
100
103
|
fullWidth: true,
|
|
101
104
|
label: "URL",
|
|
102
|
-
value: value.
|
|
105
|
+
value: value.directUrl || '',
|
|
103
106
|
InputProps: {
|
|
104
107
|
readOnly: isReadonly
|
|
105
108
|
},
|
|
109
|
+
InputLabelProps: {
|
|
110
|
+
shrink: isReadonly ? true : undefined
|
|
111
|
+
},
|
|
106
112
|
onChange: (e)=>onChange({
|
|
107
113
|
...value,
|
|
108
|
-
|
|
114
|
+
directUrl: e.target.value
|
|
109
115
|
})
|
|
110
116
|
})
|
|
111
117
|
})
|
|
112
118
|
},
|
|
113
119
|
{
|
|
114
120
|
label: strProxy,
|
|
115
|
-
content: /*#__PURE__*/ (0,
|
|
121
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
116
122
|
children: [
|
|
117
|
-
/*#__PURE__*/ (0,
|
|
123
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
118
124
|
fullWidth: true,
|
|
119
125
|
label: "URL",
|
|
120
|
-
value: ((
|
|
126
|
+
value: ((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.url) || '',
|
|
121
127
|
InputProps: {
|
|
122
128
|
readOnly: isReadonly
|
|
123
129
|
},
|
|
130
|
+
InputLabelProps: {
|
|
131
|
+
shrink: isReadonly ? true : undefined
|
|
132
|
+
},
|
|
124
133
|
onChange: (e)=>onChange({
|
|
125
134
|
...value,
|
|
126
135
|
...value.proxy && {
|
|
@@ -134,72 +143,91 @@ function PrometheusDatasourceEditor(props) {
|
|
|
134
143
|
}
|
|
135
144
|
})
|
|
136
145
|
}),
|
|
137
|
-
/*#__PURE__*/ (0,
|
|
138
|
-
py: 2,
|
|
146
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
139
147
|
variant: "h4",
|
|
148
|
+
mt: 2,
|
|
149
|
+
mb: 1,
|
|
140
150
|
children: "Allowed endpoints"
|
|
141
151
|
}),
|
|
142
|
-
/*#__PURE__*/ (0,
|
|
152
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
143
153
|
container: true,
|
|
144
154
|
spacing: 2,
|
|
145
155
|
mb: 2,
|
|
146
|
-
children: ((
|
|
147
|
-
return /*#__PURE__*/ (0,
|
|
156
|
+
children: ((_value_proxy1 = value.proxy) === null || _value_proxy1 === void 0 ? void 0 : _value_proxy1.spec.allowedEndpoints) ? value.proxy.spec.allowedEndpoints.map(({ endpointPattern , method }, i)=>{
|
|
157
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
148
158
|
children: [
|
|
149
|
-
/*#__PURE__*/ (0,
|
|
159
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
150
160
|
item: true,
|
|
151
161
|
xs: 8,
|
|
152
|
-
children: /*#__PURE__*/ (0,
|
|
162
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
153
163
|
disabled: true,
|
|
154
164
|
fullWidth: true,
|
|
155
165
|
label: "Endpoint pattern",
|
|
156
|
-
value:
|
|
166
|
+
value: endpointPattern,
|
|
157
167
|
InputProps: {
|
|
158
168
|
readOnly: isReadonly
|
|
169
|
+
},
|
|
170
|
+
InputLabelProps: {
|
|
171
|
+
shrink: isReadonly ? true : undefined
|
|
159
172
|
}
|
|
160
173
|
})
|
|
161
174
|
}),
|
|
162
|
-
/*#__PURE__*/ (0,
|
|
175
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
163
176
|
item: true,
|
|
164
177
|
xs: 4,
|
|
165
|
-
children: /*#__PURE__*/ (0,
|
|
178
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
166
179
|
disabled: true,
|
|
167
180
|
fullWidth: true,
|
|
168
181
|
label: "URL",
|
|
169
182
|
value: method,
|
|
170
183
|
InputProps: {
|
|
171
184
|
readOnly: isReadonly
|
|
185
|
+
},
|
|
186
|
+
InputLabelProps: {
|
|
187
|
+
shrink: isReadonly ? true : undefined
|
|
172
188
|
}
|
|
173
189
|
})
|
|
174
190
|
})
|
|
175
191
|
]
|
|
176
192
|
}, i);
|
|
193
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
194
|
+
item: true,
|
|
195
|
+
xs: 4,
|
|
196
|
+
children: [
|
|
197
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
198
|
+
children: "None"
|
|
199
|
+
}),
|
|
200
|
+
" "
|
|
201
|
+
]
|
|
177
202
|
})
|
|
178
203
|
}),
|
|
179
|
-
/*#__PURE__*/ (0,
|
|
180
|
-
pb: 2,
|
|
204
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
181
205
|
variant: "h4",
|
|
206
|
+
mb: 1,
|
|
182
207
|
children: "Request Headers"
|
|
183
208
|
}),
|
|
184
|
-
/*#__PURE__*/ (0,
|
|
209
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
185
210
|
container: true,
|
|
186
211
|
spacing: 2,
|
|
187
212
|
mb: 2,
|
|
188
213
|
children: [
|
|
189
|
-
((
|
|
190
|
-
var
|
|
191
|
-
return /*#__PURE__*/ (0,
|
|
214
|
+
((_value_proxy2 = value.proxy) === null || _value_proxy2 === void 0 ? void 0 : _value_proxy2.spec.headers) && Object.keys(value.proxy.spec.headers).map((headerName, i)=>{
|
|
215
|
+
var _value_proxy_spec_headers, _value_proxy;
|
|
216
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
192
217
|
children: [
|
|
193
|
-
/*#__PURE__*/ (0,
|
|
218
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
194
219
|
item: true,
|
|
195
220
|
xs: 4,
|
|
196
|
-
children: /*#__PURE__*/ (0,
|
|
221
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
197
222
|
fullWidth: true,
|
|
198
223
|
label: "Header name",
|
|
199
224
|
value: headerName,
|
|
200
225
|
InputProps: {
|
|
201
226
|
readOnly: isReadonly
|
|
202
227
|
},
|
|
228
|
+
InputLabelProps: {
|
|
229
|
+
shrink: isReadonly ? true : undefined
|
|
230
|
+
},
|
|
203
231
|
onChange: (e)=>onChange({
|
|
204
232
|
...value,
|
|
205
233
|
...value.proxy && {
|
|
@@ -214,16 +242,19 @@ function PrometheusDatasourceEditor(props) {
|
|
|
214
242
|
})
|
|
215
243
|
})
|
|
216
244
|
}),
|
|
217
|
-
/*#__PURE__*/ (0,
|
|
245
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
218
246
|
item: true,
|
|
219
247
|
xs: 7,
|
|
220
|
-
children: /*#__PURE__*/ (0,
|
|
248
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
221
249
|
fullWidth: true,
|
|
222
250
|
label: "Header value",
|
|
223
|
-
value: (
|
|
251
|
+
value: (_value_proxy_spec_headers = (_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.headers) === null || _value_proxy_spec_headers === void 0 ? void 0 : _value_proxy_spec_headers[headerName],
|
|
224
252
|
InputProps: {
|
|
225
253
|
readOnly: isReadonly
|
|
226
254
|
},
|
|
255
|
+
InputLabelProps: {
|
|
256
|
+
shrink: isReadonly ? true : undefined
|
|
257
|
+
},
|
|
227
258
|
onChange: (e)=>onChange({
|
|
228
259
|
...value,
|
|
229
260
|
...value.proxy && {
|
|
@@ -241,15 +272,15 @@ function PrometheusDatasourceEditor(props) {
|
|
|
241
272
|
})
|
|
242
273
|
})
|
|
243
274
|
}),
|
|
244
|
-
/*#__PURE__*/ (0,
|
|
275
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
245
276
|
item: true,
|
|
246
277
|
xs: 1,
|
|
247
|
-
children: /*#__PURE__*/ (0,
|
|
278
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
248
279
|
disabled: isReadonly,
|
|
249
280
|
onClick: ()=>{
|
|
250
|
-
var
|
|
281
|
+
var _value_proxy;
|
|
251
282
|
const newHeaders = {
|
|
252
|
-
...(
|
|
283
|
+
...(_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.headers
|
|
253
284
|
};
|
|
254
285
|
delete newHeaders[headerName];
|
|
255
286
|
onChange({
|
|
@@ -265,19 +296,19 @@ function PrometheusDatasourceEditor(props) {
|
|
|
265
296
|
}
|
|
266
297
|
});
|
|
267
298
|
},
|
|
268
|
-
children: /*#__PURE__*/ (0,
|
|
299
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Minus.default, {})
|
|
269
300
|
})
|
|
270
301
|
})
|
|
271
302
|
]
|
|
272
303
|
}, i);
|
|
273
304
|
}),
|
|
274
|
-
/*#__PURE__*/ (0,
|
|
305
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
275
306
|
item: true,
|
|
276
307
|
xs: 12,
|
|
277
308
|
sx: {
|
|
278
309
|
paddingTop: '5px !important'
|
|
279
310
|
},
|
|
280
|
-
children: /*#__PURE__*/ (0,
|
|
311
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
281
312
|
disabled: isReadonly,
|
|
282
313
|
onClick: ()=>onChange({
|
|
283
314
|
...value,
|
|
@@ -294,18 +325,21 @@ function PrometheusDatasourceEditor(props) {
|
|
|
294
325
|
}
|
|
295
326
|
}
|
|
296
327
|
}),
|
|
297
|
-
children: /*#__PURE__*/ (0,
|
|
328
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {})
|
|
298
329
|
})
|
|
299
330
|
})
|
|
300
331
|
]
|
|
301
332
|
}),
|
|
302
|
-
/*#__PURE__*/ (0,
|
|
333
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
303
334
|
fullWidth: true,
|
|
304
335
|
label: "Secret",
|
|
305
|
-
value: ((
|
|
336
|
+
value: ((_value_proxy3 = value.proxy) === null || _value_proxy3 === void 0 ? void 0 : _value_proxy3.spec.secret) || '',
|
|
306
337
|
InputProps: {
|
|
307
338
|
readOnly: isReadonly
|
|
308
339
|
},
|
|
340
|
+
InputLabelProps: {
|
|
341
|
+
shrink: isReadonly ? true : undefined
|
|
342
|
+
},
|
|
309
343
|
onChange: (e)=>onChange({
|
|
310
344
|
...value,
|
|
311
345
|
...value.proxy && {
|
|
@@ -331,36 +365,36 @@ function PrometheusDatasourceEditor(props) {
|
|
|
331
365
|
// Otherwise (create datasource), set defaultTab to Direct access.
|
|
332
366
|
const defaultTab = value.proxy ? proxyModeId : directModeId;
|
|
333
367
|
const initialSpecDirect = {
|
|
334
|
-
|
|
368
|
+
directUrl: ''
|
|
335
369
|
};
|
|
336
370
|
const initialSpecProxy = {
|
|
337
371
|
proxy: {
|
|
338
372
|
kind: 'HTTPProxy',
|
|
339
373
|
spec: {
|
|
340
|
-
|
|
374
|
+
allowedEndpoints: [
|
|
341
375
|
// hardcoded list of allowed endpoints for now since those are enforced by the backend
|
|
342
376
|
{
|
|
343
|
-
|
|
377
|
+
endpointPattern: '/api/v1/labels',
|
|
344
378
|
method: 'POST'
|
|
345
379
|
},
|
|
346
380
|
{
|
|
347
|
-
|
|
381
|
+
endpointPattern: '/api/v1/series',
|
|
348
382
|
method: 'POST'
|
|
349
383
|
},
|
|
350
384
|
{
|
|
351
|
-
|
|
385
|
+
endpointPattern: '/api/v1/metadata',
|
|
352
386
|
method: 'GET'
|
|
353
387
|
},
|
|
354
388
|
{
|
|
355
|
-
|
|
389
|
+
endpointPattern: '/api/v1/query',
|
|
356
390
|
method: 'POST'
|
|
357
391
|
},
|
|
358
392
|
{
|
|
359
|
-
|
|
393
|
+
endpointPattern: '/api/v1/query_range',
|
|
360
394
|
method: 'POST'
|
|
361
395
|
},
|
|
362
396
|
{
|
|
363
|
-
|
|
397
|
+
endpointPattern: '/api/v1/label/([a-zA-Z0-9_-]+)/values',
|
|
364
398
|
method: 'GET'
|
|
365
399
|
}
|
|
366
400
|
],
|
|
@@ -374,19 +408,49 @@ function PrometheusDatasourceEditor(props) {
|
|
|
374
408
|
const [previousSpecProxy, setPreviousSpecProxy] = (0, _react.useState)(initialSpecProxy);
|
|
375
409
|
// When changing mode, remove previous mode's config + append default values for the new mode.
|
|
376
410
|
const handleModeChange = (v)=>{
|
|
377
|
-
var
|
|
378
|
-
if (((
|
|
411
|
+
var _tabs_v, _tabs_v1;
|
|
412
|
+
if (((_tabs_v = tabs[v]) === null || _tabs_v === void 0 ? void 0 : _tabs_v.label) == strDirect) {
|
|
379
413
|
setPreviousSpecProxy(value);
|
|
380
414
|
onChange(previousSpecDirect);
|
|
381
|
-
} else if (((
|
|
415
|
+
} else if (((_tabs_v1 = tabs[v]) === null || _tabs_v1 === void 0 ? void 0 : _tabs_v1.label) == strProxy) {
|
|
382
416
|
setPreviousSpecDirect(value);
|
|
383
417
|
onChange(previousSpecProxy);
|
|
384
418
|
}
|
|
385
419
|
};
|
|
386
|
-
return /*#__PURE__*/ (0,
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
420
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
421
|
+
children: [
|
|
422
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
423
|
+
variant: "h4",
|
|
424
|
+
mb: 2,
|
|
425
|
+
children: "General Settings"
|
|
426
|
+
}),
|
|
427
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
428
|
+
fullWidth: true,
|
|
429
|
+
label: "Scrape Interval",
|
|
430
|
+
value: value.scrapeInterval || '',
|
|
431
|
+
placeholder: `Default: ${_types.DEFAULT_SCRAPE_INTERVAL}`,
|
|
432
|
+
InputProps: {
|
|
433
|
+
readOnly: isReadonly
|
|
434
|
+
},
|
|
435
|
+
InputLabelProps: {
|
|
436
|
+
shrink: isReadonly ? true : undefined
|
|
437
|
+
},
|
|
438
|
+
onChange: (e)=>onChange({
|
|
439
|
+
...value,
|
|
440
|
+
scrapeInterval: e.target.value
|
|
441
|
+
})
|
|
442
|
+
}),
|
|
443
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
444
|
+
variant: "h4",
|
|
445
|
+
mt: 2,
|
|
446
|
+
children: "HTTP Settings"
|
|
447
|
+
}),
|
|
448
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.OptionsEditorRadios, {
|
|
449
|
+
isReadonly: isReadonly,
|
|
450
|
+
tabs: tabs,
|
|
451
|
+
defaultTab: defaultTab,
|
|
452
|
+
onModeChange: handleModeChange
|
|
453
|
+
})
|
|
454
|
+
]
|
|
391
455
|
});
|
|
392
456
|
}
|
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function
|
|
17
|
+
_export_star(require("./PrometheusDatasourceEditor"), exports);
|
|
18
|
+
_export_star(require("./types"), exports);
|
|
19
|
+
function _export_star(from, to) {
|
|
20
20
|
Object.keys(from).forEach(function(k) {
|
|
21
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
22
|
+
Object.defineProperty(to, k, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function() {
|
|
25
|
+
return from[k];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
});
|
|
28
30
|
return from;
|
|
29
31
|
}
|
|
@@ -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,19 +16,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PrometheusDatasource", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PrometheusDatasource;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const _model = require("../model");
|
|
22
|
-
const
|
|
24
|
+
const _PrometheusDatasourceEditor = require("./PrometheusDatasourceEditor");
|
|
23
25
|
/**
|
|
24
26
|
* Creates a PrometheusClient for a specific datasource spec.
|
|
25
27
|
*/ const createClient = (spec, options)=>{
|
|
26
|
-
const {
|
|
28
|
+
const { directUrl , headers: specHeaders } = spec;
|
|
27
29
|
const { proxyUrl } = options;
|
|
28
30
|
// Use the direct URL if specified, but fallback to the proxyUrl by default if not specified
|
|
29
|
-
const datasourceUrl =
|
|
31
|
+
const datasourceUrl = directUrl !== null && directUrl !== void 0 ? directUrl : proxyUrl;
|
|
30
32
|
if (datasourceUrl === undefined) {
|
|
31
|
-
throw new Error('No URL specified for Prometheus client. You can use
|
|
33
|
+
throw new Error('No URL specified for Prometheus client. You can use directUrl in the spec to configure it.');
|
|
32
34
|
}
|
|
33
35
|
// Could think about this becoming a class, although it definitely doesn't have to be
|
|
34
36
|
return {
|
|
@@ -53,10 +55,54 @@ const _prometheusDatasourceEditor = require("./PrometheusDatasourceEditor");
|
|
|
53
55
|
})
|
|
54
56
|
};
|
|
55
57
|
};
|
|
58
|
+
const getBuiltinVariableDefinitions = ()=>{
|
|
59
|
+
return [
|
|
60
|
+
{
|
|
61
|
+
kind: 'BuiltinVariable',
|
|
62
|
+
spec: {
|
|
63
|
+
name: '__interval',
|
|
64
|
+
value: ()=>'$__interval',
|
|
65
|
+
source: 'Prometheus',
|
|
66
|
+
display: {
|
|
67
|
+
name: '__interval',
|
|
68
|
+
description: 'Interval that can be used to group by time in queries. When there are more data points than can be shown on a graph then queries can be made more efficient by grouping by a larger interval.',
|
|
69
|
+
hidden: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
kind: 'BuiltinVariable',
|
|
75
|
+
spec: {
|
|
76
|
+
name: '__interval_ms',
|
|
77
|
+
value: ()=>'$__interval_ms',
|
|
78
|
+
source: 'Prometheus',
|
|
79
|
+
display: {
|
|
80
|
+
name: '__interval_ms',
|
|
81
|
+
description: 'Interval in millisecond that can be used to group by time in queries. When there are more data points than can be shown on a graph then queries can be made more efficient by grouping by a larger interval.',
|
|
82
|
+
hidden: true
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
kind: 'BuiltinVariable',
|
|
88
|
+
spec: {
|
|
89
|
+
name: '__rate_interval',
|
|
90
|
+
value: ()=>'$__rate_interval',
|
|
91
|
+
source: 'Prometheus',
|
|
92
|
+
display: {
|
|
93
|
+
name: '__rate_interval',
|
|
94
|
+
description: "Interval at least four times the value of the scrape interval. It avoids problems specific to Prometheus when using 'rate' and 'increase' functions.",
|
|
95
|
+
hidden: true
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
};
|
|
56
101
|
const PrometheusDatasource = {
|
|
57
102
|
createClient,
|
|
58
|
-
|
|
103
|
+
getBuiltinVariableDefinitions,
|
|
104
|
+
OptionsEditorComponent: _PrometheusDatasourceEditor.PrometheusDatasourceEditor,
|
|
59
105
|
createInitialOptions: ()=>({
|
|
60
|
-
|
|
106
|
+
directUrl: ''
|
|
61
107
|
})
|
|
62
108
|
};
|
|
@@ -16,22 +16,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PrometheusTimeSeriesQuery", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PrometheusTimeSeriesQuery;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
23
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
24
|
+
const _gettimeseriesdata = require("./get-time-series-data");
|
|
25
|
+
const _PrometheusTimeSeriesQueryEditor = require("./PrometheusTimeSeriesQueryEditor");
|
|
24
26
|
const PrometheusTimeSeriesQuery = {
|
|
25
|
-
getTimeSeriesData:
|
|
26
|
-
OptionsEditorComponent:
|
|
27
|
+
getTimeSeriesData: _gettimeseriesdata.getTimeSeriesData,
|
|
28
|
+
OptionsEditorComponent: _PrometheusTimeSeriesQueryEditor.PrometheusTimeSeriesQueryEditor,
|
|
27
29
|
createInitialOptions: ()=>({
|
|
28
30
|
query: '',
|
|
29
31
|
datasource: undefined
|
|
30
32
|
}),
|
|
31
33
|
dependsOn: (spec)=>{
|
|
32
34
|
// Variables can be used in the query and/or in the legend format string
|
|
33
|
-
const queryVariables = (0,
|
|
34
|
-
const legendVariables = (0,
|
|
35
|
+
const queryVariables = (0, _pluginsystem.parseTemplateVariables)(spec.query);
|
|
36
|
+
const legendVariables = (0, _pluginsystem.parseTemplateVariables)(spec.seriesNameFormat || '');
|
|
35
37
|
const allVariables = [
|
|
36
38
|
...new Set([
|
|
37
39
|
...queryVariables,
|