@perses-dev/tempo-plugin 0.43.0 → 0.44.0-rc0
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/index.js +4 -4
- package/dist/cjs/model/tempo-client.js +5 -5
- package/dist/cjs/model/tempo-selectors.js +3 -3
- package/dist/cjs/plugins/tempo-datasource.js +2 -2
- package/dist/cjs/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.js +62 -0
- package/dist/cjs/plugins/tempo-trace-query/TempoTraceQuery.js +32 -0
- package/dist/cjs/plugins/tempo-trace-query/TempoTraceQueryEditor.js +55 -0
- package/dist/cjs/plugins/tempo-trace-query/TraceQLEditor.js +46 -0
- package/dist/cjs/plugins/tempo-trace-query/get-trace-data.js +101 -0
- package/dist/cjs/plugins/tempo-trace-query/query-editor-model.js +53 -0
- package/dist/cjs/test/mock-data.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/api-types.js +5 -1
- package/dist/model/api-types.js.map +1 -1
- package/dist/model/tempo-client.js +1 -1
- package/dist/model/tempo-client.js.map +1 -1
- package/dist/model/tempo-selectors.js.map +1 -1
- package/dist/model/trace-query-model.js +3 -1
- package/dist/model/trace-query-model.js.map +1 -1
- package/dist/plugins/get-trace-data.js.map +1 -1
- package/dist/plugins/tempo-datasource-types.js.map +1 -1
- package/dist/plugins/tempo-datasource.js +2 -2
- package/dist/plugins/tempo-datasource.js.map +1 -1
- package/dist/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.d.ts +13 -0
- package/dist/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.d.ts.map +1 -0
- package/dist/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.js +54 -0
- package/dist/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.js.map +1 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQuery.d.ts +13 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQuery.d.ts.map +1 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQuery.js +26 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQuery.js.map +1 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQueryEditor.d.ts +3 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQueryEditor.d.ts.map +1 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQueryEditor.js +47 -0
- package/dist/plugins/tempo-trace-query/TempoTraceQueryEditor.js.map +1 -0
- package/dist/plugins/tempo-trace-query/TraceQLEditor.d.ts +4 -0
- package/dist/plugins/tempo-trace-query/TraceQLEditor.d.ts.map +1 -0
- package/dist/plugins/tempo-trace-query/TraceQLEditor.js +33 -0
- package/dist/plugins/tempo-trace-query/TraceQLEditor.js.map +1 -0
- package/dist/plugins/tempo-trace-query/get-trace-data.d.ts +9 -0
- package/dist/plugins/tempo-trace-query/get-trace-data.d.ts.map +1 -0
- package/dist/plugins/tempo-trace-query/get-trace-data.js +85 -0
- package/dist/plugins/tempo-trace-query/get-trace-data.js.map +1 -0
- package/dist/plugins/tempo-trace-query/query-editor-model.d.ts +15 -0
- package/dist/plugins/tempo-trace-query/query-editor-model.d.ts.map +1 -0
- package/dist/plugins/tempo-trace-query/query-editor-model.js +50 -0
- package/dist/plugins/tempo-trace-query/query-editor-model.js.map +1 -0
- package/dist/test/mock-data.js +1 -1
- package/dist/test/mock-data.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -21,15 +21,15 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
TempoTraceQuery: function() {
|
|
25
|
-
return _TempoTraceQuery.TempoTraceQuery;
|
|
26
|
-
},
|
|
27
24
|
TempoDatasource: function() {
|
|
28
25
|
return _tempodatasource.TempoDatasource;
|
|
26
|
+
},
|
|
27
|
+
TempoTraceQuery: function() {
|
|
28
|
+
return _TempoTraceQuery.TempoTraceQuery;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _tempodatasource = require("./plugins/tempo-datasource");
|
|
32
|
-
const _TempoTraceQuery = require("./plugins/TempoTraceQuery");
|
|
32
|
+
const _TempoTraceQuery = require("./plugins/tempo-trace-query/TempoTraceQuery");
|
|
33
33
|
_export_star(require("./model/tempo-client"), exports);
|
|
34
34
|
_export_star(require("./model/tempo-selectors"), exports);
|
|
35
35
|
function _export_star(from, to) {
|
|
@@ -24,14 +24,14 @@ _export(exports, {
|
|
|
24
24
|
executeRequest: function() {
|
|
25
25
|
return executeRequest;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
getEnrichedTraceQuery: function() {
|
|
28
|
+
return getEnrichedTraceQuery;
|
|
29
29
|
},
|
|
30
30
|
searchTraceID: function() {
|
|
31
31
|
return searchTraceID;
|
|
32
32
|
},
|
|
33
|
-
|
|
34
|
-
return
|
|
33
|
+
searchTraceQuery: function() {
|
|
34
|
+
return searchTraceQuery;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
const _core = require("@perses-dev/core");
|
|
@@ -45,7 +45,7 @@ function fetchWithGet(apiURI, datasourceUrl) {
|
|
|
45
45
|
return executeRequest(url);
|
|
46
46
|
}
|
|
47
47
|
function searchTraceQuery(query, datasourceUrl) {
|
|
48
|
-
return fetchWithGet(`/api/search?q=${
|
|
48
|
+
return fetchWithGet(`/api/search?q=${query}`, datasourceUrl);
|
|
49
49
|
}
|
|
50
50
|
function searchTraceID(traceID, datasourceUrl) {
|
|
51
51
|
return fetchWithGet(`/api/traces/${traceID}`, datasourceUrl);
|
|
@@ -21,12 +21,12 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
TEMPO_DATASOURCE_KIND: function() {
|
|
25
|
-
return TEMPO_DATASOURCE_KIND;
|
|
26
|
-
},
|
|
27
24
|
DEFAULT_TEMPO: function() {
|
|
28
25
|
return DEFAULT_TEMPO;
|
|
29
26
|
},
|
|
27
|
+
TEMPO_DATASOURCE_KIND: function() {
|
|
28
|
+
return TEMPO_DATASOURCE_KIND;
|
|
29
|
+
},
|
|
30
30
|
isDefaultTempoSelector: function() {
|
|
31
31
|
return isDefaultTempoSelector;
|
|
32
32
|
},
|
|
@@ -24,8 +24,8 @@ const _tempoclient = require("../model/tempo-client");
|
|
|
24
24
|
/**
|
|
25
25
|
* Creates a TempoClient for a specific datasource spec.
|
|
26
26
|
*/ const createClient = (spec, options)=>{
|
|
27
|
-
const { directUrl
|
|
28
|
-
const { proxyUrl
|
|
27
|
+
const { directUrl } = spec;
|
|
28
|
+
const { proxyUrl } = options;
|
|
29
29
|
// Use the direct URL if specified, but fallback to the proxyUrl by default if not specified
|
|
30
30
|
const datasourceUrl = directUrl !== null && directUrl !== void 0 ? directUrl : proxyUrl;
|
|
31
31
|
if (datasourceUrl === undefined) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright 2023 The Perses 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "DashboardTempoTraceQueryEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return DashboardTempoTraceQueryEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
|
+
const _temposelectors = require("../../model/tempo-selectors");
|
|
27
|
+
const _TraceQLEditor = require("./TraceQLEditor");
|
|
28
|
+
function DashboardTempoTraceQueryEditor(props) {
|
|
29
|
+
const { selectedDatasource, handleDatasourceChange, datasourceURL, query, handleQueryChange, handleQueryBlur } = props;
|
|
30
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
31
|
+
spacing: 2,
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.FormControl, {
|
|
34
|
+
margin: "dense",
|
|
35
|
+
fullWidth: false,
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
|
|
38
|
+
id: "tempo-datasource-label",
|
|
39
|
+
children: "Tempo Datasource"
|
|
40
|
+
}),
|
|
41
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
42
|
+
datasourcePluginKind: _temposelectors.TEMPO_DATASOURCE_KIND,
|
|
43
|
+
value: selectedDatasource,
|
|
44
|
+
onChange: handleDatasourceChange,
|
|
45
|
+
labelId: "tempo-datasource-label",
|
|
46
|
+
label: "Tempo Datasource"
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_TraceQLEditor.TraceQLEditor, {
|
|
51
|
+
completeConfig: {
|
|
52
|
+
remote: {
|
|
53
|
+
url: datasourceURL
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
value: query,
|
|
57
|
+
onChange: handleQueryChange,
|
|
58
|
+
onBlur: handleQueryBlur
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2023 The Perses 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TempoTraceQuery", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return TempoTraceQuery;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _gettracedata = require("./get-trace-data");
|
|
24
|
+
const _TempoTraceQueryEditor = require("./TempoTraceQueryEditor");
|
|
25
|
+
const TempoTraceQuery = {
|
|
26
|
+
getTraceData: _gettracedata.getTraceData,
|
|
27
|
+
OptionsEditorComponent: _TempoTraceQueryEditor.TempoTraceQueryEditor,
|
|
28
|
+
createInitialOptions: ()=>({
|
|
29
|
+
query: '{}',
|
|
30
|
+
datasource: undefined
|
|
31
|
+
})
|
|
32
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2023 The Perses 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TempoTraceQueryEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return TempoTraceQueryEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
|
+
const _immer = require("immer");
|
|
26
|
+
const _temposelectors = require("../../model/tempo-selectors");
|
|
27
|
+
const _queryeditormodel = require("./query-editor-model");
|
|
28
|
+
const _DashboardTempoTraceQueryEditor = require("./DashboardTempoTraceQueryEditor");
|
|
29
|
+
function TempoTraceQueryEditor(props) {
|
|
30
|
+
const { onChange, value } = props;
|
|
31
|
+
const { datasource } = value;
|
|
32
|
+
const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : _temposelectors.DEFAULT_TEMPO;
|
|
33
|
+
const { data: client } = (0, _pluginsystem.useDatasourceClient)(selectedDatasource);
|
|
34
|
+
const datasourceURL = client === null || client === void 0 ? void 0 : client.options.datasourceUrl;
|
|
35
|
+
const { query, handleQueryChange, handleQueryBlur } = (0, _queryeditormodel.useQueryState)(props);
|
|
36
|
+
const handleDatasourceChange = (next)=>{
|
|
37
|
+
if ((0, _temposelectors.isTempoDatasourceSelector)(next)) {
|
|
38
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
39
|
+
// If they're using the default, just omit the datasource prop (i.e. set to undefined)
|
|
40
|
+
const nextDatasource = (0, _temposelectors.isDefaultTempoSelector)(next) ? undefined : next;
|
|
41
|
+
draft.datasource = nextDatasource;
|
|
42
|
+
}));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
throw new Error('Got unexpected non-Tempo datasource selector');
|
|
46
|
+
};
|
|
47
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardTempoTraceQueryEditor.DashboardTempoTraceQueryEditor, {
|
|
48
|
+
selectedDatasource: selectedDatasource,
|
|
49
|
+
handleDatasourceChange: handleDatasourceChange,
|
|
50
|
+
datasourceURL: datasourceURL,
|
|
51
|
+
query: query,
|
|
52
|
+
handleQueryChange: handleQueryChange,
|
|
53
|
+
handleQueryBlur: handleQueryBlur
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright 2023 The Perses 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TraceQLEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return TraceQLEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _reactcodemirror = /*#__PURE__*/ _interop_require_default(require("@uiw/react-codemirror"));
|
|
26
|
+
function _interop_require_default(obj) {
|
|
27
|
+
return obj && obj.__esModule ? obj : {
|
|
28
|
+
default: obj
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function TraceQLEditor({ ...rest }) {
|
|
32
|
+
const theme = (0, _material.useTheme)();
|
|
33
|
+
const isDarkMode = theme.palette.mode === 'dark';
|
|
34
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcodemirror.default, {
|
|
35
|
+
...rest,
|
|
36
|
+
style: {
|
|
37
|
+
border: `1px solid ${theme.palette.divider}`
|
|
38
|
+
},
|
|
39
|
+
theme: isDarkMode ? 'dark' : 'light',
|
|
40
|
+
basicSetup: {
|
|
41
|
+
highlightActiveLine: false,
|
|
42
|
+
highlightActiveLineGutter: false,
|
|
43
|
+
foldGutter: false
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Copyright 2023 The Perses 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
getTraceData: function() {
|
|
25
|
+
return getTraceData;
|
|
26
|
+
},
|
|
27
|
+
getUnixTimeRange: function() {
|
|
28
|
+
return getUnixTimeRange;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const _datefns = require("date-fns");
|
|
32
|
+
const _temposelectors = require("../../model/tempo-selectors");
|
|
33
|
+
function getUnixTimeRange(timeRange) {
|
|
34
|
+
const { start, end } = timeRange;
|
|
35
|
+
return {
|
|
36
|
+
start: Math.ceil((0, _datefns.getUnixTime)(start)),
|
|
37
|
+
end: Math.ceil((0, _datefns.getUnixTime)(end))
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const getTraceData = async (spec, context)=>{
|
|
41
|
+
var _client_options;
|
|
42
|
+
if (spec.query === undefined || spec.query === null || spec.query === '') {
|
|
43
|
+
// Do not make a request to the backend, instead return an empty TraceData
|
|
44
|
+
console.error('TempoTraceQuery is undefined, null, or an empty string.');
|
|
45
|
+
return {
|
|
46
|
+
traces: []
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const defaultTempoDatasource = {
|
|
50
|
+
kind: _temposelectors.TEMPO_DATASOURCE_KIND
|
|
51
|
+
};
|
|
52
|
+
var _spec_datasource;
|
|
53
|
+
const client = await context.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : defaultTempoDatasource);
|
|
54
|
+
const datasourceUrl = client === null || client === void 0 ? void 0 : (_client_options = client.options) === null || _client_options === void 0 ? void 0 : _client_options.datasourceUrl;
|
|
55
|
+
if (datasourceUrl === undefined || datasourceUrl === null || datasourceUrl === '') {
|
|
56
|
+
console.error('TempoDatasource is undefined, null, or an empty string.');
|
|
57
|
+
return {
|
|
58
|
+
traces: []
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const getQuery = ()=>{
|
|
62
|
+
// if time range not defined -- only return the query from the spec
|
|
63
|
+
if (context.absoluteTimeRange === undefined) {
|
|
64
|
+
return spec.query;
|
|
65
|
+
}
|
|
66
|
+
// if the query already contains a time range (i.e.start and end times)
|
|
67
|
+
if (spec.query.includes('start=') || spec.query.includes('end=')) {
|
|
68
|
+
return spec.query;
|
|
69
|
+
}
|
|
70
|
+
// handle time range selection from UI drop down (e.g. last 5 minutes, last 1 hour )
|
|
71
|
+
const { start, end } = getUnixTimeRange(context === null || context === void 0 ? void 0 : context.absoluteTimeRange);
|
|
72
|
+
const queryStartTime = '&start=' + start;
|
|
73
|
+
const queryEndTime = '&end=' + end;
|
|
74
|
+
const queryWithTimeRange = encodeURI(spec.query) + queryStartTime + queryEndTime;
|
|
75
|
+
return queryWithTimeRange;
|
|
76
|
+
};
|
|
77
|
+
const enrichedTraceResponse = await client.getEnrichedTraceQuery(getQuery(), datasourceUrl);
|
|
78
|
+
const traces = enrichedTraceResponse.traces.map((traceValue)=>{
|
|
79
|
+
const startTimeUnixMs = parseInt(traceValue.summary.startTimeUnixNano) * 1e-6; // convert to millisecond for eChart time format
|
|
80
|
+
const durationMs = traceValue.summary.durationMs;
|
|
81
|
+
const spanCount = traceValue.spanCount;
|
|
82
|
+
const errorCount = traceValue.errorCount;
|
|
83
|
+
const traceId = traceValue.summary.traceID;
|
|
84
|
+
const name = `rootServiceName="${traceValue.summary.rootServiceName.trim()}", rootTraceName="${traceValue.summary.rootServiceName.trim()}"`;
|
|
85
|
+
return {
|
|
86
|
+
startTimeUnixMs,
|
|
87
|
+
durationMs,
|
|
88
|
+
spanCount,
|
|
89
|
+
errorCount,
|
|
90
|
+
traceId,
|
|
91
|
+
name
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
const traceData = {
|
|
95
|
+
traces,
|
|
96
|
+
metadata: {
|
|
97
|
+
executedQueryString: spec.query
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return traceData;
|
|
101
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright 2023 The Perses 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "useQueryState", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return useQueryState;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _react = require("react");
|
|
24
|
+
const _immer = require("immer");
|
|
25
|
+
function useQueryState(props) {
|
|
26
|
+
const { onChange, value } = props;
|
|
27
|
+
// Local copy of the query's value
|
|
28
|
+
const [query, setQuery] = (0, _react.useState)(value.query);
|
|
29
|
+
// This is basically "getDerivedStateFromProps" to make sure if spec's value changes external to this component,
|
|
30
|
+
// we render with the latest value
|
|
31
|
+
const [lastSyncedQuery, setLastSyncedQuery] = (0, _react.useState)(value.query);
|
|
32
|
+
if (value.query !== lastSyncedQuery) {
|
|
33
|
+
setQuery(value.query);
|
|
34
|
+
setLastSyncedQuery(value.query);
|
|
35
|
+
}
|
|
36
|
+
// Update our local state's copy as the user types
|
|
37
|
+
const handleQueryChange = (e)=>{
|
|
38
|
+
setQuery(e);
|
|
39
|
+
};
|
|
40
|
+
// Propagate changes to the query's value when the input is blurred to avoid constantly re-running queries in the
|
|
41
|
+
// PanelPreview
|
|
42
|
+
const handleQueryBlur = ()=>{
|
|
43
|
+
setLastSyncedQuery(query);
|
|
44
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
45
|
+
draft.query = query;
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
query,
|
|
50
|
+
handleQueryChange,
|
|
51
|
+
handleQueryBlur
|
|
52
|
+
};
|
|
53
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TempoDatasource } from './plugins/tempo-datasource';
|
|
2
|
-
import { TempoTraceQuery } from './plugins/TempoTraceQuery';
|
|
2
|
+
import { TempoTraceQuery } from './plugins/tempo-trace-query/TempoTraceQuery';
|
|
3
3
|
export { TempoTraceQuery, TempoDatasource };
|
|
4
4
|
export * from './model/tempo-client';
|
|
5
5
|
export * from './model/tempo-selectors';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAG5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { TempoDatasource } from './plugins/tempo-datasource';
|
|
14
|
-
import { TempoTraceQuery } from './plugins/TempoTraceQuery';
|
|
14
|
+
import { TempoTraceQuery } from './plugins/tempo-trace-query/TempoTraceQuery';
|
|
15
15
|
// Export plugins under the same name as the kinds they handle from the plugin.json
|
|
16
16
|
export { TempoTraceQuery, TempoDatasource };
|
|
17
17
|
// For consumers to leverage in DatasourceStoreProvider onCreate
|
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 { TempoDatasource } from './plugins/tempo-datasource';\nimport { TempoTraceQuery } from './plugins/TempoTraceQuery';\n\n// Export plugins under the same name as the kinds they handle from the plugin.json\nexport { TempoTraceQuery, TempoDatasource };\n\n// For consumers to leverage in DatasourceStoreProvider onCreate\nexport * from './model/tempo-client';\nexport * from './model/tempo-selectors';\n"],"names":["TempoDatasource","TempoTraceQuery"],"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,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,eAAe,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 { TempoDatasource } from './plugins/tempo-datasource';\nimport { TempoTraceQuery } from './plugins/tempo-trace-query/TempoTraceQuery';\n\n// Export plugins under the same name as the kinds they handle from the plugin.json\nexport { TempoTraceQuery, TempoDatasource };\n\n// For consumers to leverage in DatasourceStoreProvider onCreate\nexport * from './model/tempo-client';\nexport * from './model/tempo-selectors';\n"],"names":["TempoDatasource","TempoTraceQuery"],"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,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,eAAe,QAAQ,8CAA8C;AAE9E,mFAAmF;AACnF,SAASA,eAAe,EAAED,eAAe,GAAG;AAE5C,gEAAgE;AAChE,cAAc,uBAAuB;AACrC,cAAc,0BAA0B"}
|
package/dist/model/api-types.js
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Combined Response of Tempo HTTP API endpoint GET /api/search/<query>
|
|
15
|
+
* and GET /api/traces/<traceID>. For each trace returned from GET /api/search/<query>
|
|
16
|
+
* a detailed trace report is fetched from GET /api/traces/<traceID>.
|
|
17
|
+
*/ export { };
|
|
14
18
|
|
|
15
19
|
//# sourceMappingURL=api-types.js.map
|
|
@@ -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\nexport interface Span {\n startTimeUnixNano: string;\n spanId?: string; // Span from api/search/<query>\n spanID?: string; // Span from api/traces/<traceID>\n attributes?: Attribute[];\n durationNanos?: string;\n endTimeUnixNano?: string;\n kind?: string;\n name?: string;\n parentSpanId?: string;\n status?: {\n code?: string;\n };\n traceId?: string;\n}\n\nexport interface Trace {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n durationMs: number;\n spanSets?: Array<{\n spans: Span[];\n matched: number;\n }>;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search/<query>\n */\nexport interface SearchTraceQueryResponse {\n traces: Trace[];\n}\n\nexport interface Attribute {\n key: string;\n value: {\n stringValue?: string;\n intValue?: string;\n };\n}\n\nexport interface ScopeSpan {\n scope: {\n name: string;\n };\n spans: Span[];\n}\n\nexport interface Batch {\n resource: {\n attributes: Attribute[];\n };\n scopeSpans: ScopeSpan[];\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n */\nexport interface SearchTraceIDResponse {\n batches: Batch[];\n}\n\n/**\n * Combined Response of Tempo HTTP API endpoint GET /api/search/<query>\n * and GET /api/traces/<traceID>. For each trace returned from GET /api/search/<query>\n * a detailed trace report is fetched from GET /api/traces/<traceID>.\n */\nexport interface EnrichedTraceQueryResponse {\n query: string;\n traces: Array<{\n spanCount: number;\n errorCount: number;\n summary: Trace;\n traceDetails: SearchTraceIDResponse;\n }>;\n}\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\nexport interface Span {\n startTimeUnixNano: string;\n spanId?: string; // Span from api/search/<query>\n spanID?: string; // Span from api/traces/<traceID>\n attributes?: Attribute[];\n durationNanos?: string;\n endTimeUnixNano?: string;\n kind?: string;\n name?: string;\n parentSpanId?: string;\n status?: {\n code?: string;\n };\n traceId?: string;\n}\n\nexport interface Trace {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n durationMs: number;\n spanSets?: Array<{\n spans: Span[];\n matched: number;\n }>;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search/<query>\n */\nexport interface SearchTraceQueryResponse {\n traces: Trace[];\n}\n\nexport interface Attribute {\n key: string;\n value: {\n stringValue?: string;\n intValue?: string;\n };\n}\n\nexport interface ScopeSpan {\n scope: {\n name: string;\n };\n spans: Span[];\n}\n\nexport interface Batch {\n resource: {\n attributes: Attribute[];\n };\n scopeSpans: ScopeSpan[];\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n */\nexport interface SearchTraceIDResponse {\n batches: Batch[];\n}\n\n/**\n * Combined Response of Tempo HTTP API endpoint GET /api/search/<query>\n * and GET /api/traces/<traceID>. For each trace returned from GET /api/search/<query>\n * a detailed trace report is fetched from GET /api/traces/<traceID>.\n */\nexport interface EnrichedTraceQueryResponse {\n query: string;\n traces: Array<{\n spanCount: number;\n errorCount: number;\n summary: Trace;\n traceDetails: SearchTraceIDResponse;\n }>;\n}\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;AAkEjC;;;;CAIC,GACD,WAQC"}
|
|
@@ -23,7 +23,7 @@ function fetchWithGet(apiURI, datasourceUrl) {
|
|
|
23
23
|
/**
|
|
24
24
|
* Returns a summary report of traces that satisfy the query.
|
|
25
25
|
*/ export function searchTraceQuery(query, datasourceUrl) {
|
|
26
|
-
return fetchWithGet(`/api/search?q=${
|
|
26
|
+
return fetchWithGet(`/api/search?q=${query}`, datasourceUrl);
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Returns a detailed report, including all the spans, for a given trace.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/tempo-client.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 { fetch, RequestHeaders } from '@perses-dev/core';\nimport { DatasourceClient } from '@perses-dev/plugin-system';\nimport { SearchTraceIDResponse, EnrichedTraceQueryResponse, SearchTraceQueryResponse } from './api-types';\n\ninterface TempoClientOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport interface TempoClient extends DatasourceClient {\n options: TempoClientOptions;\n getEnrichedTraceQuery(query: string, datasourceUrl: string): Promise<EnrichedTraceQueryResponse>;\n searchTraceQuery(query: string, datasourceUrl: string): Promise<SearchTraceQueryResponse>;\n searchTraceID(traceID: string, datasourceUrl: string): Promise<SearchTraceIDResponse>;\n}\n\nexport const executeRequest = async <T>(url: string): Promise<T> => {\n const response = await fetch(url);\n const jsonData = await response.json();\n return jsonData;\n};\n\nfunction fetchWithGet<TResponse>(apiURI: string, datasourceUrl: string) {\n const url = `${datasourceUrl}${apiURI}`;\n return executeRequest<TResponse>(url);\n}\n\n/**\n * Returns a summary report of traces that satisfy the query.\n */\nexport function searchTraceQuery(query: string, datasourceUrl: string) {\n return fetchWithGet<SearchTraceQueryResponse>(`/api/search?q=${
|
|
1
|
+
{"version":3,"sources":["../../src/model/tempo-client.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 { fetch, RequestHeaders } from '@perses-dev/core';\nimport { DatasourceClient } from '@perses-dev/plugin-system';\nimport { SearchTraceIDResponse, EnrichedTraceQueryResponse, SearchTraceQueryResponse } from './api-types';\n\ninterface TempoClientOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport interface TempoClient extends DatasourceClient {\n options: TempoClientOptions;\n getEnrichedTraceQuery(query: string, datasourceUrl: string): Promise<EnrichedTraceQueryResponse>;\n searchTraceQuery(query: string, datasourceUrl: string): Promise<SearchTraceQueryResponse>;\n searchTraceID(traceID: string, datasourceUrl: string): Promise<SearchTraceIDResponse>;\n}\n\nexport const executeRequest = async <T>(url: string): Promise<T> => {\n const response = await fetch(url);\n const jsonData = await response.json();\n return jsonData;\n};\n\nfunction fetchWithGet<TResponse>(apiURI: string, datasourceUrl: string) {\n const url = `${datasourceUrl}${apiURI}`;\n return executeRequest<TResponse>(url);\n}\n\n/**\n * Returns a summary report of traces that satisfy the query.\n */\nexport function searchTraceQuery(query: string, datasourceUrl: string) {\n return fetchWithGet<SearchTraceQueryResponse>(`/api/search?q=${query}`, datasourceUrl);\n}\n\n/**\n * Returns a detailed report, including all the spans, for a given trace.\n */\nexport function searchTraceID(traceID: string, datasourceUrl: string) {\n return fetchWithGet<SearchTraceIDResponse>(`/api/traces/${traceID}`, datasourceUrl);\n}\n\n/**\n * Combined response of Tempo HTTP API endpoints GET /api/search/<query>\n * and GET /api/traces/<traceID>. For each trace returned from GET /api/search/<query>\n * a detailed trace report is fetched from GET /api/traces/<traceID>. This is a\n * temporary workaround to obtain the total number of spans and total number\n * of errors for a trace.\n *\n * TODO: This workaround should be replaced once this issue,\n * https://github.com/grafana/tempo/issues/2940, is resolved upstream in\n * Tempo.\n */\nexport async function getEnrichedTraceQuery(query: string, datasourceUrl: string): Promise<EnrichedTraceQueryResponse> {\n // Get a list of traces that satisfy the query.\n const searchResponse = await searchTraceQuery(query, datasourceUrl);\n if (!searchResponse.traces) {\n return { query, traces: [] };\n }\n\n return {\n query,\n traces: await Promise.all(\n searchResponse.traces.map(async (trace) => {\n let spanCount = 0;\n let errorCount = 0;\n const searchTraceIDResponse = await searchTraceID(trace.traceID, datasourceUrl);\n\n // For every trace, get the full trace, and find the total number of spans and errors.\n for (const batch of searchTraceIDResponse.batches) {\n for (const scopeSpan of batch.scopeSpans) {\n spanCount += scopeSpan.spans.length;\n for (const span of scopeSpan.spans) {\n if (span.status?.code) {\n errorCount++;\n }\n }\n }\n }\n\n return {\n summary: trace,\n traceDetails: searchTraceIDResponse,\n spanCount,\n errorCount,\n };\n })\n ),\n };\n}\n"],"names":["fetch","executeRequest","url","response","jsonData","json","fetchWithGet","apiURI","datasourceUrl","searchTraceQuery","query","searchTraceID","traceID","getEnrichedTraceQuery","searchResponse","traces","Promise","all","map","trace","spanCount","errorCount","searchTraceIDResponse","batch","batches","scopeSpan","scopeSpans","spans","length","span","status","code","summary","traceDetails"],"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,KAAK,QAAwB,mBAAmB;AAgBzD,OAAO,MAAMC,iBAAiB,OAAUC;IACtC,MAAMC,WAAW,MAAMH,MAAME;IAC7B,MAAME,WAAW,MAAMD,SAASE,IAAI;IACpC,OAAOD;AACT,EAAE;AAEF,SAASE,aAAwBC,MAAc,EAAEC,aAAqB;IACpE,MAAMN,MAAM,CAAC,EAAEM,cAAc,EAAED,OAAO,CAAC;IACvC,OAAON,eAA0BC;AACnC;AAEA;;CAEC,GACD,OAAO,SAASO,iBAAiBC,KAAa,EAAEF,aAAqB;IACnE,OAAOF,aAAuC,CAAC,cAAc,EAAEI,MAAM,CAAC,EAAEF;AAC1E;AAEA;;CAEC,GACD,OAAO,SAASG,cAAcC,OAAe,EAAEJ,aAAqB;IAClE,OAAOF,aAAoC,CAAC,YAAY,EAAEM,QAAQ,CAAC,EAAEJ;AACvE;AAEA;;;;;;;;;;CAUC,GACD,OAAO,eAAeK,sBAAsBH,KAAa,EAAEF,aAAqB;IAC9E,+CAA+C;IAC/C,MAAMM,iBAAiB,MAAML,iBAAiBC,OAAOF;IACrD,IAAI,CAACM,eAAeC,MAAM,EAAE;QAC1B,OAAO;YAAEL;YAAOK,QAAQ,EAAE;QAAC;IAC7B;IAEA,OAAO;QACLL;QACAK,QAAQ,MAAMC,QAAQC,GAAG,CACvBH,eAAeC,MAAM,CAACG,GAAG,CAAC,OAAOC;YAC/B,IAAIC,YAAY;YAChB,IAAIC,aAAa;YACjB,MAAMC,wBAAwB,MAAMX,cAAcQ,MAAMP,OAAO,EAAEJ;YAEjE,sFAAsF;YACtF,KAAK,MAAMe,SAASD,sBAAsBE,OAAO,CAAE;gBACjD,KAAK,MAAMC,aAAaF,MAAMG,UAAU,CAAE;oBACxCN,aAAaK,UAAUE,KAAK,CAACC,MAAM;oBACnC,KAAK,MAAMC,QAAQJ,UAAUE,KAAK,CAAE;4BAC9BE;wBAAJ,KAAIA,eAAAA,KAAKC,MAAM,cAAXD,mCAAAA,aAAaE,IAAI,EAAE;4BACrBV;wBACF;oBACF;gBACF;YACF;YAEA,OAAO;gBACLW,SAASb;gBACTc,cAAcX;gBACdF;gBACAC;YACF;QACF;IAEJ;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/tempo-selectors.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 { DatasourceSelector } from '@perses-dev/core';\n\nexport const TEMPO_DATASOURCE_KIND = 'TempoDatasource' as const;\n\n/**\n * DatasourceSelector for Tempo Datasources.\n */\nexport interface TempoDatasourceSelector extends DatasourceSelector {\n kind: typeof TEMPO_DATASOURCE_KIND;\n}\n\n/**\n * A default selector that asks for the default Tempo Datasource.\n */\nexport const DEFAULT_TEMPO: TempoDatasourceSelector = { kind: TEMPO_DATASOURCE_KIND };\n\n/**\n * Returns true if the provided TempoDatasourceSelector is the default one.\n */\nexport function isDefaultTempoSelector(selector: TempoDatasourceSelector) {\n return selector.name === undefined;\n}\n\n/**\n * Type guard to make sure a DatasourceSelector is a Tempo one.\n */\nexport function isTempoDatasourceSelector(selector: DatasourceSelector): selector is TempoDatasourceSelector {\n return selector.kind === TEMPO_DATASOURCE_KIND;\n}\n"],"names":["TEMPO_DATASOURCE_KIND","DEFAULT_TEMPO","kind","isDefaultTempoSelector","selector","name","undefined","isTempoDatasourceSelector"],"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;AAIjC,OAAO,MAAMA,wBAAwB,kBAA2B;AAShE;;CAEC,GACD,OAAO,MAAMC,gBAAyC;IAAEC,MAAMF;AAAsB,EAAE;AAEtF;;CAEC,GACD,OAAO,SAASG,uBAAuBC,QAAiC;IACtE,OAAOA,SAASC,
|
|
1
|
+
{"version":3,"sources":["../../src/model/tempo-selectors.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 { DatasourceSelector } from '@perses-dev/core';\n\nexport const TEMPO_DATASOURCE_KIND = 'TempoDatasource' as const;\n\n/**\n * DatasourceSelector for Tempo Datasources.\n */\nexport interface TempoDatasourceSelector extends DatasourceSelector {\n kind: typeof TEMPO_DATASOURCE_KIND;\n}\n\n/**\n * A default selector that asks for the default Tempo Datasource.\n */\nexport const DEFAULT_TEMPO: TempoDatasourceSelector = { kind: TEMPO_DATASOURCE_KIND };\n\n/**\n * Returns true if the provided TempoDatasourceSelector is the default one.\n */\nexport function isDefaultTempoSelector(selector: TempoDatasourceSelector) {\n return selector.name === undefined;\n}\n\n/**\n * Type guard to make sure a DatasourceSelector is a Tempo one.\n */\nexport function isTempoDatasourceSelector(selector: DatasourceSelector): selector is TempoDatasourceSelector {\n return selector.kind === TEMPO_DATASOURCE_KIND;\n}\n"],"names":["TEMPO_DATASOURCE_KIND","DEFAULT_TEMPO","kind","isDefaultTempoSelector","selector","name","undefined","isTempoDatasourceSelector"],"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;AAIjC,OAAO,MAAMA,wBAAwB,kBAA2B;AAShE;;CAEC,GACD,OAAO,MAAMC,gBAAyC;IAAEC,MAAMF;AAAsB,EAAE;AAEtF;;CAEC,GACD,OAAO,SAASG,uBAAuBC,QAAiC;IACtE,OAAOA,SAASC,IAAI,KAAKC;AAC3B;AAEA;;CAEC,GACD,OAAO,SAASC,0BAA0BH,QAA4B;IACpE,OAAOA,SAASF,IAAI,KAAKF;AAC3B"}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The spec/options for the TempoTraceQuery plugin.
|
|
15
|
+
*/ export { };
|
|
14
16
|
|
|
15
17
|
//# sourceMappingURL=trace-query-model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/trace-query-model.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 { TempoDatasourceSelector } from './tempo-selectors';\n/**\n * The spec/options for the TempoTraceQuery plugin.\n */\nexport interface TempoTraceQuerySpec {\n query: string;\n datasource?: TempoDatasourceSelector;\n}\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/trace-query-model.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 { TempoDatasourceSelector } from './tempo-selectors';\n/**\n * The spec/options for the TempoTraceQuery plugin.\n */\nexport interface TempoTraceQuerySpec {\n query: string;\n datasource?: TempoDatasourceSelector;\n}\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;AAGjC;;CAEC,GACD,WAGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/get-trace-data.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 { TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { TraceData, TraceValue } from '@perses-dev/core';\nimport { TempoTraceQuerySpec } from '../model/trace-query-model';\nimport { TEMPO_DATASOURCE_KIND, TempoDatasourceSelector } from '../model/tempo-selectors';\nimport { TempoClient } from '../model/tempo-client';\n\nexport const getTraceData: TraceQueryPlugin<TempoTraceQuerySpec>['getTraceData'] = async (spec, context) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n // Do not make a request to the backend, instead return an empty TraceData\n console.error('TempoTraceQuery is undefined, null, or an empty string.');\n return { traces: [] };\n }\n\n const defaultTempoDatasource: TempoDatasourceSelector = {\n kind: TEMPO_DATASOURCE_KIND,\n };\n\n const client: TempoClient = await context.datasourceStore.getDatasourceClient(\n spec.datasource ?? defaultTempoDatasource\n );\n\n const datasourceUrl = client?.options?.datasourceUrl;\n if (datasourceUrl === undefined || datasourceUrl === null || datasourceUrl === '') {\n console.error('TempoDatasource is undefined, null, or an empty string.');\n return { traces: [] };\n }\n\n const enrichedTraceResponse = await client.getEnrichedTraceQuery(spec.query, datasourceUrl);\n\n const traces: TraceValue[] = enrichedTraceResponse.traces.map((traceValue) => {\n const startTimeUnixMs = parseInt(traceValue.summary.startTimeUnixNano) / 1000;\n const durationMs = traceValue.summary.durationMs;\n const spanCount = traceValue.spanCount;\n const errorCount = traceValue.errorCount;\n const traceId = traceValue.summary.traceID;\n const name = `rootServiceName=\"${traceValue.summary.rootServiceName.trim()}\", rootTraceName=\"${traceValue.summary.rootServiceName.trim()}\"`;\n\n return {\n startTimeUnixMs,\n durationMs,\n spanCount,\n errorCount,\n traceId,\n name,\n };\n });\n\n const traceData: TraceData = {\n traces,\n metadata: {\n executedQueryString: spec.query,\n },\n };\n\n return traceData;\n};\n"],"names":["TEMPO_DATASOURCE_KIND","getTraceData","spec","context","client","query","undefined","console","error","traces","defaultTempoDatasource","kind","datasourceStore","getDatasourceClient","datasource","datasourceUrl","options","enrichedTraceResponse","getEnrichedTraceQuery","map","traceValue","startTimeUnixMs","parseInt","summary","startTimeUnixNano","durationMs","spanCount","errorCount","traceId","traceID","name","rootServiceName","trim","traceData","metadata","executedQueryString"],"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;AAKjC,SAASA,qBAAqB,QAAiC,2BAA2B;AAG1F,OAAO,MAAMC,eAAsE,OAAOC,MAAMC;QAexEC;IAdtB,IAAIF,KAAKG,
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/get-trace-data.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 { TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { TraceData, TraceValue } from '@perses-dev/core';\nimport { TempoTraceQuerySpec } from '../model/trace-query-model';\nimport { TEMPO_DATASOURCE_KIND, TempoDatasourceSelector } from '../model/tempo-selectors';\nimport { TempoClient } from '../model/tempo-client';\n\nexport const getTraceData: TraceQueryPlugin<TempoTraceQuerySpec>['getTraceData'] = async (spec, context) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n // Do not make a request to the backend, instead return an empty TraceData\n console.error('TempoTraceQuery is undefined, null, or an empty string.');\n return { traces: [] };\n }\n\n const defaultTempoDatasource: TempoDatasourceSelector = {\n kind: TEMPO_DATASOURCE_KIND,\n };\n\n const client: TempoClient = await context.datasourceStore.getDatasourceClient(\n spec.datasource ?? defaultTempoDatasource\n );\n\n const datasourceUrl = client?.options?.datasourceUrl;\n if (datasourceUrl === undefined || datasourceUrl === null || datasourceUrl === '') {\n console.error('TempoDatasource is undefined, null, or an empty string.');\n return { traces: [] };\n }\n\n const enrichedTraceResponse = await client.getEnrichedTraceQuery(spec.query, datasourceUrl);\n\n const traces: TraceValue[] = enrichedTraceResponse.traces.map((traceValue) => {\n const startTimeUnixMs = parseInt(traceValue.summary.startTimeUnixNano) / 1000;\n const durationMs = traceValue.summary.durationMs;\n const spanCount = traceValue.spanCount;\n const errorCount = traceValue.errorCount;\n const traceId = traceValue.summary.traceID;\n const name = `rootServiceName=\"${traceValue.summary.rootServiceName.trim()}\", rootTraceName=\"${traceValue.summary.rootServiceName.trim()}\"`;\n\n return {\n startTimeUnixMs,\n durationMs,\n spanCount,\n errorCount,\n traceId,\n name,\n };\n });\n\n const traceData: TraceData = {\n traces,\n metadata: {\n executedQueryString: spec.query,\n },\n };\n\n return traceData;\n};\n"],"names":["TEMPO_DATASOURCE_KIND","getTraceData","spec","context","client","query","undefined","console","error","traces","defaultTempoDatasource","kind","datasourceStore","getDatasourceClient","datasource","datasourceUrl","options","enrichedTraceResponse","getEnrichedTraceQuery","map","traceValue","startTimeUnixMs","parseInt","summary","startTimeUnixNano","durationMs","spanCount","errorCount","traceId","traceID","name","rootServiceName","trim","traceData","metadata","executedQueryString"],"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;AAKjC,SAASA,qBAAqB,QAAiC,2BAA2B;AAG1F,OAAO,MAAMC,eAAsE,OAAOC,MAAMC;QAexEC;IAdtB,IAAIF,KAAKG,KAAK,KAAKC,aAAaJ,KAAKG,KAAK,KAAK,QAAQH,KAAKG,KAAK,KAAK,IAAI;QACxE,0EAA0E;QAC1EE,QAAQC,KAAK,CAAC;QACd,OAAO;YAAEC,QAAQ,EAAE;QAAC;IACtB;IAEA,MAAMC,yBAAkD;QACtDC,MAAMX;IACR;QAGEE;IADF,MAAME,SAAsB,MAAMD,QAAQS,eAAe,CAACC,mBAAmB,CAC3EX,CAAAA,mBAAAA,KAAKY,UAAU,cAAfZ,8BAAAA,mBAAmBQ;IAGrB,MAAMK,gBAAgBX,mBAAAA,8BAAAA,kBAAAA,OAAQY,OAAO,cAAfZ,sCAAAA,gBAAiBW,aAAa;IACpD,IAAIA,kBAAkBT,aAAaS,kBAAkB,QAAQA,kBAAkB,IAAI;QACjFR,QAAQC,KAAK,CAAC;QACd,OAAO;YAAEC,QAAQ,EAAE;QAAC;IACtB;IAEA,MAAMQ,wBAAwB,MAAMb,OAAOc,qBAAqB,CAAChB,KAAKG,KAAK,EAAEU;IAE7E,MAAMN,SAAuBQ,sBAAsBR,MAAM,CAACU,GAAG,CAAC,CAACC;QAC7D,MAAMC,kBAAkBC,SAASF,WAAWG,OAAO,CAACC,iBAAiB,IAAI;QACzE,MAAMC,aAAaL,WAAWG,OAAO,CAACE,UAAU;QAChD,MAAMC,YAAYN,WAAWM,SAAS;QACtC,MAAMC,aAAaP,WAAWO,UAAU;QACxC,MAAMC,UAAUR,WAAWG,OAAO,CAACM,OAAO;QAC1C,MAAMC,OAAO,CAAC,iBAAiB,EAAEV,WAAWG,OAAO,CAACQ,eAAe,CAACC,IAAI,GAAG,kBAAkB,EAAEZ,WAAWG,OAAO,CAACQ,eAAe,CAACC,IAAI,GAAG,CAAC,CAAC;QAE3I,OAAO;YACLX;YACAI;YACAC;YACAC;YACAC;YACAE;QACF;IACF;IAEA,MAAMG,YAAuB;QAC3BxB;QACAyB,UAAU;YACRC,qBAAqBjC,KAAKG,KAAK;QACjC;IACF;IAEA,OAAO4B;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/tempo-datasource-types.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 { HTTPProxy } from '@perses-dev/core';\n\nexport interface TempoDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n}\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/plugins/tempo-datasource-types.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 { HTTPProxy } from '@perses-dev/core';\n\nexport interface TempoDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n}\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;AAIjC,WAGC"}
|
|
@@ -14,8 +14,8 @@ import { searchTraceQuery, searchTraceID, getEnrichedTraceQuery } from '../model
|
|
|
14
14
|
/**
|
|
15
15
|
* Creates a TempoClient for a specific datasource spec.
|
|
16
16
|
*/ const createClient = (spec, options)=>{
|
|
17
|
-
const { directUrl
|
|
18
|
-
const { proxyUrl
|
|
17
|
+
const { directUrl } = spec;
|
|
18
|
+
const { proxyUrl } = options;
|
|
19
19
|
// Use the direct URL if specified, but fallback to the proxyUrl by default if not specified
|
|
20
20
|
const datasourceUrl = directUrl !== null && directUrl !== void 0 ? directUrl : proxyUrl;
|
|
21
21
|
if (datasourceUrl === undefined) {
|