@perses-dev/tracing-gantt-chart-plugin 0.12.1 → 0.13.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/css/async/785.85c2cbf6.css +1 -0
- package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
- package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
- package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
- package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
- package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
- package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
- package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
- package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
- package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
- package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
- package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
- package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
- package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
- package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
- package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
- package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
- package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
- package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
- package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
- package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
- package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
- package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
- package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
- package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
- package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
- package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
- package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
- package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
- package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
- package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
- package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
- package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
- package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
- package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
- package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
- package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
- package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
- package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
- package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
- package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
- package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
- package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
- package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
- package/__mf/js/TracingGanttChart.b2e20301.js +7 -0
- package/__mf/js/async/121.5475779f.js +2 -0
- package/__mf/js/async/177.50257b88.js +1 -0
- package/__mf/js/async/192.a0a2e63b.js +1 -0
- package/__mf/js/async/2.d2c2e5a6.js +1 -0
- package/__mf/js/async/207.dcd0ae82.js +110 -0
- package/__mf/js/async/{666.4cf9c453.js.LICENSE.txt → 207.dcd0ae82.js.LICENSE.txt} +1 -1
- package/__mf/js/async/235.b42801b1.js +1 -0
- package/__mf/js/async/260.9bec2000.js +39 -0
- package/__mf/js/async/{157.77f5f5a1.js.LICENSE.txt → 260.9bec2000.js.LICENSE.txt} +17 -1
- package/__mf/js/async/274.5c518455.js +2 -0
- package/__mf/js/async/356.fc2da489.js +1 -0
- package/__mf/js/async/392.6c066266.js +2 -0
- package/__mf/js/async/43.e395f769.js +2 -0
- package/__mf/js/async/470.4e137e17.js +2 -0
- package/__mf/js/async/472.8aa138b3.js +1 -0
- package/__mf/js/async/568.9ba2f5f6.js +24 -0
- package/__mf/js/async/{634.b68acb18.js.LICENSE.txt → 568.9ba2f5f6.js.LICENSE.txt} +0 -16
- package/__mf/js/async/581.530a1cbc.js +1 -0
- package/__mf/js/async/587.dbc05176.js +1 -0
- package/__mf/js/async/588.f5afdb25.js +1 -0
- package/__mf/js/async/616.268fac9b.js +1 -0
- package/__mf/js/async/71.79ef5248.js +1 -0
- package/__mf/js/async/785.187cf92a.js +7 -0
- package/__mf/js/async/{12.c9423551.js.LICENSE.txt → 785.187cf92a.js.LICENSE.txt} +19 -1
- package/__mf/js/async/873.76af63d7.js +1 -0
- package/__mf/js/async/940.39b5cb1d.js +1 -0
- package/__mf/js/async/941.70c6480d.js +2 -0
- package/__mf/js/async/968.68803274.js +1 -0
- package/__mf/js/async/978.ca0b1b55.js +1 -0
- package/__mf/js/async/__federation_expose_TracingGanttChart.bcd10502.js +1 -0
- package/__mf/js/async/lib-router.69a7062a.js +2 -0
- package/__mf/js/main.6c69ae4f.js +7 -0
- package/lib/PanelActions.d.ts +1 -1
- package/lib/PanelActions.d.ts.map +1 -1
- package/lib/PanelActions.js.map +1 -1
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts +4 -3
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts.map +1 -1
- package/lib/TracingGanttChart/DetailPane/Attributes.js +45 -8
- package/lib/TracingGanttChart/DetailPane/Attributes.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts +2 -0
- package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTable.js +64 -25
- package/lib/TracingGanttChart/GanttTable/GanttTable.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts +2 -2
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts +5 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.js +14 -2
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.js +6 -2
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanIndents.js +10 -10
- package/lib/TracingGanttChart/GanttTable/SpanIndents.js.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/draw.js +2 -6
- package/lib/TracingGanttChart/MiniGanttChart/draw.js.map +1 -1
- package/lib/TracingGanttChart/Search.d.ts +15 -0
- package/lib/TracingGanttChart/Search.d.ts.map +1 -0
- package/lib/TracingGanttChart/Search.js +133 -0
- package/lib/TracingGanttChart/Search.js.map +1 -0
- package/lib/TracingGanttChart/TraceHeaderBar.d.ts +9 -0
- package/lib/TracingGanttChart/TraceHeaderBar.d.ts.map +1 -0
- package/lib/TracingGanttChart/TraceHeaderBar.js +126 -0
- package/lib/TracingGanttChart/TraceHeaderBar.js.map +1 -0
- package/lib/TracingGanttChart/TracingGanttChart.d.ts +1 -1
- package/lib/TracingGanttChart/TracingGanttChart.d.ts.map +1 -1
- package/lib/TracingGanttChart/TracingGanttChart.js +14 -8
- package/lib/TracingGanttChart/TracingGanttChart.js.map +1 -1
- package/lib/TracingGanttChart/trace.d.ts +7 -1
- package/lib/TracingGanttChart/trace.d.ts.map +1 -1
- package/lib/TracingGanttChart/trace.js +10 -0
- package/lib/TracingGanttChart/trace.js.map +1 -1
- package/lib/TracingGanttChart/utils.js +1 -1
- package/lib/TracingGanttChart/utils.js.map +1 -1
- package/lib/TracingGanttChartPanel.d.ts +1 -1
- package/lib/TracingGanttChartPanel.js.map +1 -1
- package/lib/cjs/TracingGanttChart/DetailPane/Attributes.js +47 -7
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTable.js +63 -24
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableProvider.js +1 -1
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableRow.js +14 -2
- package/lib/cjs/TracingGanttChart/GanttTable/ResizableDivider.js +6 -2
- package/lib/cjs/TracingGanttChart/GanttTable/SpanIndents.js +10 -10
- package/lib/cjs/TracingGanttChart/MiniGanttChart/draw.js +2 -6
- package/lib/cjs/TracingGanttChart/Search.js +154 -0
- package/lib/cjs/TracingGanttChart/TraceHeaderBar.js +139 -0
- package/lib/cjs/TracingGanttChart/TracingGanttChart.js +13 -7
- package/lib/cjs/TracingGanttChart/trace.js +18 -3
- package/lib/cjs/TracingGanttChart/utils.js +43 -2
- package/lib/test/convert/jaeger.d.ts +1 -1
- package/lib/test/convert/jaeger.d.ts.map +1 -1
- package/lib/test/convert/jaeger.js.map +1 -1
- package/mf-manifest.json +61 -50
- package/mf-stats.json +72 -50
- package/package.json +6 -5
- package/__mf/css/async/442.d3010b86.css +0 -1
- package/__mf/css/async/61.d3010b86.css +0 -1
- package/__mf/css/async/823.d3010b86.css +0 -1
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/TracingGanttChart.f5573ac3.js +0 -6
- package/__mf/js/async/12.c9423551.js +0 -7
- package/__mf/js/async/121.cb300887.js +0 -2
- package/__mf/js/async/157.77f5f5a1.js +0 -39
- package/__mf/js/async/177.cf9df204.js +0 -1
- package/__mf/js/async/192.f723a636.js +0 -1
- package/__mf/js/async/2.e3ce4ee4.js +0 -1
- package/__mf/js/async/235.806ca841.js +0 -1
- package/__mf/js/async/274.457dda65.js +0 -2
- package/__mf/js/async/356.7ea3eee9.js +0 -1
- package/__mf/js/async/392.c563796d.js +0 -2
- package/__mf/js/async/43.55c495e3.js +0 -2
- package/__mf/js/async/439.63c7b180.js +0 -1
- package/__mf/js/async/470.f5dfd429.js +0 -2
- package/__mf/js/async/587.3a4d8eed.js +0 -1
- package/__mf/js/async/588.a1fce2da.js +0 -1
- package/__mf/js/async/616.25399954.js +0 -1
- package/__mf/js/async/634.b68acb18.js +0 -24
- package/__mf/js/async/666.4cf9c453.js +0 -110
- package/__mf/js/async/71.ec1919d7.js +0 -1
- package/__mf/js/async/751.b7c40fc8.js +0 -1
- package/__mf/js/async/873.0f298220.js +0 -1
- package/__mf/js/async/895.eb528fc2.js +0 -1
- package/__mf/js/async/941.065a3eec.js +0 -2
- package/__mf/js/async/968.5f7ccf5e.js +0 -1
- package/__mf/js/async/978.151ab551.js +0 -1
- package/__mf/js/async/__federation_expose_TracingGanttChart.3ea317ee.js +0 -1
- package/__mf/js/async/lib-router.aed93ee9.js +0 -2
- package/__mf/js/main.237de7d0.js +0 -6
- package/lib/TracingGanttChart/TraceDetails.d.ts +0 -7
- package/lib/TracingGanttChart/TraceDetails.d.ts.map +0 -1
- package/lib/TracingGanttChart/TraceDetails.js +0 -90
- package/lib/TracingGanttChart/TraceDetails.js.map +0 -1
- package/lib/cjs/TracingGanttChart/TraceDetails.js +0 -98
- /package/__mf/js/async/{121.cb300887.js.LICENSE.txt → 121.5475779f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{274.457dda65.js.LICENSE.txt → 274.5c518455.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.c563796d.js.LICENSE.txt → 392.6c066266.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{43.55c495e3.js.LICENSE.txt → 43.e395f769.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{470.f5dfd429.js.LICENSE.txt → 470.4e137e17.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.065a3eec.js.LICENSE.txt → 941.70c6480d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.aed93ee9.js.LICENSE.txt → lib-router.69a7062a.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { IconButton, InputAdornment, Stack, TextField } from '@mui/material';
|
|
15
|
+
import ChevronUp from 'mdi-material-ui/ChevronUp';
|
|
16
|
+
import ChevronDown from 'mdi-material-ui/ChevronDown';
|
|
17
|
+
import Close from 'mdi-material-ui/Close';
|
|
18
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
19
|
+
import { renderAttributeValue } from './DetailPane/Attributes';
|
|
20
|
+
import { forEachSpan } from './trace';
|
|
21
|
+
export function SearchBar(props) {
|
|
22
|
+
const { search } = props;
|
|
23
|
+
const { searchQuery, setSearchQuery, matchingSpanIds, focusedMatchIndex, setFocusedMatchIndex } = search;
|
|
24
|
+
const hasQuery = searchQuery.length > 0;
|
|
25
|
+
const matchCount = matchingSpanIds.length;
|
|
26
|
+
const hasMatches = matchCount > 0;
|
|
27
|
+
function handlePrev() {
|
|
28
|
+
if (!hasMatches) return;
|
|
29
|
+
setFocusedMatchIndex((focusedMatchIndex - 1 + matchCount) % matchCount);
|
|
30
|
+
}
|
|
31
|
+
function handleNext() {
|
|
32
|
+
if (!hasMatches) return;
|
|
33
|
+
setFocusedMatchIndex((focusedMatchIndex + 1) % matchCount);
|
|
34
|
+
}
|
|
35
|
+
function handleKeyDown(e) {
|
|
36
|
+
if (e.key === 'Enter') {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
if (e.shiftKey) {
|
|
39
|
+
handlePrev();
|
|
40
|
+
} else {
|
|
41
|
+
handleNext();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
46
|
+
direction: "row",
|
|
47
|
+
sx: {
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
gap: 0.5,
|
|
50
|
+
minWidth: 300
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
54
|
+
size: "small",
|
|
55
|
+
placeholder: "Search spans...",
|
|
56
|
+
value: searchQuery,
|
|
57
|
+
onChange: (e)=>setSearchQuery(e.target.value),
|
|
58
|
+
onKeyDown: handleKeyDown,
|
|
59
|
+
slotProps: {
|
|
60
|
+
input: {
|
|
61
|
+
endAdornment: /*#__PURE__*/ _jsx(InputAdornment, {
|
|
62
|
+
position: "end",
|
|
63
|
+
sx: {
|
|
64
|
+
visibility: hasQuery ? 'visible' : 'hidden',
|
|
65
|
+
whiteSpace: 'nowrap'
|
|
66
|
+
},
|
|
67
|
+
children: hasMatches ? `${focusedMatchIndex + 1}/${matchCount}` : '0/0'
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
sx: {
|
|
72
|
+
minWidth: 200
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
76
|
+
size: "small",
|
|
77
|
+
disabled: !hasMatches,
|
|
78
|
+
"aria-label": "Previous match",
|
|
79
|
+
onClick: handlePrev,
|
|
80
|
+
children: /*#__PURE__*/ _jsx(ChevronUp, {})
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
83
|
+
size: "small",
|
|
84
|
+
disabled: !hasMatches,
|
|
85
|
+
"aria-label": "Next match",
|
|
86
|
+
onClick: handleNext,
|
|
87
|
+
children: /*#__PURE__*/ _jsx(ChevronDown, {})
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
90
|
+
size: "small",
|
|
91
|
+
disabled: !hasQuery,
|
|
92
|
+
"aria-label": "Clear search",
|
|
93
|
+
onClick: ()=>setSearchQuery(''),
|
|
94
|
+
children: /*#__PURE__*/ _jsx(Close, {})
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function spanMatchesQuery(span, query) {
|
|
100
|
+
const attrMatches = (attr)=>attr.key.toLowerCase().includes(query) || renderAttributeValue(attr.value).toLowerCase().includes(query);
|
|
101
|
+
return span.resource.serviceName?.toLowerCase().includes(query) || span.name.toLowerCase().includes(query) || span.spanId.toLowerCase().includes(query) || span.attributes.some(attrMatches) || span.resource.attributes.some(attrMatches);
|
|
102
|
+
}
|
|
103
|
+
export function useSpanSearch(trace) {
|
|
104
|
+
const [searchQuery, setSearchQueryRaw] = useState('');
|
|
105
|
+
const [focusedMatchIndex, setFocusedMatchIndex] = useState(0);
|
|
106
|
+
const matchingSpanIds = useMemo(()=>{
|
|
107
|
+
if (searchQuery.length === 0) return [];
|
|
108
|
+
const query = searchQuery.toLowerCase();
|
|
109
|
+
const matches = [];
|
|
110
|
+
forEachSpan(trace.rootSpans, (span)=>{
|
|
111
|
+
if (spanMatchesQuery(span, query)) {
|
|
112
|
+
matches.push(span.spanId);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return matches;
|
|
116
|
+
}, [
|
|
117
|
+
searchQuery,
|
|
118
|
+
trace.rootSpans
|
|
119
|
+
]);
|
|
120
|
+
const setSearchQuery = useCallback((query)=>{
|
|
121
|
+
setSearchQueryRaw(query);
|
|
122
|
+
setFocusedMatchIndex(0);
|
|
123
|
+
}, []);
|
|
124
|
+
return {
|
|
125
|
+
searchQuery,
|
|
126
|
+
setSearchQuery,
|
|
127
|
+
matchingSpanIds,
|
|
128
|
+
focusedMatchIndex,
|
|
129
|
+
setFocusedMatchIndex
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=Search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/Search.tsx"],"sourcesContent":["// Copyright 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 { IconButton, InputAdornment, Stack, TextField } from '@mui/material';\nimport ChevronUp from 'mdi-material-ui/ChevronUp';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport Close from 'mdi-material-ui/Close';\nimport { ReactElement, useCallback, useMemo, useState } from 'react';\nimport * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';\nimport { renderAttributeValue } from './DetailPane/Attributes';\nimport { Span, Trace, forEachSpan } from './trace';\n\nexport interface SearchBarProps {\n search: SpanSearch;\n}\n\nexport function SearchBar(props: SearchBarProps): ReactElement {\n const { search } = props;\n const { searchQuery, setSearchQuery, matchingSpanIds, focusedMatchIndex, setFocusedMatchIndex } = search;\n\n const hasQuery = searchQuery.length > 0;\n const matchCount = matchingSpanIds.length;\n const hasMatches = matchCount > 0;\n\n function handlePrev(): void {\n if (!hasMatches) return;\n setFocusedMatchIndex((focusedMatchIndex - 1 + matchCount) % matchCount);\n }\n\n function handleNext(): void {\n if (!hasMatches) return;\n setFocusedMatchIndex((focusedMatchIndex + 1) % matchCount);\n }\n\n function handleKeyDown(e: React.KeyboardEvent): void {\n if (e.key === 'Enter') {\n e.preventDefault();\n if (e.shiftKey) {\n handlePrev();\n } else {\n handleNext();\n }\n }\n }\n\n return (\n <Stack direction=\"row\" sx={{ alignItems: 'center', gap: 0.5, minWidth: 300 }}>\n <TextField\n size=\"small\"\n placeholder=\"Search spans...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n onKeyDown={handleKeyDown}\n slotProps={{\n input: {\n endAdornment: (\n <InputAdornment position=\"end\" sx={{ visibility: hasQuery ? 'visible' : 'hidden', whiteSpace: 'nowrap' }}>\n {hasMatches ? `${focusedMatchIndex + 1}/${matchCount}` : '0/0'}\n </InputAdornment>\n ),\n },\n }}\n sx={{ minWidth: 200 }}\n />\n <IconButton size=\"small\" disabled={!hasMatches} aria-label=\"Previous match\" onClick={handlePrev}>\n <ChevronUp />\n </IconButton>\n <IconButton size=\"small\" disabled={!hasMatches} aria-label=\"Next match\" onClick={handleNext}>\n <ChevronDown />\n </IconButton>\n <IconButton size=\"small\" disabled={!hasQuery} aria-label=\"Clear search\" onClick={() => setSearchQuery('')}>\n <Close />\n </IconButton>\n </Stack>\n );\n}\n\nfunction spanMatchesQuery(span: Span, query: string): boolean {\n const attrMatches = (attr: otlpcommonv1.KeyValue): boolean =>\n attr.key.toLowerCase().includes(query) || renderAttributeValue(attr.value).toLowerCase().includes(query);\n\n return (\n span.resource.serviceName?.toLowerCase().includes(query) ||\n span.name.toLowerCase().includes(query) ||\n span.spanId.toLowerCase().includes(query) ||\n span.attributes.some(attrMatches) ||\n span.resource.attributes.some(attrMatches)\n );\n}\n\nexport interface SpanSearch {\n searchQuery: string;\n setSearchQuery: (query: string) => void;\n matchingSpanIds: string[];\n focusedMatchIndex: number;\n setFocusedMatchIndex: (index: number) => void;\n}\n\nexport function useSpanSearch(trace: Trace): SpanSearch {\n const [searchQuery, setSearchQueryRaw] = useState('');\n const [focusedMatchIndex, setFocusedMatchIndex] = useState(0);\n\n const matchingSpanIds = useMemo(() => {\n if (searchQuery.length === 0) return [];\n\n const query = searchQuery.toLowerCase();\n const matches: string[] = [];\n forEachSpan(trace.rootSpans, (span) => {\n if (spanMatchesQuery(span, query)) {\n matches.push(span.spanId);\n }\n });\n return matches;\n }, [searchQuery, trace.rootSpans]);\n\n const setSearchQuery = useCallback((query: string) => {\n setSearchQueryRaw(query);\n setFocusedMatchIndex(0);\n }, []);\n\n return { searchQuery, setSearchQuery, matchingSpanIds, focusedMatchIndex, setFocusedMatchIndex };\n}\n"],"names":["IconButton","InputAdornment","Stack","TextField","ChevronUp","ChevronDown","Close","useCallback","useMemo","useState","renderAttributeValue","forEachSpan","SearchBar","props","search","searchQuery","setSearchQuery","matchingSpanIds","focusedMatchIndex","setFocusedMatchIndex","hasQuery","length","matchCount","hasMatches","handlePrev","handleNext","handleKeyDown","e","key","preventDefault","shiftKey","direction","sx","alignItems","gap","minWidth","size","placeholder","value","onChange","target","onKeyDown","slotProps","input","endAdornment","position","visibility","whiteSpace","disabled","aria-label","onClick","spanMatchesQuery","span","query","attrMatches","attr","toLowerCase","includes","resource","serviceName","name","spanId","attributes","some","useSpanSearch","trace","setSearchQueryRaw","matches","rootSpans","push"],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { Trace } from './trace';
|
|
3
|
+
import { SpanSearch } from './Search';
|
|
4
|
+
export interface TraceHeaderBarProps {
|
|
5
|
+
trace: Trace;
|
|
6
|
+
search: SpanSearch;
|
|
7
|
+
}
|
|
8
|
+
export declare function TraceHeaderBar(props: TraceHeaderBarProps): ReactElement;
|
|
9
|
+
//# sourceMappingURL=TraceHeaderBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TraceHeaderBar.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/TraceHeaderBar.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAa,UAAU,EAAE,MAAM,UAAU,CAAC;AAajD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAuCvE"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { IconButton, Stack, Typography } from '@mui/material';
|
|
15
|
+
import MagnifyIcon from 'mdi-material-ui/Magnify';
|
|
16
|
+
import { useMemo, useState } from 'react';
|
|
17
|
+
import { useTimeZone } from '@perses-dev/components';
|
|
18
|
+
import { formatDuration } from './utils';
|
|
19
|
+
import { SearchBar } from './Search';
|
|
20
|
+
const DATE_FORMAT_OPTIONS = {
|
|
21
|
+
year: 'numeric',
|
|
22
|
+
month: 'long',
|
|
23
|
+
day: 'numeric',
|
|
24
|
+
hour: 'numeric',
|
|
25
|
+
minute: 'numeric',
|
|
26
|
+
second: 'numeric',
|
|
27
|
+
fractionalSecondDigits: 3,
|
|
28
|
+
timeZoneName: 'short'
|
|
29
|
+
};
|
|
30
|
+
export function TraceHeaderBar(props) {
|
|
31
|
+
const { trace, search } = props;
|
|
32
|
+
const { dateFormatOptionsWithUserTimeZone } = useTimeZone();
|
|
33
|
+
const dateFormatter = useMemo(()=>{
|
|
34
|
+
const dateFormatOptions = dateFormatOptionsWithUserTimeZone(DATE_FORMAT_OPTIONS);
|
|
35
|
+
return new Intl.DateTimeFormat(undefined, dateFormatOptions);
|
|
36
|
+
}, [
|
|
37
|
+
dateFormatOptionsWithUserTimeZone
|
|
38
|
+
]);
|
|
39
|
+
const [showSearch, setShowSearch] = useState(false);
|
|
40
|
+
const rootSpan = trace.rootSpans[0];
|
|
41
|
+
if (!rootSpan) {
|
|
42
|
+
return /*#__PURE__*/ _jsx(Typography, {
|
|
43
|
+
children: "Trace contains no spans."
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
47
|
+
direction: "column",
|
|
48
|
+
sx: {
|
|
49
|
+
gap: 1
|
|
50
|
+
},
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
53
|
+
direction: "row",
|
|
54
|
+
sx: {
|
|
55
|
+
justifyContent: 'space-between'
|
|
56
|
+
},
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
59
|
+
direction: "row",
|
|
60
|
+
sx: {
|
|
61
|
+
gap: 1,
|
|
62
|
+
alignItems: 'center'
|
|
63
|
+
},
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
66
|
+
variant: "h3",
|
|
67
|
+
children: [
|
|
68
|
+
rootSpan.resource.serviceName,
|
|
69
|
+
": ",
|
|
70
|
+
rootSpan.name,
|
|
71
|
+
" (",
|
|
72
|
+
formatDuration(trace.endTimeUnixMs - trace.startTimeUnixMs),
|
|
73
|
+
")"
|
|
74
|
+
]
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
77
|
+
size: "small",
|
|
78
|
+
onClick: ()=>setShowSearch((prev)=>!prev),
|
|
79
|
+
"aria-label": "Toggle search",
|
|
80
|
+
children: /*#__PURE__*/ _jsx(MagnifyIcon, {
|
|
81
|
+
fontSize: "small"
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
87
|
+
variant: "h4",
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
90
|
+
component: "span",
|
|
91
|
+
sx: {
|
|
92
|
+
px: 1
|
|
93
|
+
},
|
|
94
|
+
children: [
|
|
95
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
96
|
+
children: "Start:"
|
|
97
|
+
}),
|
|
98
|
+
" ",
|
|
99
|
+
dateFormatter.format(trace.startTimeUnixMs)
|
|
100
|
+
]
|
|
101
|
+
}),
|
|
102
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
103
|
+
component: "span",
|
|
104
|
+
sx: {
|
|
105
|
+
px: 1
|
|
106
|
+
},
|
|
107
|
+
children: [
|
|
108
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
109
|
+
children: "Trace ID:"
|
|
110
|
+
}),
|
|
111
|
+
" ",
|
|
112
|
+
rootSpan.traceId
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
}),
|
|
119
|
+
showSearch && /*#__PURE__*/ _jsx(SearchBar, {
|
|
120
|
+
search: search
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=TraceHeaderBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/TraceHeaderBar.tsx"],"sourcesContent":["// Copyright 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 { IconButton, Stack, Typography } from '@mui/material';\nimport MagnifyIcon from 'mdi-material-ui/Magnify';\nimport { ReactElement, useMemo, useState } from 'react';\nimport { useTimeZone } from '@perses-dev/components';\nimport { formatDuration } from './utils';\nimport { Trace } from './trace';\nimport { SearchBar, SpanSearch } from './Search';\n\nconst DATE_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n timeZoneName: 'short',\n};\n\nexport interface TraceHeaderBarProps {\n trace: Trace;\n search: SpanSearch;\n}\n\nexport function TraceHeaderBar(props: TraceHeaderBarProps): ReactElement {\n const { trace, search } = props;\n\n const { dateFormatOptionsWithUserTimeZone } = useTimeZone();\n const dateFormatter = useMemo(() => {\n const dateFormatOptions = dateFormatOptionsWithUserTimeZone(DATE_FORMAT_OPTIONS);\n return new Intl.DateTimeFormat(undefined, dateFormatOptions);\n }, [dateFormatOptionsWithUserTimeZone]);\n const [showSearch, setShowSearch] = useState(false);\n\n const rootSpan = trace.rootSpans[0];\n if (!rootSpan) {\n return <Typography>Trace contains no spans.</Typography>;\n }\n\n return (\n <Stack direction=\"column\" sx={{ gap: 1 }}>\n <Stack direction=\"row\" sx={{ justifyContent: 'space-between' }}>\n <Stack direction=\"row\" sx={{ gap: 1, alignItems: 'center' }}>\n <Typography variant=\"h3\">\n {rootSpan.resource.serviceName}: {rootSpan.name} (\n {formatDuration(trace.endTimeUnixMs - trace.startTimeUnixMs)})\n </Typography>\n <IconButton size=\"small\" onClick={() => setShowSearch((prev) => !prev)} aria-label=\"Toggle search\">\n <MagnifyIcon fontSize=\"small\" />\n </IconButton>\n </Stack>\n <Typography variant=\"h4\">\n <Typography component=\"span\" sx={{ px: 1 }}>\n <strong>Start:</strong> {dateFormatter.format(trace.startTimeUnixMs)}\n </Typography>\n <Typography component=\"span\" sx={{ px: 1 }}>\n <strong>Trace ID:</strong> {rootSpan.traceId}\n </Typography>\n </Typography>\n </Stack>\n {showSearch && <SearchBar search={search} />}\n </Stack>\n );\n}\n"],"names":["IconButton","Stack","Typography","MagnifyIcon","useMemo","useState","useTimeZone","formatDuration","SearchBar","DATE_FORMAT_OPTIONS","year","month","day","hour","minute","second","fractionalSecondDigits","timeZoneName","TraceHeaderBar","props","trace","search","dateFormatOptionsWithUserTimeZone","dateFormatter","dateFormatOptions","Intl","DateTimeFormat","undefined","showSearch","setShowSearch","rootSpan","rootSpans","direction","sx","gap","justifyContent","alignItems","variant","resource","serviceName","name","endTimeUnixMs","startTimeUnixMs","size","onClick","prev","aria-label","fontSize","component","px","strong","format","traceId"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAC9D,OAAOC,iBAAiB,0BAA0B;AAClD,SAAuBC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACxD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,cAAc,QAAQ,UAAU;AAEzC,SAASC,SAAS,QAAoB,WAAW;AAEjD,MAAMC,sBAAkD;IACtDC,MAAM;IACNC,OAAO;IACPC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,wBAAwB;IACxBC,cAAc;AAChB;AAOA,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGF;IAE1B,MAAM,EAAEG,iCAAiC,EAAE,GAAGhB;IAC9C,MAAMiB,gBAAgBnB,QAAQ;QAC5B,MAAMoB,oBAAoBF,kCAAkCb;QAC5D,OAAO,IAAIgB,KAAKC,cAAc,CAACC,WAAWH;IAC5C,GAAG;QAACF;KAAkC;IACtC,MAAM,CAACM,YAAYC,cAAc,GAAGxB,SAAS;IAE7C,MAAMyB,WAAWV,MAAMW,SAAS,CAAC,EAAE;IACnC,IAAI,CAACD,UAAU;QACb,qBAAO,KAAC5B;sBAAW;;IACrB;IAEA,qBACE,MAACD;QAAM+B,WAAU;QAASC,IAAI;YAAEC,KAAK;QAAE;;0BACrC,MAACjC;gBAAM+B,WAAU;gBAAMC,IAAI;oBAAEE,gBAAgB;gBAAgB;;kCAC3D,MAAClC;wBAAM+B,WAAU;wBAAMC,IAAI;4BAAEC,KAAK;4BAAGE,YAAY;wBAAS;;0CACxD,MAAClC;gCAAWmC,SAAQ;;oCACjBP,SAASQ,QAAQ,CAACC,WAAW;oCAAC;oCAAGT,SAASU,IAAI;oCAAC;oCAC/CjC,eAAea,MAAMqB,aAAa,GAAGrB,MAAMsB,eAAe;oCAAE;;;0CAE/D,KAAC1C;gCAAW2C,MAAK;gCAAQC,SAAS,IAAMf,cAAc,CAACgB,OAAS,CAACA;gCAAOC,cAAW;0CACjF,cAAA,KAAC3C;oCAAY4C,UAAS;;;;;kCAG1B,MAAC7C;wBAAWmC,SAAQ;;0CAClB,MAACnC;gCAAW8C,WAAU;gCAAOf,IAAI;oCAAEgB,IAAI;gCAAE;;kDACvC,KAACC;kDAAO;;oCAAe;oCAAE3B,cAAc4B,MAAM,CAAC/B,MAAMsB,eAAe;;;0CAErE,MAACxC;gCAAW8C,WAAU;gCAAOf,IAAI;oCAAEgB,IAAI;gCAAE;;kDACvC,KAACC;kDAAO;;oCAAkB;oCAAEpB,SAASsB,OAAO;;;;;;;YAIjDxB,4BAAc,KAACpB;gBAAUa,QAAQA;;;;AAGxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';
|
|
3
3
|
import { CustomLinks, TracingGanttChartOptions } from '../gantt-chart-model';
|
|
4
4
|
export interface TracingGanttChartProps {
|
|
5
5
|
options: TracingGanttChartOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TracingGanttChart.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;AAEhE,OAAO,
|
|
1
|
+
{"version":3,"file":"TracingGanttChart.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;AAEhE,OAAO,KAAK,WAAW,MAAM,gEAAgE,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAW7E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,wBAAwB,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAiE7E"}
|
|
@@ -12,14 +12,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
import { useMemo, useRef, useState } from 'react';
|
|
15
|
-
import { Box, Stack
|
|
15
|
+
import { Box, Stack } from '@mui/material';
|
|
16
16
|
import { MiniGanttChart } from './MiniGanttChart/MiniGanttChart';
|
|
17
17
|
import { DetailPane } from './DetailPane/DetailPane';
|
|
18
18
|
import { GanttTable } from './GanttTable/GanttTable';
|
|
19
19
|
import { GanttTableProvider } from './GanttTable/GanttTableProvider';
|
|
20
20
|
import { ResizableDivider } from './GanttTable/ResizableDivider';
|
|
21
21
|
import { getTraceModel } from './trace';
|
|
22
|
-
import {
|
|
22
|
+
import { TraceHeaderBar } from './TraceHeaderBar';
|
|
23
|
+
import { useSpanSearch } from './Search';
|
|
23
24
|
/**
|
|
24
25
|
* The core GanttChart panel for Perses.
|
|
25
26
|
*
|
|
@@ -27,7 +28,6 @@ import { TraceDetails } from './TraceDetails';
|
|
|
27
28
|
* https://github.com/jaegertracing/jaeger-ui
|
|
28
29
|
*/ export function TracingGanttChart(props) {
|
|
29
30
|
const { options, customLinks, trace: otlpTrace } = props;
|
|
30
|
-
const theme = useTheme();
|
|
31
31
|
const trace = useMemo(()=>{
|
|
32
32
|
try {
|
|
33
33
|
return getTraceModel(otlpTrace);
|
|
@@ -42,11 +42,13 @@ import { TraceDetails } from './TraceDetails';
|
|
|
42
42
|
endTimeUnixMs: trace.endTimeUnixMs
|
|
43
43
|
});
|
|
44
44
|
const [selectedSpan, setSelectedSpan] = useState(()=>options.selectedSpanId ? trace.spanById.get(options.selectedSpanId) : undefined);
|
|
45
|
+
const search = useSpanSearch(trace);
|
|
45
46
|
const ganttChart = useRef(null);
|
|
46
47
|
// tableWidth only comes to effect if the detail pane is visible.
|
|
47
48
|
// setTableWidth() is only called by <ResizableDivider />
|
|
48
49
|
const [tableWidth, setTableWidth] = useState(0.82);
|
|
49
50
|
const gap = 2;
|
|
51
|
+
const spacing = ganttChart.current ? parseFloat(getComputedStyle(ganttChart.current).columnGap) || 0 : 0;
|
|
50
52
|
return /*#__PURE__*/ _jsxs(Stack, {
|
|
51
53
|
ref: ganttChart,
|
|
52
54
|
direction: "row",
|
|
@@ -62,8 +64,9 @@ import { TraceDetails } from './TraceDetails';
|
|
|
62
64
|
gap
|
|
63
65
|
},
|
|
64
66
|
children: [
|
|
65
|
-
/*#__PURE__*/ _jsx(
|
|
66
|
-
trace: trace
|
|
67
|
+
/*#__PURE__*/ _jsx(TraceHeaderBar, {
|
|
68
|
+
trace: trace,
|
|
69
|
+
search: search
|
|
67
70
|
}),
|
|
68
71
|
/*#__PURE__*/ _jsx(MiniGanttChart, {
|
|
69
72
|
options: options,
|
|
@@ -78,7 +81,9 @@ import { TraceDetails } from './TraceDetails';
|
|
|
78
81
|
trace: trace,
|
|
79
82
|
viewport: viewport,
|
|
80
83
|
selectedSpan: selectedSpan,
|
|
81
|
-
onSpanClick: setSelectedSpan
|
|
84
|
+
onSpanClick: setSelectedSpan,
|
|
85
|
+
matchingSpanIds: search.matchingSpanIds,
|
|
86
|
+
focusedSpanId: search.matchingSpanIds[search.focusedMatchIndex]
|
|
82
87
|
})
|
|
83
88
|
})
|
|
84
89
|
]
|
|
@@ -87,12 +92,13 @@ import { TraceDetails } from './TraceDetails';
|
|
|
87
92
|
children: [
|
|
88
93
|
/*#__PURE__*/ _jsx(ResizableDivider, {
|
|
89
94
|
parentRef: ganttChart,
|
|
90
|
-
spacing:
|
|
95
|
+
spacing: spacing,
|
|
91
96
|
onMove: setTableWidth
|
|
92
97
|
}),
|
|
93
98
|
/*#__PURE__*/ _jsx(Box, {
|
|
94
99
|
style: {
|
|
95
|
-
width: `${(1 - tableWidth) * 100}
|
|
100
|
+
width: `${(1 - tableWidth) * 100}%`,
|
|
101
|
+
minWidth: `${(1 - tableWidth) * 100}%`
|
|
96
102
|
},
|
|
97
103
|
sx: {
|
|
98
104
|
overflow: 'auto'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"sourcesContent":["// Copyright 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, useRef, useState } from 'react';\nimport { Box, Stack
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"sourcesContent":["// Copyright 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, useRef, useState } from 'react';\nimport { Box, Stack } from '@mui/material';\nimport * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';\nimport { CustomLinks, TracingGanttChartOptions } from '../gantt-chart-model';\nimport { MiniGanttChart } from './MiniGanttChart/MiniGanttChart';\nimport { DetailPane } from './DetailPane/DetailPane';\nimport { Viewport } from './utils';\nimport { GanttTable } from './GanttTable/GanttTable';\nimport { GanttTableProvider } from './GanttTable/GanttTableProvider';\nimport { ResizableDivider } from './GanttTable/ResizableDivider';\nimport { getTraceModel, Span } from './trace';\nimport { TraceHeaderBar } from './TraceHeaderBar';\nimport { useSpanSearch } from './Search';\n\nexport interface TracingGanttChartProps {\n options: TracingGanttChartOptions;\n customLinks?: CustomLinks;\n trace: otlptracev1.TracesData;\n}\n\n/**\n * The core GanttChart panel for Perses.\n *\n * The UI/UX of this panel is based on Jaeger UI, licensed under Apache License, Version 2.0.\n * https://github.com/jaegertracing/jaeger-ui\n */\nexport function TracingGanttChart(props: TracingGanttChartProps): ReactElement {\n const { options, customLinks, trace: otlpTrace } = props;\n\n const trace = useMemo(() => {\n try {\n return getTraceModel(otlpTrace);\n } catch (e) {\n throw new Error(`Error: unable to parse trace: ${e}`);\n }\n }, [otlpTrace]);\n const [viewport, setViewport] = useState<Viewport>({\n startTimeUnixMs: trace.startTimeUnixMs,\n endTimeUnixMs: trace.endTimeUnixMs,\n });\n const [selectedSpan, setSelectedSpan] = useState<Span | undefined>(() =>\n options.selectedSpanId ? trace.spanById.get(options.selectedSpanId) : undefined\n );\n const search = useSpanSearch(trace);\n\n const ganttChart = useRef<HTMLDivElement>(null);\n // tableWidth only comes to effect if the detail pane is visible.\n // setTableWidth() is only called by <ResizableDivider />\n const [tableWidth, setTableWidth] = useState<number>(0.82);\n const gap = 2;\n const spacing = ganttChart.current ? parseFloat(getComputedStyle(ganttChart.current).columnGap) || 0 : 0;\n\n return (\n <Stack ref={ganttChart} direction=\"row\" sx={{ height: '100%', minHeight: '240px', gap }}>\n <Stack sx={{ flexGrow: 1, gap }}>\n <TraceHeaderBar trace={trace} search={search} />\n <MiniGanttChart options={options} trace={trace} viewport={viewport} setViewport={setViewport} />\n <GanttTableProvider>\n <GanttTable\n options={options}\n customLinks={customLinks}\n trace={trace}\n viewport={viewport}\n selectedSpan={selectedSpan}\n onSpanClick={setSelectedSpan}\n matchingSpanIds={search.matchingSpanIds}\n focusedSpanId={search.matchingSpanIds[search.focusedMatchIndex]}\n />\n </GanttTableProvider>\n </Stack>\n {selectedSpan && (\n <>\n <ResizableDivider parentRef={ganttChart} spacing={spacing} onMove={setTableWidth} />\n <Box\n style={{\n width: `${(1 - tableWidth) * 100}%`,\n minWidth: `${(1 - tableWidth) * 100}%`,\n }}\n sx={{ overflow: 'auto' }}\n >\n <DetailPane\n customLinks={customLinks}\n trace={trace}\n span={selectedSpan}\n onCloseBtnClick={() => setSelectedSpan(undefined)}\n />\n </Box>\n </>\n )}\n </Stack>\n );\n}\n"],"names":["useMemo","useRef","useState","Box","Stack","MiniGanttChart","DetailPane","GanttTable","GanttTableProvider","ResizableDivider","getTraceModel","TraceHeaderBar","useSpanSearch","TracingGanttChart","props","options","customLinks","trace","otlpTrace","e","Error","viewport","setViewport","startTimeUnixMs","endTimeUnixMs","selectedSpan","setSelectedSpan","selectedSpanId","spanById","get","undefined","search","ganttChart","tableWidth","setTableWidth","gap","spacing","current","parseFloat","getComputedStyle","columnGap","ref","direction","sx","height","minHeight","flexGrow","onSpanClick","matchingSpanIds","focusedSpanId","focusedMatchIndex","parentRef","onMove","style","width","minWidth","overflow","span","onCloseBtnClick"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAuBA,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,GAAG,EAAEC,KAAK,QAAQ,gBAAgB;AAG3C,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,aAAa,QAAc,UAAU;AAC9C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,aAAa,QAAQ,WAAW;AAQzC;;;;;CAKC,GACD,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,OAAOC,SAAS,EAAE,GAAGJ;IAEnD,MAAMG,QAAQjB,QAAQ;QACpB,IAAI;YACF,OAAOU,cAAcQ;QACvB,EAAE,OAAOC,GAAG;YACV,MAAM,IAAIC,MAAM,CAAC,8BAA8B,EAAED,GAAG;QACtD;IACF,GAAG;QAACD;KAAU;IACd,MAAM,CAACG,UAAUC,YAAY,GAAGpB,SAAmB;QACjDqB,iBAAiBN,MAAMM,eAAe;QACtCC,eAAeP,MAAMO,aAAa;IACpC;IACA,MAAM,CAACC,cAAcC,gBAAgB,GAAGxB,SAA2B,IACjEa,QAAQY,cAAc,GAAGV,MAAMW,QAAQ,CAACC,GAAG,CAACd,QAAQY,cAAc,IAAIG;IAExE,MAAMC,SAASnB,cAAcK;IAE7B,MAAMe,aAAa/B,OAAuB;IAC1C,iEAAiE;IACjE,yDAAyD;IACzD,MAAM,CAACgC,YAAYC,cAAc,GAAGhC,SAAiB;IACrD,MAAMiC,MAAM;IACZ,MAAMC,UAAUJ,WAAWK,OAAO,GAAGC,WAAWC,iBAAiBP,WAAWK,OAAO,EAAEG,SAAS,KAAK,IAAI;IAEvG,qBACE,MAACpC;QAAMqC,KAAKT;QAAYU,WAAU;QAAMC,IAAI;YAAEC,QAAQ;YAAQC,WAAW;YAASV;QAAI;;0BACpF,MAAC/B;gBAAMuC,IAAI;oBAAEG,UAAU;oBAAGX;gBAAI;;kCAC5B,KAACxB;wBAAeM,OAAOA;wBAAOc,QAAQA;;kCACtC,KAAC1B;wBAAeU,SAASA;wBAASE,OAAOA;wBAAOI,UAAUA;wBAAUC,aAAaA;;kCACjF,KAACd;kCACC,cAAA,KAACD;4BACCQ,SAASA;4BACTC,aAAaA;4BACbC,OAAOA;4BACPI,UAAUA;4BACVI,cAAcA;4BACdsB,aAAarB;4BACbsB,iBAAiBjB,OAAOiB,eAAe;4BACvCC,eAAelB,OAAOiB,eAAe,CAACjB,OAAOmB,iBAAiB,CAAC;;;;;YAIpEzB,8BACC;;kCACE,KAAChB;wBAAiB0C,WAAWnB;wBAAYI,SAASA;wBAASgB,QAAQlB;;kCACnE,KAAC/B;wBACCkD,OAAO;4BACLC,OAAO,GAAG,AAAC,CAAA,IAAIrB,UAAS,IAAK,IAAI,CAAC,CAAC;4BACnCsB,UAAU,GAAG,AAAC,CAAA,IAAItB,UAAS,IAAK,IAAI,CAAC,CAAC;wBACxC;wBACAU,IAAI;4BAAEa,UAAU;wBAAO;kCAEvB,cAAA,KAAClD;4BACCU,aAAaA;4BACbC,OAAOA;4BACPwC,MAAMhC;4BACNiC,iBAAiB,IAAMhC,gBAAgBI;;;;;;;AAOrD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';
|
|
2
|
+
import * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';
|
|
2
3
|
/** holds the trace and computed properties required for the Gantt chart */
|
|
3
4
|
export interface Trace {
|
|
4
5
|
trace: otlptracev1.TracesData;
|
|
@@ -49,4 +50,9 @@ export interface Link {
|
|
|
49
50
|
* Time complexity: O(2n)
|
|
50
51
|
*/
|
|
51
52
|
export declare function getTraceModel(trace: otlptracev1.TracesData): Trace;
|
|
53
|
+
/**
|
|
54
|
+
* Recursively iterates all spans depth-first.
|
|
55
|
+
* Return false from the callback to skip a span's children.
|
|
56
|
+
*/
|
|
57
|
+
export declare function forEachSpan(spans: Span[], fn: (span: Span) => boolean | void): void;
|
|
52
58
|
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/trace.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/trace.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,WAAW,MAAM,gEAAgE,CAAC;AAI9F,2EAA2E;AAC3E,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC;IAE9B;;;OAGG;IACH,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC,oBAAoB,CAAC;IACzC,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,uCAAuC;IACvC,UAAU,EAAE,IAAI,EAAE,CAAC;IAEnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,KAAK;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,GAAG,KAAK,CAmDlE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,GAAG,IAAI,GAAG,IAAI,CAMnF"}
|
|
@@ -66,6 +66,16 @@ import { sortedIndexBy } from 'lodash';
|
|
|
66
66
|
endTimeUnixMs
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Recursively iterates all spans depth-first.
|
|
71
|
+
* Return false from the callback to skip a span's children.
|
|
72
|
+
*/ export function forEachSpan(spans, fn) {
|
|
73
|
+
for (const span of spans){
|
|
74
|
+
if (fn(span) !== false) {
|
|
75
|
+
forEachSpan(span.childSpans, fn);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
69
79
|
function parseResource(resource) {
|
|
70
80
|
let serviceName = 'unknown';
|
|
71
81
|
for (const attr of resource?.attributes ?? []){
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/trace.ts"],"sourcesContent":["// Copyright 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
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/trace.ts"],"sourcesContent":["// Copyright 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 * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';\nimport * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';\nimport * as otlpresourcev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/resource/v1/resource';\nimport { sortedIndexBy } from 'lodash';\n\n/** holds the trace and computed properties required for the Gantt chart */\nexport interface Trace {\n trace: otlptracev1.TracesData;\n\n /**\n * if a trace is incomplete (e.g. a parent span has not been received yet),\n * this branch of the span tree will be appended to the root\n */\n rootSpans: Span[];\n spanById: Map<string, Span>;\n startTimeUnixMs: number;\n endTimeUnixMs: number;\n}\n\nexport interface Span {\n resource: Resource;\n scope: otlpcommonv1.InstrumentationScope;\n parentSpan?: Span;\n /** child spans, sorted by startTime */\n childSpans: Span[];\n\n traceId: string;\n spanId: string;\n parentSpanId?: string;\n name: string;\n kind?: string;\n startTimeUnixMs: number;\n endTimeUnixMs: number;\n attributes: otlpcommonv1.KeyValue[];\n events: Event[];\n links: Link[];\n status: otlptracev1.Status;\n}\n\nexport interface Resource {\n serviceName?: string;\n attributes: otlpcommonv1.KeyValue[];\n}\n\nexport interface Event {\n timeUnixMs: number;\n name: string;\n attributes: otlpcommonv1.KeyValue[];\n}\n\nexport interface Link {\n traceId: string;\n spanId: string;\n attributes: otlpcommonv1.KeyValue[];\n}\n\n/**\n * getTraceModel builds a tree of spans from an OTLP trace,\n * and precomputes common fields, for example the start and end time of a trace.\n * Time complexity: O(2n)\n */\nexport function getTraceModel(trace: otlptracev1.TracesData): Trace {\n // first pass: build lookup table <spanId, Span> and compute min/max\n const spanById = new Map<string, Span>();\n const rootSpans: Span[] = [];\n let startTimeUnixMs: number = 0;\n let endTimeUnixMs: number = 0;\n for (const resourceSpan of trace.resourceSpans) {\n const resource = parseResource(resourceSpan.resource);\n\n for (const scopeSpan of resourceSpan.scopeSpans) {\n const scope = parseScope(scopeSpan.scope);\n\n for (const otelSpan of scopeSpan.spans) {\n const span: Span = {\n resource,\n scope,\n childSpans: [],\n ...parseSpan(otelSpan),\n };\n spanById.set(otelSpan.spanId, span);\n\n if (startTimeUnixMs === 0 || span.startTimeUnixMs < startTimeUnixMs) {\n startTimeUnixMs = span.startTimeUnixMs;\n }\n if (endTimeUnixMs === 0 || span.endTimeUnixMs > endTimeUnixMs) {\n endTimeUnixMs = span.endTimeUnixMs;\n }\n }\n }\n }\n\n // second pass: build tree based on parentSpanId property\n for (const [, span] of spanById) {\n if (!span.parentSpanId) {\n rootSpans.push(span);\n continue;\n }\n\n const parent = spanById.get(span.parentSpanId);\n if (!parent) {\n console.trace(`span ${span.spanId} has parent ${span.parentSpanId} which has not been received yet`);\n rootSpans.push(span);\n continue;\n }\n\n span.parentSpan = parent;\n const insertChildSpanAt = sortedIndexBy(parent.childSpans, span, (s) => s.startTimeUnixMs);\n parent.childSpans.splice(insertChildSpanAt, 0, span);\n }\n\n return { trace, rootSpans, spanById, startTimeUnixMs, endTimeUnixMs };\n}\n\n/**\n * Recursively iterates all spans depth-first.\n * Return false from the callback to skip a span's children.\n */\nexport function forEachSpan(spans: Span[], fn: (span: Span) => boolean | void): void {\n for (const span of spans) {\n if (fn(span) !== false) {\n forEachSpan(span.childSpans, fn);\n }\n }\n}\n\nfunction parseResource(resource?: otlpresourcev1.Resource): Resource {\n let serviceName = 'unknown';\n for (const attr of resource?.attributes ?? []) {\n if (attr.key === 'service.name' && 'stringValue' in attr.value) {\n serviceName = attr.value.stringValue;\n break;\n }\n }\n\n return {\n serviceName,\n attributes: resource?.attributes ?? [],\n };\n}\n\nfunction parseScope(scope?: otlpcommonv1.InstrumentationScope): otlpcommonv1.InstrumentationScope {\n return scope ?? {};\n}\n\n/**\n * parseSpan parses the Span API type to the internal representation\n * i.e. convert strings to numbers etc.\n */\nfunction parseSpan(span: otlptracev1.Span): Omit<Span, 'resource' | 'scope' | 'childSpans'> {\n return {\n traceId: span.traceId,\n spanId: span.spanId,\n parentSpanId: span.parentSpanId,\n name: span.name,\n kind: span.kind,\n startTimeUnixMs: parseInt(span.startTimeUnixNano) * 1e-6, // convert to milliseconds because JS cannot handle numbers larger than 9007199254740991\n endTimeUnixMs: parseInt(span.endTimeUnixNano) * 1e-6,\n attributes: span.attributes ?? [],\n events: (span.events ?? []).map(parseEvent),\n links: (span.links ?? []).map(parseLink),\n status: span.status ?? {},\n };\n}\n\nfunction parseEvent(event: otlptracev1.Event): Event {\n return {\n timeUnixMs: parseInt(event.timeUnixNano) * 1e-6, // convert to milliseconds because JS cannot handle numbers larger than 9007199254740991\n name: event.name,\n attributes: event.attributes ?? [],\n };\n}\n\nfunction parseLink(link: otlptracev1.Link): Link {\n return {\n traceId: link.traceId,\n spanId: link.spanId,\n attributes: link.attributes ?? [],\n };\n}\n"],"names":["sortedIndexBy","getTraceModel","trace","spanById","Map","rootSpans","startTimeUnixMs","endTimeUnixMs","resourceSpan","resourceSpans","resource","parseResource","scopeSpan","scopeSpans","scope","parseScope","otelSpan","spans","span","childSpans","parseSpan","set","spanId","parentSpanId","push","parent","get","console","parentSpan","insertChildSpanAt","s","splice","forEachSpan","fn","serviceName","attr","attributes","key","value","stringValue","traceId","name","kind","parseInt","startTimeUnixNano","endTimeUnixNano","events","map","parseEvent","links","parseLink","status","event","timeUnixMs","timeUnixNano","link"],"mappings":"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"}
|
|
@@ -10,7 +10,7 @@
|
|
|
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
|
-
import
|
|
13
|
+
import * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';
|
|
14
14
|
import { getConsistentCategoricalColor, getConsistentColor } from './palette';
|
|
15
15
|
/** minimum span width, i.e. increase width if the calculated width is too small to be visible */ export const minSpanWidthPx = 2;
|
|
16
16
|
export const rowHeight = '2rem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/utils.ts"],"sourcesContent":["// Copyright 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 { PersesChartsTheme } from '@perses-dev/components';\nimport { Theme } from '@mui/material';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/utils.ts"],"sourcesContent":["// Copyright 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 { PersesChartsTheme } from '@perses-dev/components';\nimport { Theme } from '@mui/material';\nimport * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';\nimport { getConsistentCategoricalColor, getConsistentColor } from './palette';\nimport { Span } from './trace';\n\n/**\n * Viewport contains the current zoom, i.e. which timeframe of the trace should be visible\n */\nexport interface Viewport {\n startTimeUnixMs: number;\n endTimeUnixMs: number;\n}\n\n/** minimum span width, i.e. increase width if the calculated width is too small to be visible */\nexport const minSpanWidthPx = 2;\nexport const rowHeight = '2rem';\nexport const spanHasError = (span: Span): boolean => span.status?.code === otlptracev1.StatusCodeError;\n\nexport function getServiceColor(\n muiTheme: Theme,\n chartsTheme: PersesChartsTheme,\n paletteMode: 'auto' | 'categorical' | undefined,\n serviceName: string,\n error = false\n): string {\n switch (paletteMode) {\n case 'categorical': {\n // ECharts type for color is not always an array but it is always an array in ChartsProvider\n const categoricalPalette = chartsTheme.echartsTheme.color as string[];\n const errorPalette = [muiTheme.palette.error.light, muiTheme.palette.error.main, muiTheme.palette.error.dark];\n return getConsistentCategoricalColor(serviceName, error, categoricalPalette, errorPalette);\n }\n\n default:\n return getConsistentColor(serviceName, error);\n }\n}\n\nexport function getSpanColor(\n muiTheme: Theme,\n chartsTheme: PersesChartsTheme,\n paletteMode: 'auto' | 'categorical' | undefined,\n span: Span\n): string {\n return getServiceColor(muiTheme, chartsTheme, paletteMode, span.resource.serviceName ?? '', spanHasError(span));\n}\n\nexport function formatDuration(timeMs: number): string {\n if (timeMs < 1) {\n return `${Math.round(timeMs * 1000)}μs`;\n }\n if (timeMs < 1000) {\n return `${+timeMs.toFixed(2)}ms`;\n }\n return `${+(timeMs / 1000).toFixed(2)}s`;\n}\n"],"names":["otlptracev1","getConsistentCategoricalColor","getConsistentColor","minSpanWidthPx","rowHeight","spanHasError","span","status","code","StatusCodeError","getServiceColor","muiTheme","chartsTheme","paletteMode","serviceName","error","categoricalPalette","echartsTheme","color","errorPalette","palette","light","main","dark","getSpanColor","resource","formatDuration","timeMs","Math","round","toFixed"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,YAAYA,iBAAiB,iEAAiE;AAC9F,SAASC,6BAA6B,EAAEC,kBAAkB,QAAQ,YAAY;AAW9E,+FAA+F,GAC/F,OAAO,MAAMC,iBAAiB,EAAE;AAChC,OAAO,MAAMC,YAAY,OAAO;AAChC,OAAO,MAAMC,eAAe,CAACC,OAAwBA,KAAKC,MAAM,EAAEC,SAASR,YAAYS,eAAe,CAAC;AAEvG,OAAO,SAASC,gBACdC,QAAe,EACfC,WAA8B,EAC9BC,WAA+C,EAC/CC,WAAmB,EACnBC,QAAQ,KAAK;IAEb,OAAQF;QACN,KAAK;YAAe;gBAClB,4FAA4F;gBAC5F,MAAMG,qBAAqBJ,YAAYK,YAAY,CAACC,KAAK;gBACzD,MAAMC,eAAe;oBAACR,SAASS,OAAO,CAACL,KAAK,CAACM,KAAK;oBAAEV,SAASS,OAAO,CAACL,KAAK,CAACO,IAAI;oBAAEX,SAASS,OAAO,CAACL,KAAK,CAACQ,IAAI;iBAAC;gBAC7G,OAAOtB,8BAA8Ba,aAAaC,OAAOC,oBAAoBG;YAC/E;QAEA;YACE,OAAOjB,mBAAmBY,aAAaC;IAC3C;AACF;AAEA,OAAO,SAASS,aACdb,QAAe,EACfC,WAA8B,EAC9BC,WAA+C,EAC/CP,IAAU;IAEV,OAAOI,gBAAgBC,UAAUC,aAAaC,aAAaP,KAAKmB,QAAQ,CAACX,WAAW,IAAI,IAAIT,aAAaC;AAC3G;AAEA,OAAO,SAASoB,eAAeC,MAAc;IAC3C,IAAIA,SAAS,GAAG;QACd,OAAO,GAAGC,KAAKC,KAAK,CAACF,SAAS,MAAM,EAAE,CAAC;IACzC;IACA,IAAIA,SAAS,MAAM;QACjB,OAAO,GAAG,CAACA,OAAOG,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC;IACA,OAAO,GAAG,CAAC,AAACH,CAAAA,SAAS,IAAG,EAAGG,OAAO,CAAC,GAAG,CAAC,CAAC;AAC1C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PanelProps } from '@perses-dev/plugin-system';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
|
-
import { TraceData } from '@perses-dev/
|
|
3
|
+
import { TraceData } from '@perses-dev/spec';
|
|
4
4
|
import { TracingGanttChartOptions } from './gantt-chart-model';
|
|
5
5
|
export type TracingGanttChartPanelProps = PanelProps<TracingGanttChartOptions, TraceData>;
|
|
6
6
|
export declare function TracingGanttChartPanel(props: TracingGanttChartPanelProps): ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TracingGanttChartPanel.tsx"],"sourcesContent":["// Copyright 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 { PanelProps } from '@perses-dev/plugin-system';\nimport { NoDataOverlay, TextOverlay, useChartsTheme } from '@perses-dev/components';\nimport { Box } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TraceData } from '@perses-dev/
|
|
1
|
+
{"version":3,"sources":["../../src/TracingGanttChartPanel.tsx"],"sourcesContent":["// Copyright 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 { PanelProps } from '@perses-dev/plugin-system';\nimport { NoDataOverlay, TextOverlay, useChartsTheme } from '@perses-dev/components';\nimport { Box } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TraceData } from '@perses-dev/spec';\nimport { CustomLinks, TracingGanttChartOptions } from './gantt-chart-model';\nimport { TracingGanttChart } from './TracingGanttChart/TracingGanttChart';\n\nexport type TracingGanttChartPanelProps = PanelProps<TracingGanttChartOptions, TraceData>;\n\nexport function TracingGanttChartPanel(props: TracingGanttChartPanelProps): ReactElement {\n const { spec, queryResults } = props;\n const chartsTheme = useChartsTheme();\n const contentPadding = chartsTheme.container.padding.default;\n\n if (queryResults.length > 1) {\n return <TextOverlay message=\"This panel does not support more than one query.\" />;\n }\n\n if (queryResults[0]?.data.searchResult) {\n return (\n <TextOverlay message=\"This panel does not support displaying trace search results. Please enter a trace id in the query field instead.\" />\n );\n }\n\n const trace = queryResults[0]?.data.trace;\n if (!trace) {\n return <NoDataOverlay resource=\"trace\" />;\n }\n\n const pluginSpec = queryResults[0]?.definition.spec.plugin.spec as { datasource?: { name?: string } } | undefined;\n const datasourceName = pluginSpec?.datasource?.name;\n const customLinks: CustomLinks | undefined = spec.links\n ? {\n variables: {\n datasourceName: datasourceName ?? '',\n },\n links: spec.links,\n }\n : undefined;\n\n return (\n <Box sx={{ height: '100%', padding: `${contentPadding}px` }}>\n <TracingGanttChart options={spec} customLinks={customLinks} trace={trace} />\n </Box>\n );\n}\n"],"names":["NoDataOverlay","TextOverlay","useChartsTheme","Box","TracingGanttChart","TracingGanttChartPanel","props","spec","queryResults","chartsTheme","contentPadding","container","padding","default","length","message","data","searchResult","trace","resource","pluginSpec","definition","plugin","datasourceName","datasource","name","customLinks","links","variables","undefined","sx","height","options"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,aAAa,EAAEC,WAAW,EAAEC,cAAc,QAAQ,yBAAyB;AACpF,SAASC,GAAG,QAAQ,gBAAgB;AAIpC,SAASC,iBAAiB,QAAQ,wCAAwC;AAI1E,OAAO,SAASC,uBAAuBC,KAAkC;IACvE,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAE,GAAGF;IAC/B,MAAMG,cAAcP;IACpB,MAAMQ,iBAAiBD,YAAYE,SAAS,CAACC,OAAO,CAACC,OAAO;IAE5D,IAAIL,aAAaM,MAAM,GAAG,GAAG;QAC3B,qBAAO,KAACb;YAAYc,SAAQ;;IAC9B;IAEA,IAAIP,YAAY,CAAC,EAAE,EAAEQ,KAAKC,cAAc;QACtC,qBACE,KAAChB;YAAYc,SAAQ;;IAEzB;IAEA,MAAMG,QAAQV,YAAY,CAAC,EAAE,EAAEQ,KAAKE;IACpC,IAAI,CAACA,OAAO;QACV,qBAAO,KAAClB;YAAcmB,UAAS;;IACjC;IAEA,MAAMC,aAAaZ,YAAY,CAAC,EAAE,EAAEa,WAAWd,KAAKe,OAAOf;IAC3D,MAAMgB,iBAAiBH,YAAYI,YAAYC;IAC/C,MAAMC,cAAuCnB,KAAKoB,KAAK,GACnD;QACEC,WAAW;YACTL,gBAAgBA,kBAAkB;QACpC;QACAI,OAAOpB,KAAKoB,KAAK;IACnB,IACAE;IAEJ,qBACE,KAAC1B;QAAI2B,IAAI;YAAEC,QAAQ;YAAQnB,SAAS,GAAGF,eAAe,EAAE,CAAC;QAAC;kBACxD,cAAA,KAACN;YAAkB4B,SAASzB;YAAMmB,aAAaA;YAAaR,OAAOA;;;AAGzE"}
|