@perses-dev/tracing-gantt-chart-plugin 0.6.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/LICENSE +201 -0
- package/README.md +41 -0
- package/__mf/css/async/341.6c6463ea.css +1 -0
- package/__mf/css/async/759.6c6463ea.css +1 -0
- 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/788.91bbf7bd.js +5 -0
- package/__mf/js/TracingGanttChart.1a922a19.js +5 -0
- package/__mf/js/async/156.5a401ecb.js +1 -0
- package/__mf/js/async/173.6314a363.js +2 -0
- package/__mf/js/async/173.6314a363.js.LICENSE.txt +19 -0
- package/__mf/js/async/620.1d1ce390.js +2 -0
- package/__mf/js/async/620.1d1ce390.js.LICENSE.txt +9 -0
- package/__mf/js/async/651.3ea371e5.js +1 -0
- package/__mf/js/async/694.4580ad20.js +1 -0
- package/__mf/js/async/740.babbb403.js +1 -0
- package/__mf/js/async/75.d81e6bbf.js +1 -0
- package/__mf/js/async/770.5431adef.js +1 -0
- package/__mf/js/async/783.3c2c57f6.js +110 -0
- package/__mf/js/async/783.3c2c57f6.js.LICENSE.txt +27 -0
- package/__mf/js/async/844.556cc34d.js +66 -0
- package/__mf/js/async/844.556cc34d.js.LICENSE.txt +84 -0
- package/__mf/js/async/928.096f73eb.js +1 -0
- package/__mf/js/async/960.478a8f11.js +2 -0
- package/__mf/js/async/960.478a8f11.js.LICENSE.txt +8 -0
- package/__mf/js/async/964.a98cab40.js +2 -0
- package/__mf/js/async/964.a98cab40.js.LICENSE.txt +9 -0
- package/__mf/js/async/981.bc5132f8.js +2 -0
- package/__mf/js/async/981.bc5132f8.js.LICENSE.txt +8 -0
- package/__mf/js/async/__federation_expose_TracingGanttChart.5ab86c44.js +1 -0
- package/__mf/js/async/lib-router.36c0d526.js +2 -0
- package/__mf/js/async/lib-router.36c0d526.js.LICENSE.txt +32 -0
- package/__mf/js/main.e75dea7b.js +1 -0
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts +9 -0
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts.map +1 -0
- package/lib/TracingGanttChart/DetailPane/Attributes.js +66 -0
- package/lib/TracingGanttChart/DetailPane/Attributes.js.map +1 -0
- package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts +14 -0
- package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts.map +1 -0
- package/lib/TracingGanttChart/DetailPane/DetailPane.js +95 -0
- package/lib/TracingGanttChart/DetailPane/DetailPane.js.map +1 -0
- package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts +8 -0
- package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts.map +1 -0
- package/lib/TracingGanttChart/DetailPane/SpanEvents.js +54 -0
- package/lib/TracingGanttChart/DetailPane/SpanEvents.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts +13 -0
- package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTable.js +93 -0
- package/lib/TracingGanttChart/GanttTable/GanttTable.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts +12 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js +56 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts +23 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js +45 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts +15 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.js +56 -0
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts +9 -0
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.js +86 -0
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts +14 -0
- package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/SpanDuration.js +75 -0
- package/lib/TracingGanttChart/GanttTable/SpanDuration.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts +14 -0
- package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/SpanIndents.js +90 -0
- package/lib/TracingGanttChart/GanttTable/SpanIndents.js.map +1 -0
- package/lib/TracingGanttChart/GanttTable/SpanName.d.ts +11 -0
- package/lib/TracingGanttChart/GanttTable/SpanName.d.ts.map +1 -0
- package/lib/TracingGanttChart/GanttTable/SpanName.js +61 -0
- package/lib/TracingGanttChart/GanttTable/SpanName.js.map +1 -0
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts +13 -0
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts.map +1 -0
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.js +243 -0
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.js.map +1 -0
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts +13 -0
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts.map +1 -0
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +51 -0
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js.map +1 -0
- package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts +3 -0
- package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts.map +1 -0
- package/lib/TracingGanttChart/MiniGanttChart/draw.js +48 -0
- package/lib/TracingGanttChart/MiniGanttChart/draw.js.map +1 -0
- package/lib/TracingGanttChart/Ticks.d.ts +16 -0
- package/lib/TracingGanttChart/Ticks.d.ts.map +1 -0
- package/lib/TracingGanttChart/Ticks.js +94 -0
- package/lib/TracingGanttChart/Ticks.js.map +1 -0
- package/lib/TracingGanttChart/TracingGanttChart.d.ts +17 -0
- package/lib/TracingGanttChart/TracingGanttChart.d.ts.map +1 -0
- package/lib/TracingGanttChart/TracingGanttChart.js +106 -0
- package/lib/TracingGanttChart/TracingGanttChart.js.map +1 -0
- package/lib/TracingGanttChart/palette.d.ts +6 -0
- package/lib/TracingGanttChart/palette.d.ts.map +1 -0
- package/lib/TracingGanttChart/palette.js +64 -0
- package/lib/TracingGanttChart/palette.js.map +1 -0
- package/lib/TracingGanttChart/trace.d.ts +45 -0
- package/lib/TracingGanttChart/trace.d.ts.map +1 -0
- package/lib/TracingGanttChart/trace.js +109 -0
- package/lib/TracingGanttChart/trace.js.map +1 -0
- package/lib/TracingGanttChart/utils.d.ts +18 -0
- package/lib/TracingGanttChart/utils.d.ts.map +1 -0
- package/lib/TracingGanttChart/utils.js +48 -0
- package/lib/TracingGanttChart/utils.js.map +1 -0
- package/lib/TracingGanttChart.d.ts +5 -0
- package/lib/TracingGanttChart.d.ts.map +1 -0
- package/lib/TracingGanttChart.js +23 -0
- package/lib/TracingGanttChart.js.map +1 -0
- package/lib/TracingGanttChartPanel.d.ts +17 -0
- package/lib/TracingGanttChartPanel.d.ts.map +1 -0
- package/lib/TracingGanttChartPanel.js +45 -0
- package/lib/TracingGanttChartPanel.js.map +1 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +19 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/TracingGanttChart/DetailPane/Attributes.js +74 -0
- package/lib/cjs/TracingGanttChart/DetailPane/DetailPane.js +106 -0
- package/lib/cjs/TracingGanttChart/DetailPane/SpanEvents.js +67 -0
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTable.js +101 -0
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableHeader.js +64 -0
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableProvider.js +60 -0
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableRow.js +64 -0
- package/lib/cjs/TracingGanttChart/GanttTable/ResizableDivider.js +94 -0
- package/lib/cjs/TracingGanttChart/GanttTable/SpanDuration.js +81 -0
- package/lib/cjs/TracingGanttChart/GanttTable/SpanIndents.js +97 -0
- package/lib/cjs/TracingGanttChart/GanttTable/SpanName.js +72 -0
- package/lib/cjs/TracingGanttChart/MiniGanttChart/Canvas.js +256 -0
- package/lib/cjs/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +59 -0
- package/lib/cjs/TracingGanttChart/MiniGanttChart/draw.js +56 -0
- package/lib/cjs/TracingGanttChart/Ticks.js +106 -0
- package/lib/cjs/TracingGanttChart/TracingGanttChart.js +109 -0
- package/lib/cjs/TracingGanttChart/palette.js +83 -0
- package/lib/cjs/TracingGanttChart/trace.js +113 -0
- package/lib/cjs/TracingGanttChart/utils.js +76 -0
- package/lib/cjs/TracingGanttChart.js +31 -0
- package/lib/cjs/TracingGanttChartPanel.js +53 -0
- package/lib/cjs/bootstrap.js +26 -0
- package/lib/cjs/env.d.js +14 -0
- package/lib/cjs/gantt-chart-model.js +28 -0
- package/lib/cjs/getPluginModule.js +27 -0
- package/lib/cjs/index-federation.js +55 -0
- package/lib/cjs/index.js +27 -0
- package/lib/cjs/setup-tests.js +19 -0
- package/lib/cjs/test/convert/jaeger.js +86 -0
- package/lib/env.d.js +15 -0
- package/lib/env.d.js.map +1 -0
- package/lib/gantt-chart-model.d.ts +17 -0
- package/lib/gantt-chart-model.d.ts.map +1 -0
- package/lib/gantt-chart-model.js +22 -0
- package/lib/gantt-chart-model.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +16 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +15 -0
- package/lib/index-federation.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +17 -0
- package/lib/setup-tests.js.map +1 -0
- package/lib/test/convert/jaeger.d.ts +41 -0
- package/lib/test/convert/jaeger.d.ts.map +1 -0
- package/lib/test/convert/jaeger.js +78 -0
- package/lib/test/convert/jaeger.js.map +1 -0
- package/mf-manifest.json +233 -0
- package/mf-stats.json +269 -0
- package/package.json +58 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "SpanDuration", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return SpanDuration;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _components = require("@perses-dev/components");
|
|
26
|
+
const _utils = require("../utils");
|
|
27
|
+
const _Ticks = require("../Ticks");
|
|
28
|
+
function SpanDuration(props) {
|
|
29
|
+
const { options, span, viewport } = props;
|
|
30
|
+
const muiTheme = (0, _material.useTheme)();
|
|
31
|
+
const chartsTheme = (0, _components.useChartsTheme)();
|
|
32
|
+
const spanDuration = span.endTimeUnixMs - span.startTimeUnixMs;
|
|
33
|
+
const viewportDuration = viewport.endTimeUnixMs - viewport.startTimeUnixMs;
|
|
34
|
+
const relativeDuration = spanDuration / viewportDuration;
|
|
35
|
+
const relativeStart = (span.startTimeUnixMs - viewport.startTimeUnixMs) / viewportDuration;
|
|
36
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
37
|
+
sx: {
|
|
38
|
+
position: 'relative',
|
|
39
|
+
height: '100%',
|
|
40
|
+
flexGrow: 1,
|
|
41
|
+
overflow: 'hidden'
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Ticks.Ticks, {}),
|
|
45
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
46
|
+
"data-testid": "span-duration-bar",
|
|
47
|
+
sx: {
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
top: 0,
|
|
50
|
+
bottom: 0,
|
|
51
|
+
margin: 'auto',
|
|
52
|
+
minWidth: `${_utils.minSpanWidthPx}px`,
|
|
53
|
+
height: '8px',
|
|
54
|
+
borderRadius: muiTheme.shape.borderRadius
|
|
55
|
+
},
|
|
56
|
+
style: {
|
|
57
|
+
left: `${relativeStart * 100}%`,
|
|
58
|
+
width: `${relativeDuration * 100}%`,
|
|
59
|
+
backgroundColor: (0, _utils.getSpanColor)(muiTheme, chartsTheme, options.visual?.palette?.mode, span)
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
63
|
+
sx: {
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
top: '50%',
|
|
66
|
+
transform: 'translateY(-50%)',
|
|
67
|
+
padding: '0 8px',
|
|
68
|
+
color: muiTheme.palette.grey[700],
|
|
69
|
+
fontSize: '.7rem'
|
|
70
|
+
},
|
|
71
|
+
style: /* print span duration on right side of the span bar, if there is space */ relativeStart + relativeDuration < 0.95 ? {
|
|
72
|
+
left: `${(relativeStart + relativeDuration) * 100}%`
|
|
73
|
+
} : {
|
|
74
|
+
left: `${relativeStart * 100}%`,
|
|
75
|
+
transform: 'translateY(-50%) translateX(-100%)'
|
|
76
|
+
},
|
|
77
|
+
children: (0, _utils.formatDuration)(spanDuration)
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "SpanIndents", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return SpanIndents;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronDown"));
|
|
26
|
+
const _ChevronRight = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronRight"));
|
|
27
|
+
const _react = require("react");
|
|
28
|
+
const _GanttTableProvider = require("./GanttTableProvider");
|
|
29
|
+
function _interop_require_default(obj) {
|
|
30
|
+
return obj && obj.__esModule ? obj : {
|
|
31
|
+
default: obj
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const MIN_INDENT_WIDTH = 8;
|
|
35
|
+
const MAX_INDENT_WIDTH = 24;
|
|
36
|
+
function SpanIndents(props) {
|
|
37
|
+
const { span } = props;
|
|
38
|
+
const { collapsedSpans, setCollapsedSpans, visibleSpans, hoveredParent, setHoveredParent } = (0, _GanttTableProvider.useGanttTableContext)();
|
|
39
|
+
const theme = (0, _material.useTheme)();
|
|
40
|
+
const handleToggleClick = (0, _react.useCallback)((e)=>{
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
if (collapsedSpans.includes(span.spanId)) {
|
|
43
|
+
setCollapsedSpans(collapsedSpans.filter((spanId)=>spanId !== span.spanId));
|
|
44
|
+
} else {
|
|
45
|
+
setCollapsedSpans([
|
|
46
|
+
...collapsedSpans,
|
|
47
|
+
span.spanId
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
span,
|
|
52
|
+
collapsedSpans,
|
|
53
|
+
setCollapsedSpans
|
|
54
|
+
]);
|
|
55
|
+
const handleIconMouseEnter = (0, _react.useCallback)(()=>{
|
|
56
|
+
setHoveredParent(span.spanId);
|
|
57
|
+
}, [
|
|
58
|
+
span,
|
|
59
|
+
setHoveredParent
|
|
60
|
+
]);
|
|
61
|
+
const spans = [
|
|
62
|
+
span
|
|
63
|
+
];
|
|
64
|
+
let parent = span.parentSpan;
|
|
65
|
+
while(parent){
|
|
66
|
+
spans.unshift(parent);
|
|
67
|
+
parent = parent.parentSpan;
|
|
68
|
+
}
|
|
69
|
+
// on first render visibleSpans is empty, therefore let's use MAX_INDENT_WIDTH to avoid an animation on page load.
|
|
70
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
71
|
+
children: spans.map((span, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(SpanIndentBox, {
|
|
72
|
+
style: {
|
|
73
|
+
width: i === spans.length - 1 || visibleSpans.length === 0 || visibleSpans.includes(span.spanId) ? MAX_INDENT_WIDTH : MIN_INDENT_WIDTH,
|
|
74
|
+
borderLeft: `${hoveredParent === (span.parentSpanId ?? '') ? 3 : 1}px solid ${theme.palette.divider}`
|
|
75
|
+
},
|
|
76
|
+
onMouseEnter: ()=>setHoveredParent(span.parentSpanId ?? ''),
|
|
77
|
+
onMouseLeave: ()=>setHoveredParent(undefined),
|
|
78
|
+
children: i === spans.length - 1 && span.childSpans.length > 0 && (collapsedSpans.includes(span.spanId) ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronRight.default, {
|
|
79
|
+
titleAccess: "expand",
|
|
80
|
+
onClick: handleToggleClick,
|
|
81
|
+
onMouseEnter: handleIconMouseEnter
|
|
82
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronDown.default, {
|
|
83
|
+
titleAccess: "collapse",
|
|
84
|
+
onClick: handleToggleClick,
|
|
85
|
+
onMouseEnter: handleIconMouseEnter
|
|
86
|
+
}))
|
|
87
|
+
}, span.spanId))
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const SpanIndentBox = (0, _material.styled)('div')({
|
|
91
|
+
display: 'flex',
|
|
92
|
+
height: '100%',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
justifyContent: 'flex-end',
|
|
95
|
+
flexShrink: 0,
|
|
96
|
+
transition: 'width 1s'
|
|
97
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "SpanName", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return SpanName;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _AlertCircleOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/AlertCircleOutline"));
|
|
26
|
+
const _utils = require("../utils");
|
|
27
|
+
const _SpanIndents = require("./SpanIndents");
|
|
28
|
+
function _interop_require_default(obj) {
|
|
29
|
+
return obj && obj.__esModule ? obj : {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function SpanName(props) {
|
|
34
|
+
const { span, nameColumnWidth } = props;
|
|
35
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
36
|
+
direction: "row",
|
|
37
|
+
sx: {
|
|
38
|
+
alignItems: 'center'
|
|
39
|
+
},
|
|
40
|
+
style: {
|
|
41
|
+
width: `${nameColumnWidth * 100}%`
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_SpanIndents.SpanIndents, {
|
|
45
|
+
span: span
|
|
46
|
+
}),
|
|
47
|
+
(0, _utils.spanHasError)(span) && /*#__PURE__*/ (0, _jsxruntime.jsx)(_AlertCircleOutline.default, {
|
|
48
|
+
titleAccess: "error",
|
|
49
|
+
color: "error",
|
|
50
|
+
sx: {
|
|
51
|
+
marginRight: '5px'
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
55
|
+
sx: {
|
|
56
|
+
whiteSpace: 'nowrap',
|
|
57
|
+
overflow: 'hidden'
|
|
58
|
+
},
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("strong", {
|
|
61
|
+
children: [
|
|
62
|
+
span.resource.serviceName,
|
|
63
|
+
":"
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
" ",
|
|
67
|
+
span.name
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "Canvas", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return Canvas;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _useresizeobserver = /*#__PURE__*/ _interop_require_default(require("use-resize-observer"));
|
|
26
|
+
const _react = require("react");
|
|
27
|
+
const _core = require("@perses-dev/core");
|
|
28
|
+
const _components = require("@perses-dev/components");
|
|
29
|
+
const _Ticks = require("../Ticks");
|
|
30
|
+
const _utils = require("../utils");
|
|
31
|
+
const _draw = require("./draw");
|
|
32
|
+
function _interop_require_default(obj) {
|
|
33
|
+
return obj && obj.__esModule ? obj : {
|
|
34
|
+
default: obj
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const CANVAS_HEIGHT = 60;
|
|
38
|
+
function Canvas(props) {
|
|
39
|
+
const { options, trace, viewport, setViewport } = props;
|
|
40
|
+
const muiTheme = (0, _material.useTheme)();
|
|
41
|
+
const chartsTheme = (0, _components.useChartsTheme)();
|
|
42
|
+
// the <canvas> element must have an absolute width and height to avoid rendering problems
|
|
43
|
+
// the wrapper box is required to get the available dimensions for the <canvas> element
|
|
44
|
+
const { width, ref: wrapperRef } = (0, _useresizeobserver.default)();
|
|
45
|
+
const height = CANVAS_HEIGHT;
|
|
46
|
+
const canvasRef = (0, _react.useRef)(null);
|
|
47
|
+
const [mouseState, setMouseState] = (0, _react.useState)({
|
|
48
|
+
type: 'none'
|
|
49
|
+
});
|
|
50
|
+
const traceDuration = trace.endTimeUnixMs - trace.startTimeUnixMs;
|
|
51
|
+
const relativeCutoffLeft = (viewport.startTimeUnixMs - trace.startTimeUnixMs) / traceDuration;
|
|
52
|
+
const relativeCutoffRight = (trace.endTimeUnixMs - viewport.endTimeUnixMs) / traceDuration;
|
|
53
|
+
const spanColorGenerator = (0, _react.useCallback)((span)=>(0, _utils.getSpanColor)(muiTheme, chartsTheme, options.visual?.palette?.mode, span), [
|
|
54
|
+
muiTheme,
|
|
55
|
+
chartsTheme,
|
|
56
|
+
options.visual?.palette?.mode
|
|
57
|
+
]);
|
|
58
|
+
(0, _react.useEffect)(()=>{
|
|
59
|
+
if (!canvasRef.current || !width || !height) return;
|
|
60
|
+
const ctx = canvasRef.current.getContext('2d');
|
|
61
|
+
if (!ctx) return;
|
|
62
|
+
(0, _draw.drawSpans)(ctx, width, height, trace, spanColorGenerator);
|
|
63
|
+
}, [
|
|
64
|
+
width,
|
|
65
|
+
height,
|
|
66
|
+
trace,
|
|
67
|
+
spanColorGenerator
|
|
68
|
+
]);
|
|
69
|
+
const translateCursorToTime = (e)=>{
|
|
70
|
+
if (!canvasRef.current || !width) return 0;
|
|
71
|
+
// e.nativeEvent.offsetX doesn't work when sliding over a tick box
|
|
72
|
+
const offsetX = e.clientX - canvasRef.current.getBoundingClientRect().left;
|
|
73
|
+
return trace.startTimeUnixMs + offsetX / width * traceDuration;
|
|
74
|
+
};
|
|
75
|
+
const handleMouseDown = (e)=>{
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
if (!(e.target instanceof HTMLElement)) return;
|
|
78
|
+
const isDefaultViewport = viewport.startTimeUnixMs === trace.startTimeUnixMs && viewport.endTimeUnixMs === trace.endTimeUnixMs;
|
|
79
|
+
const elem = e.target.dataset['elem'];
|
|
80
|
+
const cursor = translateCursorToTime(e);
|
|
81
|
+
if (elem === 'resizerLeft') {
|
|
82
|
+
setMouseState({
|
|
83
|
+
type: 'resize',
|
|
84
|
+
fixedPoint: viewport.endTimeUnixMs
|
|
85
|
+
});
|
|
86
|
+
} else if (elem === 'resizerRight') {
|
|
87
|
+
setMouseState({
|
|
88
|
+
type: 'resize',
|
|
89
|
+
fixedPoint: viewport.startTimeUnixMs
|
|
90
|
+
});
|
|
91
|
+
} else if (elem === 'cutoffBox' || isDefaultViewport) {
|
|
92
|
+
setMouseState({
|
|
93
|
+
type: 'resize',
|
|
94
|
+
fixedPoint: cursor
|
|
95
|
+
});
|
|
96
|
+
setViewport({
|
|
97
|
+
startTimeUnixMs: cursor,
|
|
98
|
+
endTimeUnixMs: cursor
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
setMouseState({
|
|
102
|
+
type: 'drag',
|
|
103
|
+
start: cursor - viewport.startTimeUnixMs,
|
|
104
|
+
end: viewport.endTimeUnixMs - cursor
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
// need stable reference for window.removeEventListener() in useEffect() below
|
|
109
|
+
const handleMouseMove = (0, _core.useEvent)((e)=>{
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
switch(mouseState.type){
|
|
112
|
+
case 'none':
|
|
113
|
+
return;
|
|
114
|
+
case 'resize':
|
|
115
|
+
{
|
|
116
|
+
const pointA = mouseState.fixedPoint;
|
|
117
|
+
const pointB = translateCursorToTime(e);
|
|
118
|
+
let start, end;
|
|
119
|
+
if (pointA < pointB) {
|
|
120
|
+
start = pointA;
|
|
121
|
+
end = pointB;
|
|
122
|
+
} else {
|
|
123
|
+
start = pointB;
|
|
124
|
+
end = pointA;
|
|
125
|
+
}
|
|
126
|
+
setViewport({
|
|
127
|
+
startTimeUnixMs: Math.max(start, trace.startTimeUnixMs),
|
|
128
|
+
endTimeUnixMs: Math.min(end, trace.endTimeUnixMs)
|
|
129
|
+
});
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
case 'drag':
|
|
133
|
+
{
|
|
134
|
+
// avoid using e.movementX here, as it skips events in chrome,
|
|
135
|
+
// resulting in the mouse pointer moving faster than the viewport box
|
|
136
|
+
const { start, end } = mouseState;
|
|
137
|
+
let cursor = translateCursorToTime(e);
|
|
138
|
+
if (cursor - start < trace.startTimeUnixMs) {
|
|
139
|
+
cursor = trace.startTimeUnixMs + start;
|
|
140
|
+
}
|
|
141
|
+
if (cursor + end > trace.endTimeUnixMs) {
|
|
142
|
+
cursor = trace.endTimeUnixMs - end;
|
|
143
|
+
}
|
|
144
|
+
setViewport({
|
|
145
|
+
startTimeUnixMs: cursor - start,
|
|
146
|
+
endTimeUnixMs: cursor + end
|
|
147
|
+
});
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
// need stable reference for window.removeEventListener() in useEffect() below
|
|
153
|
+
const handleMouseUp = (0, _core.useEvent)((e)=>{
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
setMouseState({
|
|
156
|
+
type: 'none'
|
|
157
|
+
});
|
|
158
|
+
// reset viewport if start === end, i.e. a click without movement
|
|
159
|
+
if (viewport.startTimeUnixMs === viewport.endTimeUnixMs) {
|
|
160
|
+
setViewport({
|
|
161
|
+
startTimeUnixMs: trace.startTimeUnixMs,
|
|
162
|
+
endTimeUnixMs: trace.endTimeUnixMs
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
// capture mouseMove and mouseUp outside the element by attaching them to the window object
|
|
167
|
+
(0, _react.useEffect)(()=>{
|
|
168
|
+
function startMouseAction() {
|
|
169
|
+
window.addEventListener('mousemove', handleMouseMove);
|
|
170
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
171
|
+
document.body.style.cursor = mouseState.type === 'resize' ? 'col-resize' : 'move';
|
|
172
|
+
}
|
|
173
|
+
function stopMouseAction() {
|
|
174
|
+
window.removeEventListener('mousemove', handleMouseMove);
|
|
175
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
176
|
+
document.body.style.cursor = 'inherit';
|
|
177
|
+
}
|
|
178
|
+
if (mouseState.type === 'none') {
|
|
179
|
+
stopMouseAction();
|
|
180
|
+
} else {
|
|
181
|
+
startMouseAction();
|
|
182
|
+
}
|
|
183
|
+
return stopMouseAction;
|
|
184
|
+
}, [
|
|
185
|
+
mouseState,
|
|
186
|
+
handleMouseMove,
|
|
187
|
+
handleMouseUp
|
|
188
|
+
]);
|
|
189
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
190
|
+
ref: wrapperRef,
|
|
191
|
+
sx: {
|
|
192
|
+
position: 'relative',
|
|
193
|
+
height
|
|
194
|
+
},
|
|
195
|
+
onMouseDown: handleMouseDown,
|
|
196
|
+
children: [
|
|
197
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("canvas", {
|
|
198
|
+
ref: canvasRef,
|
|
199
|
+
width: width,
|
|
200
|
+
height: height,
|
|
201
|
+
style: {
|
|
202
|
+
position: 'absolute'
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Ticks.Ticks, {}),
|
|
206
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(CutoffBox, {
|
|
207
|
+
"data-elem": "cutoffBox",
|
|
208
|
+
style: {
|
|
209
|
+
left: 0,
|
|
210
|
+
width: `${relativeCutoffLeft * 100}%`
|
|
211
|
+
}
|
|
212
|
+
}),
|
|
213
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(Resizer, {
|
|
214
|
+
"data-elem": "resizerLeft",
|
|
215
|
+
style: {
|
|
216
|
+
left: `${relativeCutoffLeft * 100}%`
|
|
217
|
+
}
|
|
218
|
+
}),
|
|
219
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(Resizer, {
|
|
220
|
+
"data-elem": "resizerRight",
|
|
221
|
+
style: {
|
|
222
|
+
right: `${relativeCutoffRight * 100}%`
|
|
223
|
+
}
|
|
224
|
+
}),
|
|
225
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(CutoffBox, {
|
|
226
|
+
"data-elem": "cutoffBox",
|
|
227
|
+
style: {
|
|
228
|
+
right: 0,
|
|
229
|
+
width: `${relativeCutoffRight * 100}%`
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
]
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
const CutoffBox = (0, _material.styled)(_material.Box)({
|
|
236
|
+
position: 'absolute',
|
|
237
|
+
height: '100%',
|
|
238
|
+
backgroundColor: 'rgba(225, 225, 225, .5)'
|
|
239
|
+
});
|
|
240
|
+
const Resizer = (0, _material.styled)(_material.Box)(({ theme })=>({
|
|
241
|
+
position: 'absolute',
|
|
242
|
+
height: '100%',
|
|
243
|
+
backgroundColor: theme.palette.divider,
|
|
244
|
+
width: '2px',
|
|
245
|
+
cursor: 'col-resize',
|
|
246
|
+
// increase clickable area from 2px to 8px
|
|
247
|
+
'&:before': {
|
|
248
|
+
position: 'absolute',
|
|
249
|
+
width: '8px',
|
|
250
|
+
left: '-3px',
|
|
251
|
+
top: 0,
|
|
252
|
+
bottom: 0,
|
|
253
|
+
content: '" "',
|
|
254
|
+
zIndex: 1
|
|
255
|
+
}
|
|
256
|
+
}));
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "MiniGanttChart", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return MiniGanttChart;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _Ticks = require("../Ticks");
|
|
26
|
+
const _utils = require("../utils");
|
|
27
|
+
const _Canvas = require("./Canvas");
|
|
28
|
+
function MiniGanttChart(props) {
|
|
29
|
+
const { options, trace, viewport, setViewport } = props;
|
|
30
|
+
const theme = (0, _material.useTheme)();
|
|
31
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
32
|
+
sx: {
|
|
33
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
34
|
+
borderRadius: `${theme.shape.borderRadius}px`
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
38
|
+
sx: {
|
|
39
|
+
position: 'relative',
|
|
40
|
+
height: _utils.rowHeight,
|
|
41
|
+
borderBottom: `1px solid ${theme.palette.divider}`
|
|
42
|
+
},
|
|
43
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Ticks.TicksHeader, {
|
|
44
|
+
trace: trace,
|
|
45
|
+
viewport: {
|
|
46
|
+
startTimeUnixMs: trace.startTimeUnixMs,
|
|
47
|
+
endTimeUnixMs: trace.endTimeUnixMs
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Canvas.Canvas, {
|
|
52
|
+
options: options,
|
|
53
|
+
trace: trace,
|
|
54
|
+
viewport: viewport,
|
|
55
|
+
setViewport: setViewport
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "drawSpans", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return drawSpans;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _utils = require("../utils");
|
|
24
|
+
const MIN_BAR_HEIGHT = 1;
|
|
25
|
+
const MAX_BAR_HEIGHT = 7;
|
|
26
|
+
function countSpans(span) {
|
|
27
|
+
let n = 1;
|
|
28
|
+
for (const childSpan of span.childSpans){
|
|
29
|
+
n += countSpans(childSpan);
|
|
30
|
+
}
|
|
31
|
+
return n;
|
|
32
|
+
}
|
|
33
|
+
function drawSpans(ctx, width, height, trace, spanColorGenerator) {
|
|
34
|
+
// calculate optimal height, enforce min and max bar height and finally round to an integer
|
|
35
|
+
const numSpans = trace.rootSpans.map(countSpans).reduce((acc, n)=>acc + n, 0);
|
|
36
|
+
const barHeight = Math.round(Math.min(Math.max(height / numSpans, MIN_BAR_HEIGHT), MAX_BAR_HEIGHT));
|
|
37
|
+
const traceDuration = trace.endTimeUnixMs - trace.startTimeUnixMs;
|
|
38
|
+
const yChange = height / numSpans;
|
|
39
|
+
let y = 0;
|
|
40
|
+
const drawSpan = (span)=>{
|
|
41
|
+
const spanDuration = span.endTimeUnixMs - span.startTimeUnixMs;
|
|
42
|
+
const relativeDuration = spanDuration / traceDuration;
|
|
43
|
+
const relativeStart = (span.startTimeUnixMs - trace.startTimeUnixMs) / traceDuration;
|
|
44
|
+
ctx.fillStyle = spanColorGenerator(span);
|
|
45
|
+
ctx.beginPath();
|
|
46
|
+
ctx.rect(Math.round(relativeStart * width), Math.round(y), Math.max(_utils.minSpanWidthPx, Math.round(relativeDuration * width)), barHeight);
|
|
47
|
+
ctx.fill();
|
|
48
|
+
y += yChange;
|
|
49
|
+
for (const childSpan of span.childSpans){
|
|
50
|
+
drawSpan(childSpan);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
for (const rootSpan of trace.rootSpans){
|
|
54
|
+
drawSpan(rootSpan);
|
|
55
|
+
}
|
|
56
|
+
}
|