@perses-dev/tempo-plugin 0.55.0 → 0.57.0-beta.0
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/__mf/js/Tempo.7093dd4a.js +6 -0
- package/__mf/js/async/1233.6db7be6b.js +1 -0
- package/__mf/js/async/1490.cc0a832d.js +22 -0
- package/__mf/js/async/1616.46a1ec79.js +1 -0
- package/__mf/js/async/1728.21067e6f.js +1 -0
- package/__mf/js/async/1969.91de01f7.js +1 -0
- package/__mf/js/async/2012.543b6dce.js +1 -0
- package/__mf/js/async/2043.5826341c.js +2 -0
- package/__mf/js/async/2386.53c46472.js +2 -0
- package/__mf/js/async/2545.d42b194b.js +2 -0
- package/__mf/js/async/3181.b5749ad3.js +2 -0
- package/__mf/js/async/3617.32db58a8.js +110 -0
- package/__mf/js/async/3849.d1b5a7aa.js +7 -0
- package/__mf/js/async/392.fd3eade4.js +2 -0
- package/__mf/js/async/{1964.e6c5b93b.js → 4121.fae8ac21.js} +2 -2
- package/__mf/js/async/4746.c0ce20c6.js +2 -0
- package/__mf/js/async/4783.97c4e55a.js +2 -0
- package/__mf/js/async/4793.4fc513d0.js +2 -0
- package/__mf/js/async/{8930.dee9777e.js → 5002.41103df8.js} +1 -1
- package/__mf/js/async/501.3a82cccb.js +1 -0
- package/__mf/js/async/5071.f9a877b0.js +1 -0
- package/__mf/js/async/5214.d2077bec.js +2 -0
- package/__mf/js/async/{5214.c44cbfe5.js → 5587.eadcaae7.js} +1 -1
- package/__mf/js/async/6110.f6b3b766.js +1 -0
- package/__mf/js/async/6258.212dc324.js +2 -0
- package/__mf/js/async/6274.eff58da4.js +2 -0
- package/__mf/js/async/6283.3c7349ec.js +2 -0
- package/__mf/js/async/7177.31d891f2.js +1 -0
- package/__mf/js/async/7192.3f00df4c.js +1 -0
- package/__mf/js/async/7583.bfd2f519.js +1 -0
- package/__mf/js/async/7968.99f881c1.js +1 -0
- package/__mf/js/async/7978.68e24de8.js +1 -0
- package/__mf/js/async/8035.ce79a5fb.js +38 -0
- package/__mf/js/async/8356.4c9d459d.js +1 -0
- package/__mf/js/async/8470.84ab0006.js +2 -0
- package/__mf/js/async/8580.fc8466c9.js +1 -0
- package/__mf/js/async/873.e471eddb.js +1 -0
- package/__mf/js/async/8988.c5f79a01.js +1 -0
- package/__mf/js/async/9184.a0c2523b.js +1 -0
- package/__mf/js/async/9235.e08df974.js +1 -0
- package/__mf/js/async/941.9922745e.js +2 -0
- package/__mf/js/async/9588.aa754dda.js +1 -0
- package/__mf/js/async/9836.be31231c.js +1 -0
- package/__mf/js/async/__federation_expose_TempoDatasource.a0c321ab.js +2 -0
- package/__mf/js/async/__federation_expose_TempoExplorer.79065666.js +1 -0
- package/__mf/js/async/__federation_expose_TempoTraceQuery.e1786579.js +1 -0
- package/__mf/js/async/lib-router.4c755752.js +2 -0
- package/__mf/js/main.db74e654.js +6 -0
- package/lib/bootstrap.js +1 -1
- package/lib/bootstrap.js.map +1 -1
- package/lib/cjs/components/complete.js +4 -4
- package/lib/cjs/explore/TempoExplorer.js +12 -4
- package/lib/cjs/explore/links.js +15 -15
- package/lib/cjs/index-federation.js +12 -12
- package/lib/cjs/model/api-types.js +7 -0
- package/lib/cjs/model/tempo-client.js +7 -7
- package/lib/cjs/model/tempo-selectors.js +5 -5
- package/lib/cjs/plugins/tempo-trace-query/TempoTraceQueryEditor.js +14 -27
- package/lib/cjs/plugins/tempo-trace-query/get-trace-data.js +35 -24
- package/lib/cjs/test/mock-data.js +10 -8
- package/lib/components/AttributeFilters.js +1 -1
- package/lib/components/AttributeFilters.js.map +1 -1
- package/lib/components/TraceQLEditor.js +1 -1
- package/lib/components/TraceQLEditor.js.map +1 -1
- package/lib/explore/TempoExplorer.d.ts.map +1 -1
- package/lib/explore/TempoExplorer.js +14 -6
- package/lib/explore/TempoExplorer.js.map +1 -1
- package/lib/model/api-types.d.ts +1 -0
- package/lib/model/api-types.d.ts.map +1 -1
- package/lib/model/api-types.js +1 -1
- package/lib/model/api-types.js.map +1 -1
- package/lib/plugins/TempoDatasourceEditor.js +1 -1
- package/lib/plugins/TempoDatasourceEditor.js.map +1 -1
- package/lib/plugins/tempo-trace-query/TempoTraceQueryEditor.d.ts.map +1 -1
- package/lib/plugins/tempo-trace-query/TempoTraceQueryEditor.js +6 -19
- package/lib/plugins/tempo-trace-query/TempoTraceQueryEditor.js.map +1 -1
- package/lib/plugins/tempo-trace-query/get-trace-data.d.ts.map +1 -1
- package/lib/plugins/tempo-trace-query/get-trace-data.js +32 -21
- package/lib/plugins/tempo-trace-query/get-trace-data.js.map +1 -1
- package/lib/test/mock-data.js +3 -1
- package/lib/test/mock-data.js.map +1 -1
- package/mf-manifest.json +101 -93
- package/mf-stats.json +103 -93
- package/package.json +9 -9
- package/__mf/js/Tempo.146e84b3.js +0 -5
- package/__mf/js/async/1197.850698db.js +0 -1
- package/__mf/js/async/1576.1cf74df0.js +0 -1
- package/__mf/js/async/2178.6b2e432f.js +0 -2
- package/__mf/js/async/2188.685c7491.js +0 -2
- package/__mf/js/async/2292.75e9aa11.js +0 -2
- package/__mf/js/async/2472.cc8dcf44.js +0 -22
- package/__mf/js/async/2972.32076d91.js +0 -101
- package/__mf/js/async/3224.ce173388.js +0 -1
- package/__mf/js/async/3863.8d56ecec.js +0 -2
- package/__mf/js/async/3960.401ff0b0.js +0 -2
- package/__mf/js/async/3980.4d5490b2.js +0 -2
- package/__mf/js/async/4075.edf1dc62.js +0 -1
- package/__mf/js/async/4238.9b78e9fe.js +0 -1
- package/__mf/js/async/4269.0cfaf9bb.js +0 -2
- package/__mf/js/async/4310.7407645f.js +0 -7
- package/__mf/js/async/4421.5f2a2324.js +0 -1
- package/__mf/js/async/4535.72cddf33.js +0 -1
- package/__mf/js/async/5266.1c520126.js +0 -10
- package/__mf/js/async/5409.676a5f3f.js +0 -1
- package/__mf/js/async/5790.b4d4134d.js +0 -1
- package/__mf/js/async/5981.c6edce96.js +0 -2
- package/__mf/js/async/6134.a2707cf7.js +0 -38
- package/__mf/js/async/6292.463b4f49.js +0 -1
- package/__mf/js/async/6333.367d6758.js +0 -2
- package/__mf/js/async/6527.5341d09f.js +0 -2
- package/__mf/js/async/6620.c48ce7b1.js +0 -2
- package/__mf/js/async/6770.d9c238f2.js +0 -1
- package/__mf/js/async/694.c2c37771.js +0 -1
- package/__mf/js/async/7376.588b7a17.js +0 -1
- package/__mf/js/async/738.93d35dc9.js +0 -1
- package/__mf/js/async/7569.842552f0.js +0 -1
- package/__mf/js/async/7740.0500bfc6.js +0 -1
- package/__mf/js/async/800.7f3113d0.js +0 -2
- package/__mf/js/async/8216.2f92a883.js +0 -1
- package/__mf/js/async/8488.6c9a25e4.js +0 -1
- package/__mf/js/async/8597.d5ba4ca7.js +0 -1
- package/__mf/js/async/9173.69dc268d.js +0 -2
- package/__mf/js/async/__federation_expose_TempoDatasource.9aa3663e.js +0 -2
- package/__mf/js/async/__federation_expose_TempoExplorer.354aef77.js +0 -2
- package/__mf/js/async/__federation_expose_TempoTraceQuery.810d0c2c.js +0 -1
- package/__mf/js/async/lib-router.312ca028.js +0 -2
- package/__mf/js/main.b263c225.js +0 -5
- /package/__mf/css/async/{1576.d3010b86.css → 1233.d3010b86.css} +0 -0
- /package/__mf/css/async/{2188.d3010b86.css → 6110.d3010b86.css} +0 -0
- /package/__mf/css/async/{2341.d3010b86.css → 6258.d3010b86.css} +0 -0
- /package/__mf/js/async/{2472.cc8dcf44.js.LICENSE.txt → 1490.cc0a832d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2292.75e9aa11.js.LICENSE.txt → 2043.5826341c.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2188.685c7491.js.LICENSE.txt → 2386.53c46472.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3863.8d56ecec.js.LICENSE.txt → 2545.d42b194b.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4269.0cfaf9bb.js.LICENSE.txt → 3181.b5749ad3.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5266.1c520126.js.LICENSE.txt → 3617.32db58a8.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4310.7407645f.js.LICENSE.txt → 3849.d1b5a7aa.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5981.c6edce96.js.LICENSE.txt → 392.fd3eade4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1964.e6c5b93b.js.LICENSE.txt → 4121.fae8ac21.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2178.6b2e432f.js.LICENSE.txt → 4746.c0ce20c6.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6333.367d6758.js.LICENSE.txt → 4783.97c4e55a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6527.5341d09f.js.LICENSE.txt → 4793.4fc513d0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6620.c48ce7b1.js.LICENSE.txt → 5214.d2077bec.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{800.7f3113d0.js.LICENSE.txt → 6258.212dc324.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3960.401ff0b0.js.LICENSE.txt → 6274.eff58da4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3980.4d5490b2.js.LICENSE.txt → 6283.3c7349ec.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9173.69dc268d.js.LICENSE.txt → 8470.84ab0006.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_TempoDatasource.9aa3663e.js.LICENSE.txt → 941.9922745e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_TempoExplorer.354aef77.js.LICENSE.txt → __federation_expose_TempoDatasource.a0c321ab.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.312ca028.js.LICENSE.txt → lib-router.4c755752.js.LICENSE.txt} +0 -0
|
@@ -17,14 +17,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
function _export(target, all) {
|
|
18
18
|
for(var name in all)Object.defineProperty(target, name, {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: all
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
getTraceData
|
|
24
|
+
get getTraceData () {
|
|
25
25
|
return getTraceData;
|
|
26
26
|
},
|
|
27
|
-
getUnixTimeRange
|
|
27
|
+
get getUnixTimeRange () {
|
|
28
28
|
return getUnixTimeRange;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -32,6 +32,7 @@ const _core = require("@perses-dev/core");
|
|
|
32
32
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
33
33
|
const _datefns = require("date-fns");
|
|
34
34
|
const _model = require("../../model");
|
|
35
|
+
const _apitypes = require("../../model/api-types");
|
|
35
36
|
function getUnixTimeRange(timeRange) {
|
|
36
37
|
const { start, end } = timeRange;
|
|
37
38
|
return {
|
|
@@ -53,21 +54,6 @@ const getTraceData = async (spec, context)=>{
|
|
|
53
54
|
const listDatasourceSelectItems = await context.datasourceStore.listDatasourceSelectItems(_model.TEMPO_DATASOURCE_KIND);
|
|
54
55
|
const datasourceSelector = (0, _pluginsystem.datasourceSelectValueToSelector)(spec.datasource, context.variableState, listDatasourceSelectItems) ?? defaultTempoDatasource;
|
|
55
56
|
const client = await context.datasourceStore.getDatasourceClient(datasourceSelector);
|
|
56
|
-
const getQuery = ()=>{
|
|
57
|
-
const params = {
|
|
58
|
-
q: spec.query
|
|
59
|
-
};
|
|
60
|
-
// handle time range selection from UI drop down (e.g. last 5 minutes, last 1 hour )
|
|
61
|
-
if (context.absoluteTimeRange) {
|
|
62
|
-
const { start, end } = getUnixTimeRange(context.absoluteTimeRange);
|
|
63
|
-
params.start = start;
|
|
64
|
-
params.end = end;
|
|
65
|
-
}
|
|
66
|
-
if (spec.limit) {
|
|
67
|
-
params.limit = spec.limit;
|
|
68
|
-
}
|
|
69
|
-
return params;
|
|
70
|
-
};
|
|
71
57
|
/**
|
|
72
58
|
* determine type of query:
|
|
73
59
|
* if the query is a valid traceId, fetch the trace by traceId
|
|
@@ -83,11 +69,37 @@ const getTraceData = async (spec, context)=>{
|
|
|
83
69
|
}
|
|
84
70
|
};
|
|
85
71
|
} else {
|
|
86
|
-
const
|
|
72
|
+
const params = {
|
|
73
|
+
q: spec.query
|
|
74
|
+
};
|
|
75
|
+
// handle time range selection from UI drop down (e.g. last 5 minutes, last 1 hour )
|
|
76
|
+
if (context.absoluteTimeRange) {
|
|
77
|
+
const { start, end } = getUnixTimeRange(context.absoluteTimeRange);
|
|
78
|
+
params.start = start;
|
|
79
|
+
params.end = end;
|
|
80
|
+
}
|
|
81
|
+
// Fetch one more trace than requested.
|
|
82
|
+
// This way we can check if there are more traces available matching the search request, and show a notice to the user.
|
|
83
|
+
const limit = spec.limit ?? _apitypes.DEFAULT_SEARCH_LIMIT;
|
|
84
|
+
params.limit = limit + 1;
|
|
85
|
+
const response = await client.searchWithFallback(params);
|
|
86
|
+
const searchResult = parseSearchResponse(response);
|
|
87
|
+
const hasMoreResults = searchResult.length > limit;
|
|
88
|
+
const notices = [];
|
|
89
|
+
if (hasMoreResults) {
|
|
90
|
+
notices.push({
|
|
91
|
+
type: 'info',
|
|
92
|
+
message: 'Not all matching traces are currently displayed. Increase the result limit to view additional traces.'
|
|
93
|
+
});
|
|
94
|
+
// Remove the extra element, i.e. do not return more results than requested.
|
|
95
|
+
searchResult.splice(limit);
|
|
96
|
+
}
|
|
87
97
|
return {
|
|
88
|
-
searchResult
|
|
98
|
+
searchResult,
|
|
89
99
|
metadata: {
|
|
90
|
-
executedQueryString: spec.query
|
|
100
|
+
executedQueryString: spec.query,
|
|
101
|
+
hasMoreResults,
|
|
102
|
+
notices
|
|
91
103
|
}
|
|
92
104
|
};
|
|
93
105
|
}
|
|
@@ -98,8 +110,7 @@ function parseTraceResponse(response) {
|
|
|
98
110
|
};
|
|
99
111
|
// Tempo returns Trace ID and Span ID base64-encoded.
|
|
100
112
|
// The OTLP spec defines the encoding in the hex format:
|
|
101
|
-
// Spec: https://opentelemetry.io/docs/specs/
|
|
102
|
-
// Example: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.7.0/examples/trace.json
|
|
113
|
+
// Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#retrieving-the-traceid-and-spanid
|
|
103
114
|
// Therefore, let's convert it to hex encoding.
|
|
104
115
|
for (const resourceSpan of trace.resourceSpans){
|
|
105
116
|
for (const scopeSpan of resourceSpan.scopeSpans){
|
|
@@ -128,7 +139,7 @@ function parseTraceResponse(response) {
|
|
|
128
139
|
}
|
|
129
140
|
function base64ToHex(str) {
|
|
130
141
|
try {
|
|
131
|
-
return atob(str).split('').map((char)=>char.charCodeAt(0).toString(16).padStart(2, '0')
|
|
142
|
+
return atob(str).split('').map((char)=>char.charCodeAt(0).toString(16).padStart(2, '0')).join('');
|
|
132
143
|
} catch {
|
|
133
144
|
return str;
|
|
134
145
|
}
|
|
@@ -17,26 +17,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
function _export(target, all) {
|
|
18
18
|
for(var name in all)Object.defineProperty(target, name, {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: all
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
MOCK_SEARCH_RESPONSE_MIXED_VPARQUET3_AND_4
|
|
24
|
+
get MOCK_SEARCH_RESPONSE_MIXED_VPARQUET3_AND_4 () {
|
|
25
25
|
return MOCK_SEARCH_RESPONSE_MIXED_VPARQUET3_AND_4;
|
|
26
26
|
},
|
|
27
|
-
MOCK_SEARCH_RESPONSE_VPARQUET3
|
|
27
|
+
get MOCK_SEARCH_RESPONSE_VPARQUET3 () {
|
|
28
28
|
return MOCK_SEARCH_RESPONSE_VPARQUET3;
|
|
29
29
|
},
|
|
30
|
-
MOCK_SEARCH_RESPONSE_VPARQUET4
|
|
30
|
+
get MOCK_SEARCH_RESPONSE_VPARQUET4 () {
|
|
31
31
|
return MOCK_SEARCH_RESPONSE_VPARQUET4;
|
|
32
32
|
},
|
|
33
|
-
MOCK_TRACE_DATA_SEARCHRESULT
|
|
33
|
+
get MOCK_TRACE_DATA_SEARCHRESULT () {
|
|
34
34
|
return MOCK_TRACE_DATA_SEARCHRESULT;
|
|
35
35
|
},
|
|
36
|
-
MOCK_TRACE_RESPONSE
|
|
36
|
+
get MOCK_TRACE_RESPONSE () {
|
|
37
37
|
return MOCK_TRACE_RESPONSE;
|
|
38
38
|
},
|
|
39
|
-
MOCK_TRACE_RESPONSE_SMALL
|
|
39
|
+
get MOCK_TRACE_RESPONSE_SMALL () {
|
|
40
40
|
return MOCK_TRACE_RESPONSE_SMALL;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -2446,6 +2446,8 @@ const MOCK_TRACE_DATA_SEARCHRESULT = {
|
|
|
2446
2446
|
}
|
|
2447
2447
|
],
|
|
2448
2448
|
metadata: {
|
|
2449
|
-
executedQueryString: 'duration > 900ms'
|
|
2449
|
+
executedQueryString: 'duration > 900ms',
|
|
2450
|
+
hasMoreResults: false,
|
|
2451
|
+
notices: []
|
|
2450
2452
|
}
|
|
2451
2453
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
// Copyright 2025 The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { useCallback, useEffect, useState } from 'react';
|
|
15
15
|
import { Autocomplete, Checkbox, Stack, TextField } from '@mui/material';
|
|
16
16
|
import { useTimeRange } from '@perses-dev/plugin-system';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/AttributeFilters.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement, SyntheticEvent, useCallback, useEffect, useState } from 'react';\nimport { Autocomplete, Checkbox, Stack, TextField, TextFieldProps } from '@mui/material';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { useQuery } from '@tanstack/react-query';\nimport { TempoClient } from '../model';\nimport { getUnixTimeRange } from '../plugins/tempo-trace-query/get-trace-data';\nimport { filterToTraceQL } from './filter/filter_to_traceql';\nimport { traceQLToFilter } from './filter/traceql_to_filter';\nimport { DurationField, Filter, splitByUnquotedWhitespace } from './filter/filter';\n\nconst statusOptions = ['unset', 'ok', 'error'];\n\nexport interface AttributeFiltersProps {\n client?: TempoClient;\n query: string;\n setQuery: (x: string) => void;\n}\n\nexport function AttributeFilters(props: AttributeFiltersProps): ReactElement {\n const { client, query, setQuery } = props;\n\n const filter = traceQLToFilter(query);\n const setFilter = (filter: Filter) => {\n setQuery(filterToTraceQL(filter));\n };\n\n const { absoluteTimeRange } = useTimeRange();\n const { start, end } = getUnixTimeRange(absoluteTimeRange);\n\n const { data: serviceNameOptions } = useTagValues(\n client,\n 'resource.service.name',\n filterToTraceQL({ ...filter, serviceName: [] }),\n start,\n end\n );\n const { data: spanNameOptions } = useTagValues(\n client,\n 'name',\n filterToTraceQL({ ...filter, spanName: [] }),\n start,\n end\n );\n\n return (\n <>\n <StringAttributeFilter\n label=\"Service Name\"\n options={serviceNameOptions ?? []}\n value={filter.serviceName}\n setValue={(x) => setFilter({ ...filter, serviceName: x })}\n />\n <StringAttributeFilter\n label=\"Span Name\"\n options={spanNameOptions ?? []}\n value={filter.spanName}\n setValue={(x) => setFilter({ ...filter, spanName: x })}\n />\n <StringAttributeFilter\n label=\"Status\"\n width={210}\n options={statusOptions ?? []}\n value={filter.status}\n setValue={(x) => setFilter({ ...filter, status: x })}\n />\n <DurationAttributeFilter\n label=\"Trace Duration\"\n value={filter.traceDuration}\n setValue={(value) => setFilter({ ...filter, traceDuration: value })}\n />\n <CustomAttributesFilter\n label=\"Custom Attributes\"\n value={filter.customMatchers}\n setValue={(value) => setFilter({ ...filter, customMatchers: value })}\n />\n </>\n );\n}\n\ninterface StringAttributeFilterProps {\n label: string;\n width?: number;\n options: string[];\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction StringAttributeFilter(props: StringAttributeFilterProps) {\n const { label, width, options, value, setValue } = props;\n\n return (\n <Autocomplete\n multiple\n size=\"small\"\n limitTags={1}\n disableCloseOnSelect\n value={value}\n onChange={(_event: SyntheticEvent, newValue: string[]) => setValue(newValue)}\n options={options}\n renderOption={(props, option, { selected }) => {\n const { key, ...optionProps } = props;\n return (\n <li key={key} {...optionProps}>\n <Checkbox style={{ marginRight: 8 }} checked={selected} />\n {option}\n </li>\n );\n }}\n renderInput={(params) => <TextField {...params} label={label} />}\n // Reduce the size of the chips to make space for the <input> element, the +X text and the X button to avoid a line break.\n // See https://github.com/mui/material-ui/issues/38835 for more details.\n slotProps={{ chip: { sx: { maxWidth: 'calc(100% - 45px) !important' } } }}\n // Reduce the size of the <input> field\n sx={{ width: width ?? 250, '& input': { minWidth: '5px !important' } }}\n />\n );\n}\n\ninterface DurationAttributeFilterProps {\n label: string;\n value: DurationField;\n setValue: (value: DurationField) => void;\n}\n\nfunction DurationAttributeFilter(props: DurationAttributeFilterProps) {\n const { label, value, setValue } = props;\n const { min, max } = value;\n\n return (\n <Stack direction=\"row\" gap={0.5}>\n <DurationTextInput label={`Min ${label}`} value={min ?? ''} setValue={(min) => setValue({ min, max })} />\n <DurationTextInput label={`Max ${label}`} value={max ?? ''} setValue={(max) => setValue({ min, max })} />\n </Stack>\n );\n}\n\nconst durationFormatRegex = /^([0-9]+\\.)?[0-9]+(ns|ms|s|m|h)$/;\n\ninterface DurationTextInputProps {\n label: string;\n value: string;\n setValue: (value: string) => void;\n}\n\nfunction DurationTextInput(props: DurationTextInputProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n value={value}\n setValue={setValue}\n validationRegex={durationFormatRegex}\n validationFailedMessage=\"Invalid format. Accepted format e.g. 100ms, accepted units: ns, ms, s, m, h\"\n sx={{ width: 150 }}\n />\n );\n}\n\ninterface CustomAttributesFilterProps {\n label: string;\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction CustomAttributesFilter(props: CustomAttributesFilterProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n placeholder='span.http.status_code=200 span.http.method=\"GET\"'\n value={value.join(' ')}\n setValue={(x) => setValue(splitByUnquotedWhitespace(x))}\n sx={{ flexGrow: 1 }}\n />\n );\n}\n\ninterface LazyTextInputProps extends Omit<TextFieldProps, 'variant'> {\n validationRegex?: RegExp;\n validationFailedMessage?: string;\n value: string;\n setValue: (value: string) => void;\n}\n\n/** A <TextField> which calls props.setValue when the input field is blurred and the validation passes. */\nfunction LazyTextInput(props: LazyTextInputProps) {\n const { validationRegex, validationFailedMessage, value, setValue, ...otherProps } = props;\n const [draftValue, setDraftValue] = useState(value);\n const isValidInput = draftValue == '' || validationRegex == undefined || validationRegex.test(draftValue);\n\n useEffect(() => {\n setDraftValue(value);\n }, [value, setDraftValue]);\n\n const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setDraftValue(event.target.value);\n }, []);\n\n const handleBlur = useCallback(() => {\n if (isValidInput) {\n setValue(draftValue);\n }\n }, [isValidInput, setValue, draftValue]);\n\n return (\n <TextField\n {...otherProps}\n error={!isValidInput}\n helperText={isValidInput ? undefined : validationFailedMessage}\n value={draftValue}\n onChange={handleChange}\n onBlur={handleBlur}\n />\n );\n}\n\nfunction useTagValues(client: TempoClient | undefined, tag: string, query: string, start?: number, end?: number) {\n return useQuery({\n queryKey: ['useTagValues', client, tag, query, start, end],\n enabled: !!client,\n queryFn: async function () {\n if (!client) return;\n const values = await client.searchTagValues({ tag, q: query, start, end });\n return values.tagValues.map((tagValue) => tagValue.value ?? '').sort();\n },\n staleTime: 60 * 1000, // cache tag value response for 1m\n });\n}\n"],"names":["useCallback","useEffect","useState","Autocomplete","Checkbox","Stack","TextField","useTimeRange","useQuery","getUnixTimeRange","filterToTraceQL","traceQLToFilter","splitByUnquotedWhitespace","statusOptions","AttributeFilters","props","client","query","setQuery","filter","setFilter","absoluteTimeRange","start","end","data","serviceNameOptions","useTagValues","serviceName","spanNameOptions","spanName","StringAttributeFilter","label","options","value","setValue","x","width","status","DurationAttributeFilter","traceDuration","CustomAttributesFilter","customMatchers","multiple","size","limitTags","disableCloseOnSelect","onChange","_event","newValue","renderOption","option","selected","key","optionProps","li","style","marginRight","checked","renderInput","params","slotProps","chip","sx","maxWidth","minWidth","min","max","direction","gap","DurationTextInput","durationFormatRegex","LazyTextInput","validationRegex","validationFailedMessage","placeholder","join","flexGrow","otherProps","draftValue","setDraftValue","isValidInput","undefined","test","handleChange","event","target","handleBlur","error","helperText","onBlur","tag","queryKey","enabled","queryFn","values","searchTagValues","q","tagValues","map","tagValue","sort","staleTime"],"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,SAAuCA,WAAW,EAAEC,SAAS,E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EAAE,GAAG2C,YAAY,GAAG9D;IACrF,MAAM,CAAC+D,YAAYC,cAAc,GAAG7E,SAAS+B;IAC7C,MAAM+C,eAAeF,cAAc,MAAMN,mBAAmBS,aAAaT,gBAAgBU,IAAI,CAACJ;IAE9F7E,UAAU;QACR8E,cAAc9C;IAChB,GAAG;QAACA;QAAO8C;KAAc;IAEzB,MAAMI,eAAenF,YAAY,CAACoF;QAChCL,cAAcK,MAAMC,MAAM,CAACpD,KAAK;IAClC,GAAG,EAAE;IAEL,MAAMqD,aAAatF,YAAY;QAC7B,IAAIgF,cAAc;YAChB9C,SAAS4C;QACX;IACF,GAAG;QAACE;QAAc9C;QAAU4C;KAAW;IAEvC,qBACE,KAACxE;QACE,GAAGuE,UAAU;QACdU,OAAO,CAACP;QACRQ,YAAYR,eAAeC,YAAYR;QACvCxC,OAAO6C;QACPhC,UAAUqC;QACVM,QAAQH;;AAGd;AAEA,SAAS5D,aAAaV,MAA+B,EAAE0E,GAAW,EAAEzE,KAAa,EAAEK,KAAc,EAAEC,GAAY;IAC7G,OAAOf,SAAS;QACdmF,UAAU;YAAC;YAAgB3E;YAAQ0E;YAAKzE;YAAOK;YAAOC;SAAI;QAC1DqE,SAAS,CAAC,CAAC5E;QACX6E,SAAS;YACP,IAAI,CAAC7E,QAAQ;YACb,MAAM8E,SAAS,MAAM9E,OAAO+E,eAAe,CAAC;gBAAEL;gBAAKM,GAAG/E;gBAAOK;gBAAOC;YAAI;YACxE,OAAOuE,OAAOG,SAAS,CAACC,GAAG,CAAC,CAACC,WAAaA,SAASlE,KAAK,IAAI,IAAImE,IAAI;QACtE;QACAC,WAAW,KAAK;IAClB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AttributeFilters.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement, SyntheticEvent, useCallback, useEffect, useState } from 'react';\nimport { Autocomplete, Checkbox, Stack, TextField, TextFieldProps } from '@mui/material';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { useQuery } from '@tanstack/react-query';\nimport { TempoClient } from '../model';\nimport { getUnixTimeRange } from '../plugins/tempo-trace-query/get-trace-data';\nimport { filterToTraceQL } from './filter/filter_to_traceql';\nimport { traceQLToFilter } from './filter/traceql_to_filter';\nimport { DurationField, Filter, splitByUnquotedWhitespace } from './filter/filter';\n\nconst statusOptions = ['unset', 'ok', 'error'];\n\nexport interface AttributeFiltersProps {\n client?: TempoClient;\n query: string;\n setQuery: (x: string) => void;\n}\n\nexport function AttributeFilters(props: AttributeFiltersProps): ReactElement {\n const { client, query, setQuery } = props;\n\n const filter = traceQLToFilter(query);\n const setFilter = (filter: Filter) => {\n setQuery(filterToTraceQL(filter));\n };\n\n const { absoluteTimeRange } = useTimeRange();\n const { start, end } = getUnixTimeRange(absoluteTimeRange);\n\n const { data: serviceNameOptions } = useTagValues(\n client,\n 'resource.service.name',\n filterToTraceQL({ ...filter, serviceName: [] }),\n start,\n end\n );\n const { data: spanNameOptions } = useTagValues(\n client,\n 'name',\n filterToTraceQL({ ...filter, spanName: [] }),\n start,\n end\n );\n\n return (\n <>\n <StringAttributeFilter\n label=\"Service Name\"\n options={serviceNameOptions ?? []}\n value={filter.serviceName}\n setValue={(x) => setFilter({ ...filter, serviceName: x })}\n />\n <StringAttributeFilter\n label=\"Span Name\"\n options={spanNameOptions ?? []}\n value={filter.spanName}\n setValue={(x) => setFilter({ ...filter, spanName: x })}\n />\n <StringAttributeFilter\n label=\"Status\"\n width={210}\n options={statusOptions ?? []}\n value={filter.status}\n setValue={(x) => setFilter({ ...filter, status: x })}\n />\n <DurationAttributeFilter\n label=\"Trace Duration\"\n value={filter.traceDuration}\n setValue={(value) => setFilter({ ...filter, traceDuration: value })}\n />\n <CustomAttributesFilter\n label=\"Custom Attributes\"\n value={filter.customMatchers}\n setValue={(value) => setFilter({ ...filter, customMatchers: value })}\n />\n </>\n );\n}\n\ninterface StringAttributeFilterProps {\n label: string;\n width?: number;\n options: string[];\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction StringAttributeFilter(props: StringAttributeFilterProps) {\n const { label, width, options, value, setValue } = props;\n\n return (\n <Autocomplete\n multiple\n size=\"small\"\n limitTags={1}\n disableCloseOnSelect\n value={value}\n onChange={(_event: SyntheticEvent, newValue: string[]) => setValue(newValue)}\n options={options}\n renderOption={(props, option, { selected }) => {\n const { key, ...optionProps } = props;\n return (\n <li key={key} {...optionProps}>\n <Checkbox style={{ marginRight: 8 }} checked={selected} />\n {option}\n </li>\n );\n }}\n renderInput={(params) => <TextField {...params} label={label} />}\n // Reduce the size of the chips to make space for the <input> element, the +X text and the X button to avoid a line break.\n // See https://github.com/mui/material-ui/issues/38835 for more details.\n slotProps={{ chip: { sx: { maxWidth: 'calc(100% - 45px) !important' } } }}\n // Reduce the size of the <input> field\n sx={{ width: width ?? 250, '& input': { minWidth: '5px !important' } }}\n />\n );\n}\n\ninterface DurationAttributeFilterProps {\n label: string;\n value: DurationField;\n setValue: (value: DurationField) => void;\n}\n\nfunction DurationAttributeFilter(props: DurationAttributeFilterProps) {\n const { label, value, setValue } = props;\n const { min, max } = value;\n\n return (\n <Stack direction=\"row\" gap={0.5}>\n <DurationTextInput label={`Min ${label}`} value={min ?? ''} setValue={(min) => setValue({ min, max })} />\n <DurationTextInput label={`Max ${label}`} value={max ?? ''} setValue={(max) => setValue({ min, max })} />\n </Stack>\n );\n}\n\nconst durationFormatRegex = /^([0-9]+\\.)?[0-9]+(ns|ms|s|m|h)$/;\n\ninterface DurationTextInputProps {\n label: string;\n value: string;\n setValue: (value: string) => void;\n}\n\nfunction DurationTextInput(props: DurationTextInputProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n value={value}\n setValue={setValue}\n validationRegex={durationFormatRegex}\n validationFailedMessage=\"Invalid format. Accepted format e.g. 100ms, accepted units: ns, ms, s, m, h\"\n sx={{ width: 150 }}\n />\n );\n}\n\ninterface CustomAttributesFilterProps {\n label: string;\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction CustomAttributesFilter(props: CustomAttributesFilterProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n placeholder='span.http.status_code=200 span.http.method=\"GET\"'\n value={value.join(' ')}\n setValue={(x) => setValue(splitByUnquotedWhitespace(x))}\n sx={{ flexGrow: 1 }}\n />\n );\n}\n\ninterface LazyTextInputProps extends Omit<TextFieldProps, 'variant'> {\n validationRegex?: RegExp;\n validationFailedMessage?: string;\n value: string;\n setValue: (value: string) => void;\n}\n\n/** A <TextField> which calls props.setValue when the input field is blurred and the validation passes. */\nfunction LazyTextInput(props: LazyTextInputProps) {\n const { validationRegex, validationFailedMessage, value, setValue, ...otherProps } = props;\n const [draftValue, setDraftValue] = useState(value);\n const isValidInput = draftValue == '' || validationRegex == undefined || validationRegex.test(draftValue);\n\n useEffect(() => {\n setDraftValue(value);\n }, [value, setDraftValue]);\n\n const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setDraftValue(event.target.value);\n }, []);\n\n const handleBlur = useCallback(() => {\n if (isValidInput) {\n setValue(draftValue);\n }\n }, [isValidInput, setValue, draftValue]);\n\n return (\n <TextField\n {...otherProps}\n error={!isValidInput}\n helperText={isValidInput ? undefined : validationFailedMessage}\n value={draftValue}\n onChange={handleChange}\n onBlur={handleBlur}\n />\n );\n}\n\nfunction useTagValues(client: TempoClient | undefined, tag: string, query: string, start?: number, end?: number) {\n return useQuery({\n queryKey: ['useTagValues', client, tag, query, start, end],\n enabled: !!client,\n queryFn: async function () {\n if (!client) return;\n const values = await client.searchTagValues({ tag, q: query, start, end });\n return values.tagValues.map((tagValue) => tagValue.value ?? '').sort();\n },\n staleTime: 60 * 1000, // cache tag value response for 1m\n });\n}\n"],"names":["useCallback","useEffect","useState","Autocomplete","Checkbox","Stack","TextField","useTimeRange","useQuery","getUnixTimeRange","filterToTraceQL","traceQLToFilter","splitByUnquotedWhitespace","statusOptions","AttributeFilters","props","client","query","setQuery","filter","setFilter","absoluteTimeRange","start","end","data","serviceNameOptions","useTagValues","serviceName","spanNameOptions","spanName","StringAttributeFilter","label","options","value","setValue","x","width","status","DurationAttributeFilter","traceDuration","CustomAttributesFilter","customMatchers","multiple","size","limitTags","disableCloseOnSelect","onChange","_event","newValue","renderOption","option","selected","key","optionProps","li","style","marginRight","checked","renderInput","params","slotProps","chip","sx","maxWidth","minWidth","min","max","direction","gap","DurationTextInput","durationFormatRegex","LazyTextInput","validationRegex","validationFailedMessage","placeholder","join","flexGrow","otherProps","draftValue","setDraftValue","isValidInput","undefined","test","handleChange","event","target","handleBlur","error","helperText","onBlur","tag","queryKey","enabled","queryFn","values","searchTagValues","q","tagValues","map","tagValue","sort","staleTime"],"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,SAAuCA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AACvF,SAASC,YAAY,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,SAAS,QAAwB,gBAAgB;AACzF,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,QAAQ,QAAQ,wBAAwB;AAEjD,SAASC,gBAAgB,QAAQ,8CAA8C;AAC/E,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAAgCC,yBAAyB,QAAQ,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AE;IAEL,MAAMqD,aAAatF,YAAY;QAC7B,IAAIgF,cAAc;YAChB9C,SAAS4C;QACX;IACF,GAAG;QAACE;QAAc9C;QAAU4C;KAAW;IAEvC,qBACE,KAACxE;QACE,GAAGuE,UAAU;QACdU,OAAO,CAACP;QACRQ,YAAYR,eAAeC,YAAYR;QACvCxC,OAAO6C;QACPhC,UAAUqC;QACVM,QAAQH;;AAGd;AAEA,SAAS5D,aAAaV,MAA+B,EAAE0E,GAAW,EAAEzE,KAAa,EAAEK,KAAc,EAAEC,GAAY;IAC7G,OAAOf,SAAS;QACdmF,UAAU;YAAC;YAAgB3E;YAAQ0E;YAAKzE;YAAOK;YAAOC;SAAI;QAC1DqE,SAAS,CAAC,CAAC5E;QACX6E,SAAS;YACP,IAAI,CAAC7E,QAAQ;YACb,MAAM8E,SAAS,MAAM9E,OAAO+E,eAAe,CAAC;gBAAEL;gBAAKM,GAAG/E;gBAAOK;gBAAOC;YAAI;YACxE,OAAOuE,OAAOG,SAAS,CAACC,GAAG,CAAC,CAACC,WAAaA,SAASlE,KAAK,IAAI,IAAImE,IAAI;QACtE;QACAC,WAAW,KAAK;IAClB;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
// Copyright 2025 The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { useMemo } from 'react';
|
|
15
15
|
import { InputLabel, Stack, useTheme } from '@mui/material';
|
|
16
16
|
import CodeMirror, { EditorView } from '@uiw/react-codemirror';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TraceQLEditor.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement, useMemo } from 'react';\nimport { InputLabel, Stack, useTheme } from '@mui/material';\nimport CodeMirror, { EditorView, ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { isValidTraceId } from '@perses-dev/core';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { TempoClient } from '../model';\nimport { TraceQLExtension } from './TraceQLExtension';\n\nexport interface TraceQLEditorProps extends Omit<ReactCodeMirrorProps, 'theme' | 'extensions'> {\n client?: TempoClient;\n}\n\nexport function TraceQLEditor({ client, ...rest }: TraceQLEditorProps): ReactElement {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const { absoluteTimeRange } = useTimeRange();\n const traceQLExtension = useMemo(() => {\n return TraceQLExtension({ client, timeRange: absoluteTimeRange });\n }, [client, absoluteTimeRange]);\n\n const codemirrorTheme = useMemo(() => {\n // https://github.com/mui/material-ui/blob/v5.16.7/packages/mui-material/src/OutlinedInput/OutlinedInput.js#L43\n const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';\n\n return EditorView.theme({\n '&': {\n backgroundColor: 'transparent !important', // required for dark mode\n border: `1px solid ${borderColor}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n },\n '&.cm-focused.cm-editor': {\n outline: 'none', // remove dotted outline on focus\n },\n '.cm-content': {\n padding: '8px',\n },\n });\n }, [theme]);\n\n return (\n <Stack position=\"relative\" sx={{ flexGrow: 1 }}>\n <InputLabel // reproduce the same kind of input label that regular MUI TextFields have\n shrink\n sx={{\n position: 'absolute',\n top: '-6px',\n left: '10px',\n padding: '0 4px',\n color: theme.palette.text.primary,\n backgroundColor: theme.palette.background.default,\n zIndex: 1,\n }}\n >\n TraceQL Expression\n </InputLabel>\n <CodeMirror\n {...rest}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n lineNumbers: false,\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n // The explore view accepts either a TraceQL query or a Trace ID as input. The lezer grammar marks Trace IDs as invalid,\n // therefore let's disable syntax highlighting if the input is a Trace ID.\n syntaxHighlighting: !isValidTraceId(rest.value ?? ''),\n }}\n extensions={[EditorView.lineWrapping, traceQLExtension, codemirrorTheme]}\n placeholder='Example: {span.http.method = \"GET\"}'\n />\n </Stack>\n );\n}\n"],"names":["useMemo","InputLabel","Stack","useTheme","CodeMirror","EditorView","isValidTraceId","useTimeRange","TraceQLExtension","TraceQLEditor","client","rest","theme","isDarkMode","palette","mode","absoluteTimeRange","traceQLExtension","timeRange","codemirrorTheme","borderColor","backgroundColor","border","borderRadius","shape","outline","padding","position","sx","flexGrow","shrink","top","left","color","text","primary","background","default","zIndex","basicSetup","lineNumbers","highlightActiveLine","highlightActiveLineGutter","foldGutter","syntaxHighlighting","value","extensions","lineWrapping","placeholder"],"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/TraceQLEditor.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement, useMemo } from 'react';\nimport { InputLabel, Stack, useTheme } from '@mui/material';\nimport CodeMirror, { EditorView, ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { isValidTraceId } from '@perses-dev/core';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { TempoClient } from '../model';\nimport { TraceQLExtension } from './TraceQLExtension';\n\nexport interface TraceQLEditorProps extends Omit<ReactCodeMirrorProps, 'theme' | 'extensions'> {\n client?: TempoClient;\n}\n\nexport function TraceQLEditor({ client, ...rest }: TraceQLEditorProps): ReactElement {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const { absoluteTimeRange } = useTimeRange();\n const traceQLExtension = useMemo(() => {\n return TraceQLExtension({ client, timeRange: absoluteTimeRange });\n }, [client, absoluteTimeRange]);\n\n const codemirrorTheme = useMemo(() => {\n // https://github.com/mui/material-ui/blob/v5.16.7/packages/mui-material/src/OutlinedInput/OutlinedInput.js#L43\n const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';\n\n return EditorView.theme({\n '&': {\n backgroundColor: 'transparent !important', // required for dark mode\n border: `1px solid ${borderColor}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n },\n '&.cm-focused.cm-editor': {\n outline: 'none', // remove dotted outline on focus\n },\n '.cm-content': {\n padding: '8px',\n },\n });\n }, [theme]);\n\n return (\n <Stack position=\"relative\" sx={{ flexGrow: 1 }}>\n <InputLabel // reproduce the same kind of input label that regular MUI TextFields have\n shrink\n sx={{\n position: 'absolute',\n top: '-6px',\n left: '10px',\n padding: '0 4px',\n color: theme.palette.text.primary,\n backgroundColor: theme.palette.background.default,\n zIndex: 1,\n }}\n >\n TraceQL Expression\n </InputLabel>\n <CodeMirror\n {...rest}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n lineNumbers: false,\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n // The explore view accepts either a TraceQL query or a Trace ID as input. The lezer grammar marks Trace IDs as invalid,\n // therefore let's disable syntax highlighting if the input is a Trace ID.\n syntaxHighlighting: !isValidTraceId(rest.value ?? ''),\n }}\n extensions={[EditorView.lineWrapping, traceQLExtension, codemirrorTheme]}\n placeholder='Example: {span.http.method = \"GET\"}'\n />\n </Stack>\n );\n}\n"],"names":["useMemo","InputLabel","Stack","useTheme","CodeMirror","EditorView","isValidTraceId","useTimeRange","TraceQLExtension","TraceQLEditor","client","rest","theme","isDarkMode","palette","mode","absoluteTimeRange","traceQLExtension","timeRange","codemirrorTheme","borderColor","backgroundColor","border","borderRadius","shape","outline","padding","position","sx","flexGrow","shrink","top","left","color","text","primary","background","default","zIndex","basicSetup","lineNumbers","highlightActiveLine","highlightActiveLineGutter","foldGutter","syntaxHighlighting","value","extensions","lineWrapping","placeholder"],"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,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAC5D,OAAOC,cAAcC,UAAU,QAA8B,wBAAwB;AACrF,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,gBAAgB,QAAQ,qBAAqB;AAMtD,OAAO,SAASC,cAAc,EAAEC,MAAM,EAAE,GAAGC,MAA0B;IACnE,MAAMC,QAAQT;IACd,MAAMU,aAAaD,MAAME,OAAO,CAACC,IAAI,KAAK;IAE1C,MA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sourceRoot":"","sources":["../../../src/explore/TempoExplorer.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"TempoExplorer.d.ts","sourceRoot":"","sources":["../../../src/explore/TempoExplorer.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AA0H/C,wBAAgB,aAAa,IAAI,YAAY,CA2C5C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
// Copyright 2024 The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,13 +11,13 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import {
|
|
14
|
-
import { Box, Stack } from '@mui/material';
|
|
14
|
+
import { Alert, Box, Stack } from '@mui/material';
|
|
15
15
|
import { ErrorAlert, ErrorBoundary, LoadingOverlay, NoDataOverlay } from '@perses-dev/components';
|
|
16
16
|
import { isValidTraceId } from '@perses-dev/core';
|
|
17
17
|
import { Panel } from '@perses-dev/dashboards';
|
|
18
18
|
import { useExplorerManagerContext } from '@perses-dev/explore';
|
|
19
19
|
import { DataQueriesProvider, MultiQueryEditor, useDataQueries } from '@perses-dev/plugin-system';
|
|
20
|
+
import { useState } from 'react';
|
|
20
21
|
import { linkToSpan, linkToTrace } from './links';
|
|
21
22
|
function SearchResultsPanel({ queries }) {
|
|
22
23
|
const { isFetching, isLoading, queryResults } = useDataQueries('TraceQuery');
|
|
@@ -37,6 +38,7 @@ function SearchResultsPanel({ queries }) {
|
|
|
37
38
|
resource: "traces"
|
|
38
39
|
});
|
|
39
40
|
}
|
|
41
|
+
const hasMoreResults = queryResults.some((traceData)=>traceData.data?.metadata?.hasMoreResults);
|
|
40
42
|
return /*#__PURE__*/ _jsxs(Stack, {
|
|
41
43
|
sx: {
|
|
42
44
|
height: '100%'
|
|
@@ -93,6 +95,10 @@ function SearchResultsPanel({ queries }) {
|
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
}
|
|
98
|
+
}),
|
|
99
|
+
hasMoreResults && /*#__PURE__*/ _jsx(Alert, {
|
|
100
|
+
severity: "info",
|
|
101
|
+
children: "Not all matching traces are currently displayed. Increase the result limit to view additional traces."
|
|
96
102
|
})
|
|
97
103
|
]
|
|
98
104
|
});
|
|
@@ -127,6 +133,7 @@ function TracingGanttChartPanel(props) {
|
|
|
127
133
|
}
|
|
128
134
|
export function TempoExplorer() {
|
|
129
135
|
const { data: { queries = [], spanId: selectedSpanId }, setData } = useExplorerManagerContext();
|
|
136
|
+
const [queryDefinitions, setQueryDefinitions] = useState(queries);
|
|
130
137
|
// map TraceQueryDefinition to Definition<UnknownSpec>
|
|
131
138
|
const definitions = queries.length ? queries.map((query)=>{
|
|
132
139
|
return {
|
|
@@ -146,10 +153,11 @@ export function TempoExplorer() {
|
|
|
146
153
|
queryTypes: [
|
|
147
154
|
'TraceQuery'
|
|
148
155
|
],
|
|
149
|
-
onChange: (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
onChange: (state)=>setQueryDefinitions(state),
|
|
157
|
+
queries: queryDefinitions,
|
|
158
|
+
onQueryRun: ()=>setData({
|
|
159
|
+
queries: queryDefinitions
|
|
160
|
+
})
|
|
153
161
|
}),
|
|
154
162
|
/*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
155
163
|
FallbackComponent: ErrorAlert,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/explore/TempoExplorer.tsx"],"sourcesContent":["// Copyright 2024 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 { Box, Stack } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary, LoadingOverlay, NoDataOverlay } from '@perses-dev/components';\nimport { QueryDefinition, isValidTraceId } from '@perses-dev/core';\nimport { Panel } from '@perses-dev/dashboards';\nimport { useExplorerManagerContext } from '@perses-dev/explore';\nimport { DataQueriesProvider, MultiQueryEditor, useDataQueries } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\nimport { TempoTraceQuerySpec } from '../model';\nimport { linkToSpan, linkToTrace } from './links';\n\ninterface TracesExplorerQueryParams {\n queries?: QueryDefinition[];\n spanId?: string;\n}\n\ninterface SearchResultsPanelProps {\n queries: QueryDefinition[];\n}\n\nfunction SearchResultsPanel({ queries }: SearchResultsPanelProps): ReactElement {\n const { isFetching, isLoading, queryResults } = useDataQueries('TraceQuery');\n\n // no query executed, show empty panel\n if (queryResults.length === 0) {\n return <></>;\n }\n\n if (isLoading || isFetching) {\n return <LoadingOverlay />;\n }\n\n const queryError = queryResults.find((d) => d.error);\n if (queryError) {\n throw queryError.error;\n }\n\n const tracesFound = queryResults.some((traceData) => (traceData.data?.searchResult ?? []).length > 0);\n if (!tracesFound) {\n return <NoDataOverlay resource=\"traces\" />;\n }\n\n return (\n <Stack sx={{ height: '100%' }} gap={2}>\n <Box sx={{ height: '35%', flexShrink: 0 }}>\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: {\n queries,\n display: { name: '' },\n plugin: {\n kind: 'ScatterChart',\n spec: {\n link: linkToTrace,\n },\n },\n },\n }}\n />\n </Box>\n <Panel\n sx={{ flexGrow: 1 }}\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: {\n queries,\n display: { name: '' },\n plugin: {\n kind: 'TraceTable',\n spec: {\n links: {\n trace: linkToTrace,\n },\n },\n },\n },\n }}\n />\n </Stack>\n );\n}\n\ninterface TracingGanttChartPanelProps {\n queries: QueryDefinition[];\n selectedSpanId?: string;\n}\n\nfunction TracingGanttChartPanel(props: TracingGanttChartPanelProps): ReactElement {\n const { queries, selectedSpanId } = props;\n const firstQuery = (queries[0]?.spec.plugin.spec as TempoTraceQuerySpec | undefined)?.query;\n\n return (\n <Panel\n panelOptions={{ showIcons: 'always' }}\n definition={{\n kind: 'Panel',\n spec: {\n queries,\n display: { name: `Trace ${firstQuery}` },\n plugin: {\n kind: 'TracingGanttChart',\n spec: {\n links: {\n trace: linkToTrace,\n span: linkToSpan,\n },\n selectedSpanId,\n },\n },\n },\n }}\n />\n );\n}\n\nexport function TempoExplorer(): ReactElement {\n const {\n data: { queries = [], spanId: selectedSpanId },\n setData,\n } = useExplorerManagerContext<TracesExplorerQueryParams>();\n\n // map TraceQueryDefinition to Definition<UnknownSpec>\n const definitions = queries.length\n ? queries.map((query: QueryDefinition) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n })\n : [];\n\n const firstQuery = (queries[0]?.spec.plugin.spec as TempoTraceQuerySpec | undefined)?.query;\n const isSingleTrace = isValidTraceId(firstQuery ?? '');\n\n return (\n <Stack gap={2} sx={{ width: '100%' }}>\n <MultiQueryEditor\n queryTypes={['TraceQuery']}\n onChange={(
|
|
1
|
+
{"version":3,"sources":["../../../src/explore/TempoExplorer.tsx"],"sourcesContent":["// Copyright 2024 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 { Alert, Box, Stack } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary, LoadingOverlay, NoDataOverlay } from '@perses-dev/components';\nimport { QueryDefinition, isValidTraceId } from '@perses-dev/core';\nimport { Panel } from '@perses-dev/dashboards';\nimport { useExplorerManagerContext } from '@perses-dev/explore';\nimport { DataQueriesProvider, MultiQueryEditor, useDataQueries } from '@perses-dev/plugin-system';\nimport { ReactElement, useState } from 'react';\nimport { TempoTraceQuerySpec } from '../model';\nimport { linkToSpan, linkToTrace } from './links';\n\ninterface TracesExplorerQueryParams {\n queries?: QueryDefinition[];\n spanId?: string;\n}\n\ninterface SearchResultsPanelProps {\n queries: QueryDefinition[];\n}\n\nfunction SearchResultsPanel({ queries }: SearchResultsPanelProps): ReactElement {\n const { isFetching, isLoading, queryResults } = useDataQueries('TraceQuery');\n\n // no query executed, show empty panel\n if (queryResults.length === 0) {\n return <></>;\n }\n\n if (isLoading || isFetching) {\n return <LoadingOverlay />;\n }\n\n const queryError = queryResults.find((d) => d.error);\n if (queryError) {\n throw queryError.error;\n }\n\n const tracesFound = queryResults.some((traceData) => (traceData.data?.searchResult ?? []).length > 0);\n if (!tracesFound) {\n return <NoDataOverlay resource=\"traces\" />;\n }\n\n const hasMoreResults = queryResults.some((traceData) => traceData.data?.metadata?.hasMoreResults);\n\n return (\n <Stack sx={{ height: '100%' }} gap={2}>\n <Box sx={{ height: '35%', flexShrink: 0 }}>\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: {\n queries,\n display: { name: '' },\n plugin: {\n kind: 'ScatterChart',\n spec: {\n link: linkToTrace,\n },\n },\n },\n }}\n />\n </Box>\n <Panel\n sx={{ flexGrow: 1 }}\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: {\n queries,\n display: { name: '' },\n plugin: {\n kind: 'TraceTable',\n spec: {\n links: {\n trace: linkToTrace,\n },\n },\n },\n },\n }}\n />\n {hasMoreResults && (\n <Alert severity=\"info\">\n Not all matching traces are currently displayed. Increase the result limit to view additional traces.\n </Alert>\n )}\n </Stack>\n );\n}\n\ninterface TracingGanttChartPanelProps {\n queries: QueryDefinition[];\n selectedSpanId?: string;\n}\n\nfunction TracingGanttChartPanel(props: TracingGanttChartPanelProps): ReactElement {\n const { queries, selectedSpanId } = props;\n const firstQuery = (queries[0]?.spec.plugin.spec as TempoTraceQuerySpec | undefined)?.query;\n\n return (\n <Panel\n panelOptions={{ showIcons: 'always' }}\n definition={{\n kind: 'Panel',\n spec: {\n queries,\n display: { name: `Trace ${firstQuery}` },\n plugin: {\n kind: 'TracingGanttChart',\n spec: {\n links: {\n trace: linkToTrace,\n span: linkToSpan,\n },\n selectedSpanId,\n },\n },\n },\n }}\n />\n );\n}\n\nexport function TempoExplorer(): ReactElement {\n const {\n data: { queries = [], spanId: selectedSpanId },\n setData,\n } = useExplorerManagerContext<TracesExplorerQueryParams>();\n\n const [queryDefinitions, setQueryDefinitions] = useState<QueryDefinition[]>(queries);\n\n // map TraceQueryDefinition to Definition<UnknownSpec>\n const definitions = queries.length\n ? queries.map((query: QueryDefinition) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n })\n : [];\n\n const firstQuery = (queries[0]?.spec.plugin.spec as TempoTraceQuerySpec | undefined)?.query;\n const isSingleTrace = isValidTraceId(firstQuery ?? '');\n\n return (\n <Stack gap={2} sx={{ width: '100%' }}>\n <MultiQueryEditor\n queryTypes={['TraceQuery']}\n onChange={(state) => setQueryDefinitions(state)}\n queries={queryDefinitions}\n onQueryRun={() => setData({ queries: queryDefinitions })}\n />\n\n <ErrorBoundary FallbackComponent={ErrorAlert} resetKeys={[queries]}>\n <DataQueriesProvider definitions={definitions}>\n <Box height={700}>\n {isSingleTrace ? (\n <TracingGanttChartPanel queries={queries} selectedSpanId={selectedSpanId} />\n ) : (\n <SearchResultsPanel queries={queries} />\n )}\n </Box>\n </DataQueriesProvider>\n </ErrorBoundary>\n </Stack>\n );\n}\n"],"names":["Alert","Box","Stack","ErrorAlert","ErrorBoundary","LoadingOverlay","NoDataOverlay","isValidTraceId","Panel","useExplorerManagerContext","DataQueriesProvider","MultiQueryEditor","useDataQueries","useState","linkToSpan","linkToTrace","SearchResultsPanel","queries","isFetching","isLoading","queryResults","length","queryError","find","d","error","tracesFound","some","traceData","data","searchResult","resource","hasMoreResults","metadata","sx","height","gap","flexShrink","panelOptions","hideHeader","definition","kind","spec","display","name","plugin","link","flexGrow","links","trace","severity","TracingGanttChartPanel","props","selectedSpanId","firstQuery","query","showIcons","span","TempoExplorer","spanId","setData","queryDefinitions","setQueryDefinitions","definitions","map","isSingleTrace","width","queryTypes","onChange","state","onQueryRun","FallbackComponent","resetKeys"],"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,EAAEC,GAAG,EAAEC,KAAK,QAAQ,gBAAgB;AAClD,SAASC,UAAU,EAAEC,aAAa,EAAEC,cAAc,EAAEC,aAAa,QAAQ,yBAAyB;AAClG,SAA0BC,cAAc,QAAQ,mBAAmB;AACnE,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,yBAAyB,QAAQ,sBAAsB;AAChE,SAASC,mBAAmB,EAAEC,gBAAgB,EAAEC,cAAc,QAAQ,4BAA4B;AAClG,SAAuBC,QAAQ,QAAQ,QAAQ;AAE/C,SAASC,UAAU,EAAEC,WAAW,QAAQ,UAAU;AAWlD,SAASC,mBAAmB,EAAEC,OAAO,EAA2B;IAC9D,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAE,GAAGR,eAAe;IAE/D,sCAAsC;IACtC,IAAIQ,aAAaC,MAAM,KAAK,GAAG;QAC7B,qBAAO;IACT;I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kCACV8B,8BACC,KAACd;4BAAuBlC,SAASA;4BAASoC,gBAAgBA;2CAE1D,KAACrC;4BAAmBC,SAASA;;;;;;;AAO3C"}
|
package/lib/model/api-types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface SearchRequestParameters {
|
|
|
12
12
|
/** max number of matching spans per trace in search result, default: 3 */
|
|
13
13
|
spss?: number;
|
|
14
14
|
}
|
|
15
|
+
export declare const DEFAULT_SEARCH_LIMIT = 20;
|
|
15
16
|
/**
|
|
16
17
|
* Response of Tempo HTTP API endpoint GET /api/search
|
|
17
18
|
* https://grafana.com/docs/tempo/latest/api_docs/#search
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../../src/model/api-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,kBAAkB,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,QAAQ,CAAC,EAAE,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Z,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/lib/model/api-types.js
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
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
|
-
export
|
|
13
|
+
export const DEFAULT_SEARCH_LIMIT = 20;
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=api-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/api-types.ts"],"sourcesContent":["// Copyright 2025 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 { otlpcommonv1, otlptracev1 } from '@perses-dev/core';\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchRequestParameters {\n q: string;\n start?: number;\n end?: number;\n /** max number of search results, default: 20 */\n limit?: number;\n /** max number of matching spans per trace in search result, default: 3 */\n spss?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchResponse {\n traces: TraceSearchResponse[];\n}\n\nexport interface TraceSearchResponse {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n /** unset if duration is less than 1ms */\n durationMs?: number;\n /** @deprecated spanSet is deprecated in favor of spanSets */\n spanSet?: {\n spans: SpanSearchResponse[];\n matched: number;\n };\n spanSets?: Array<{\n spans: SpanSearchResponse[];\n matched: number;\n }>;\n /** ServiceStats are only available in Tempo vParquet4+ blocks */\n serviceStats?: Record<string, ServiceStats>;\n}\n\nexport interface SpanSearchResponse {\n spanID: string;\n name?: string;\n startTimeUnixNano: string;\n durationNanos: string;\n attributes?: otlpcommonv1.KeyValue[];\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * https://grafana.com/docs/tempo/latest/api_docs/#query\n */\nexport interface QueryRequestParameters {\n traceId: string;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * OTEL trace proto: https://github.com/open-telemetry/opentelemetry-proto-go/blob/main/otlp/trace/v1/trace.pb.go\n */\nexport interface QueryResponse {\n batches: otlptracev1.ResourceSpan[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsRequestParameters {\n scope?: 'resource' | 'span' | 'intrinsic';\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsResponse {\n scopes: SearchTagsScope[];\n}\n\nexport interface SearchTagsScope {\n name: 'resource' | 'span' | 'intrinsic';\n tags: string[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesRequestParameters {\n tag: string;\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesResponse {\n tagValues: SearchTagValue[];\n}\n\nexport interface SearchTagValue {\n type: string;\n /** The tag value. Empty strings are omitted (i.e. undefined) in the response. */\n value?: string;\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 2025 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 { otlpcommonv1, otlptracev1 } from '@perses-dev/core';\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchRequestParameters {\n q: string;\n start?: number;\n end?: number;\n /** max number of search results, default: 20 */\n limit?: number;\n /** max number of matching spans per trace in search result, default: 3 */\n spss?: number;\n}\n\nexport const DEFAULT_SEARCH_LIMIT = 20;\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchResponse {\n traces: TraceSearchResponse[];\n}\n\nexport interface TraceSearchResponse {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n /** unset if duration is less than 1ms */\n durationMs?: number;\n /** @deprecated spanSet is deprecated in favor of spanSets */\n spanSet?: {\n spans: SpanSearchResponse[];\n matched: number;\n };\n spanSets?: Array<{\n spans: SpanSearchResponse[];\n matched: number;\n }>;\n /** ServiceStats are only available in Tempo vParquet4+ blocks */\n serviceStats?: Record<string, ServiceStats>;\n}\n\nexport interface SpanSearchResponse {\n spanID: string;\n name?: string;\n startTimeUnixNano: string;\n durationNanos: string;\n attributes?: otlpcommonv1.KeyValue[];\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * https://grafana.com/docs/tempo/latest/api_docs/#query\n */\nexport interface QueryRequestParameters {\n traceId: string;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * OTEL trace proto: https://github.com/open-telemetry/opentelemetry-proto-go/blob/main/otlp/trace/v1/trace.pb.go\n */\nexport interface QueryResponse {\n batches: otlptracev1.ResourceSpan[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsRequestParameters {\n scope?: 'resource' | 'span' | 'intrinsic';\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsResponse {\n scopes: SearchTagsScope[];\n}\n\nexport interface SearchTagsScope {\n name: 'resource' | 'span' | 'intrinsic';\n tags: string[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesRequestParameters {\n tag: string;\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesResponse {\n tagValues: SearchTagValue[];\n}\n\nexport interface SearchTagValue {\n type: string;\n /** The tag value. Empty strings are omitted (i.e. undefined) in the response. */\n value?: string;\n}\n"],"names":["DEFAULT_SEARCH_LIMIT"],"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;AAkBjC,OAAO,MAAMA,uBAAuB,GAAG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright 2025 The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { HTTPSettingsEditor } from '@perses-dev/plugin-system';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
export function TempoDatasourceEditor(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/TempoDatasourceEditor.tsx"],"sourcesContent":["// Copyright 2025 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 { HTTPSettingsEditor } from '@perses-dev/plugin-system';\nimport React, { ReactElement } from 'react';\nimport { TempoDatasourceSpec } from './tempo-datasource-types';\n\nexport interface TempoDatasourceEditorProps {\n value: TempoDatasourceSpec;\n onChange: (next: TempoDatasourceSpec) => void;\n isReadonly?: boolean;\n}\n\nexport function TempoDatasourceEditor(props: TempoDatasourceEditorProps): ReactElement {\n const { value, onChange, isReadonly } = props;\n\n const initialSpecDirect: TempoDatasourceSpec = {\n directUrl: '',\n };\n\n const initialSpecProxy: TempoDatasourceSpec = {\n proxy: {\n kind: 'HTTPProxy',\n spec: {\n allowedEndpoints: [\n // list of standard endpoints suggested by default\n {\n endpointPattern: '/api/search',\n method: 'GET',\n },\n {\n endpointPattern: '/api/traces',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tags',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tag',\n method: 'GET',\n },\n ],\n url: '',\n },\n },\n };\n\n return (\n <HTTPSettingsEditor\n value={value}\n onChange={onChange}\n isReadonly={isReadonly}\n initialSpecDirect={initialSpecDirect}\n initialSpecProxy={initialSpecProxy}\n />\n );\n}\n"],"names":["HTTPSettingsEditor","React","TempoDatasourceEditor","props","value","onChange","isReadonly","initialSpecDirect","directUrl","initialSpecProxy","proxy","kind","spec","allowedEndpoints","endpointPattern","method","url"],"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/TempoDatasourceEditor.tsx"],"sourcesContent":["// Copyright 2025 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 { HTTPSettingsEditor } from '@perses-dev/plugin-system';\nimport React, { ReactElement } from 'react';\nimport { TempoDatasourceSpec } from './tempo-datasource-types';\n\nexport interface TempoDatasourceEditorProps {\n value: TempoDatasourceSpec;\n onChange: (next: TempoDatasourceSpec) => void;\n isReadonly?: boolean;\n}\n\nexport function TempoDatasourceEditor(props: TempoDatasourceEditorProps): ReactElement {\n const { value, onChange, isReadonly } = props;\n\n const initialSpecDirect: TempoDatasourceSpec = {\n directUrl: '',\n };\n\n const initialSpecProxy: TempoDatasourceSpec = {\n proxy: {\n kind: 'HTTPProxy',\n spec: {\n allowedEndpoints: [\n // list of standard endpoints suggested by default\n {\n endpointPattern: '/api/search',\n method: 'GET',\n },\n {\n endpointPattern: '/api/traces',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tags',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tag',\n method: 'GET',\n },\n ],\n url: '',\n },\n },\n };\n\n return (\n <HTTPSettingsEditor\n value={value}\n onChange={onChange}\n isReadonly={isReadonly}\n initialSpecDirect={initialSpecDirect}\n initialSpecProxy={initialSpecProxy}\n />\n );\n}\n"],"names":["HTTPSettingsEditor","React","TempoDatasourceEditor","props","value","onChange","isReadonly","initialSpecDirect","directUrl","initialSpecProxy","proxy","kind","spec","allowedEndpoints","endpointPattern","method","url"],"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,kBAAkB,QAAQ,4BAA4B;AAC/D,OAAOC,WAA6B,QAAQ;AAS5C,OAAO,SAASC,sBAAsBC,KAAiC;IACrE,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGH;IAExC,MAAMI,oBAAyC;QAC7CC,WAAW;IACb;IAEA,MAAMC,mBAAwC;QAC5CC,OAAO;YACLC,MAAM;YACNC,MAAM;gBACJC,kBAAkB;oBAChB,kDAAkD;oBAClD;wBACEC,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;iBACD;gBACDC,KAAK;YACP;QACF;IACF;IAEA,qBACE,KAAChB;QACCI,OAAOA;QACPC,UAAUA;QACVC,YAAYA;QACZC,mBAAmBA;QACnBE,kBAAkBA;;AAGxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TempoTraceQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tempo-trace-query/TempoTraceQueryEditor.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TempoTraceQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tempo-trace-query/TempoTraceQueryEditor.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;AAU5D,OAAO,EAAE,qBAAqB,EAAiB,MAAM,sBAAsB,CAAC;AAE5E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CA+EhF;AASD,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAyBlD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
// Copyright 2025 The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,20 +11,17 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { Box, Button, FormControl, InputLabel, MenuItem, Select, Stack } from '@mui/material';
|
|
15
15
|
import { useId } from '@perses-dev/components';
|
|
16
16
|
import { DatasourceSelect, useDatasourceClient, useDatasourceSelectValueToSelector } from '@perses-dev/plugin-system';
|
|
17
17
|
import { produce } from 'immer';
|
|
18
18
|
import { useCallback, useState } from 'react';
|
|
19
|
-
import {
|
|
20
|
-
import { DEFAULT_TEMPO, isDefaultTempoSelector, isTempoDatasourceSelector, TEMPO_DATASOURCE_KIND } from '../../model/tempo-selectors';
|
|
19
|
+
import { DEFAULT_TEMPO, isDefaultTempoSelector, isTempoDatasourceSelector, TEMPO_DATASOURCE_KIND } from '../../model';
|
|
21
20
|
import { AttributeFilters } from '../../components/AttributeFilters';
|
|
22
|
-
import { filterToTraceQL } from '../../components
|
|
23
|
-
import { traceQLToFilter } from '../../components/filter/traceql_to_filter';
|
|
21
|
+
import { TraceQLEditor, filterToTraceQL, traceQLToFilter } from '../../components';
|
|
24
22
|
import { useQueryState } from './query-editor-model';
|
|
25
23
|
export function TempoTraceQueryEditor(props) {
|
|
26
|
-
const { onChange, value, value: { datasource, limit }
|
|
24
|
+
const { onChange, value, value: { datasource, limit } } = props;
|
|
27
25
|
const datasourceSelectValue = datasource ?? DEFAULT_TEMPO;
|
|
28
26
|
const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, TEMPO_DATASOURCE_KIND);
|
|
29
27
|
const datasourceSelectLabelID = useId('tempo-datasource-label'); // for panels with multiple queries, this component is rendered multiple times on the same page
|
|
@@ -37,30 +35,19 @@ export function TempoTraceQueryEditor(props) {
|
|
|
37
35
|
const nextDatasource = isDefaultTempoSelector(next) ? undefined : next;
|
|
38
36
|
draft.datasource = nextDatasource;
|
|
39
37
|
}));
|
|
40
|
-
if (queryHandlerSettings?.setWatchOtherSpecs) queryHandlerSettings.setWatchOtherSpecs({
|
|
41
|
-
...value,
|
|
42
|
-
datasource: next
|
|
43
|
-
});
|
|
44
38
|
return;
|
|
45
39
|
}
|
|
46
40
|
throw new Error('Got unexpected non-Tempo datasource selector');
|
|
47
41
|
};
|
|
48
42
|
const runQuery = (newQuery)=>{
|
|
49
|
-
if (queryHandlerSettings?.watchQueryChanges) {
|
|
50
|
-
queryHandlerSettings.watchQueryChanges(newQuery);
|
|
51
|
-
}
|
|
52
43
|
onChange(produce(value, (draft)=>{
|
|
53
44
|
draft.query = newQuery;
|
|
54
45
|
}));
|
|
55
46
|
};
|
|
56
47
|
const handleTraceQueryChange = useCallback((e)=>{
|
|
57
48
|
handleQueryChange(e);
|
|
58
|
-
if (queryHandlerSettings?.watchQueryChanges) {
|
|
59
|
-
queryHandlerSettings.watchQueryChanges(e);
|
|
60
|
-
}
|
|
61
49
|
}, [
|
|
62
|
-
handleQueryChange
|
|
63
|
-
queryHandlerSettings
|
|
50
|
+
handleQueryChange
|
|
64
51
|
]);
|
|
65
52
|
return /*#__PURE__*/ _jsxs(Stack, {
|
|
66
53
|
spacing: 2,
|
|
@@ -92,7 +79,7 @@ export function TempoTraceQueryEditor(props) {
|
|
|
92
79
|
client: client,
|
|
93
80
|
value: query,
|
|
94
81
|
onChange: handleTraceQueryChange,
|
|
95
|
-
onBlur:
|
|
82
|
+
onBlur: handleQueryBlur
|
|
96
83
|
}),
|
|
97
84
|
/*#__PURE__*/ _jsx(Button, {
|
|
98
85
|
onClick: ()=>setShowAttributeFilters(!showAttributeFilters),
|