@perses-dev/tracing-gantt-chart-plugin 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{788.d9986a69.js → 788.5684e3ab.js} +2 -2
- package/__mf/js/{TracingGanttChart.906bee00.js → TracingGanttChart.77b94eb3.js} +3 -3
- package/__mf/js/async/__federation_expose_TracingGanttChart.7b5aeb33.js +1 -0
- package/__mf/js/{main.2f3ef69f.js → main.9fe8ed9b.js} +1 -1
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts +7 -0
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts.map +1 -1
- package/lib/TracingGanttChart/DetailPane/Attributes.js +62 -23
- package/lib/TracingGanttChart/DetailPane/Attributes.js.map +1 -1
- package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts.map +1 -1
- package/lib/TracingGanttChart/DetailPane/DetailPane.js +7 -15
- package/lib/TracingGanttChart/DetailPane/DetailPane.js.map +1 -1
- package/lib/TracingGanttChart/TraceDetails.d.ts +7 -0
- package/lib/TracingGanttChart/TraceDetails.d.ts.map +1 -0
- package/lib/TracingGanttChart/TraceDetails.js +90 -0
- package/lib/TracingGanttChart/TraceDetails.js.map +1 -0
- package/lib/TracingGanttChart/TracingGanttChart.d.ts.map +1 -1
- package/lib/TracingGanttChart/TracingGanttChart.js +4 -0
- package/lib/TracingGanttChart/TracingGanttChart.js.map +1 -1
- package/lib/cjs/TracingGanttChart/DetailPane/Attributes.js +71 -24
- package/lib/cjs/TracingGanttChart/DetailPane/DetailPane.js +4 -12
- package/lib/cjs/TracingGanttChart/TraceDetails.js +98 -0
- package/lib/cjs/TracingGanttChart/TracingGanttChart.js +4 -0
- package/mf-manifest.json +3 -3
- package/mf-stats.json +3 -3
- package/package.json +9 -1
- package/__mf/js/async/__federation_expose_TracingGanttChart.cfa547a5.js +0 -1
|
@@ -10,10 +10,48 @@
|
|
|
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 { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { useMemo } from 'react';
|
|
15
|
-
import { Link, List, ListItem, ListItemText } from '@mui/material';
|
|
15
|
+
import { Divider, Link, List, ListItem, ListItemText } from '@mui/material';
|
|
16
16
|
import { Link as RouterLink } from 'react-router-dom';
|
|
17
|
+
import { formatDuration } from '../utils';
|
|
18
|
+
export function TraceAttributes(props) {
|
|
19
|
+
const { trace, span, attributeLinks } = props;
|
|
20
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
21
|
+
children: [
|
|
22
|
+
/*#__PURE__*/ _jsxs(List, {
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ _jsx(AttributeItem, {
|
|
25
|
+
name: "span ID",
|
|
26
|
+
value: span.spanId
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ _jsx(AttributeItem, {
|
|
29
|
+
name: "start",
|
|
30
|
+
value: formatDuration(span.startTimeUnixMs - trace.startTimeUnixMs)
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsx(AttributeItem, {
|
|
33
|
+
name: "duration",
|
|
34
|
+
value: formatDuration(span.endTimeUnixMs - span.startTimeUnixMs)
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ _jsx(Divider, {}),
|
|
39
|
+
span.attributes.length > 0 && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ _jsx(AttributeList, {
|
|
42
|
+
attributeLinks: attributeLinks,
|
|
43
|
+
attributes: span.attributes
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ _jsx(Divider, {})
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
/*#__PURE__*/ _jsx(AttributeList, {
|
|
49
|
+
attributeLinks: attributeLinks,
|
|
50
|
+
attributes: span.resource.attributes
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
17
55
|
export function AttributeList(props) {
|
|
18
56
|
const { attributeLinks, attributes } = props;
|
|
19
57
|
const attributesMap = useMemo(()=>Object.fromEntries(attributes.map((attr)=>[
|
|
@@ -22,34 +60,35 @@ export function AttributeList(props) {
|
|
|
22
60
|
])), [
|
|
23
61
|
attributes
|
|
24
62
|
]);
|
|
25
|
-
return /*#__PURE__*/ _jsx(
|
|
26
|
-
children:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
63
|
+
return /*#__PURE__*/ _jsx(List, {
|
|
64
|
+
children: attributes.sort((a, b)=>a.key.localeCompare(b.key)).map((attribute, i)=>/*#__PURE__*/ _jsx(AttributeItem, {
|
|
65
|
+
name: attribute.key,
|
|
66
|
+
value: renderAttributeValue(attribute.value),
|
|
67
|
+
link: attributeLinks?.[attribute.key]?.(attributesMap)
|
|
68
|
+
}, i))
|
|
32
69
|
});
|
|
33
70
|
}
|
|
34
71
|
function AttributeItem(props) {
|
|
35
|
-
const {
|
|
36
|
-
const
|
|
72
|
+
const { name, value, link } = props;
|
|
73
|
+
const valueComponent = link ? /*#__PURE__*/ _jsx(Link, {
|
|
37
74
|
component: RouterLink,
|
|
38
|
-
to:
|
|
39
|
-
children:
|
|
40
|
-
}) :
|
|
75
|
+
to: link,
|
|
76
|
+
children: value
|
|
77
|
+
}) : value;
|
|
41
78
|
return /*#__PURE__*/ _jsx(ListItem, {
|
|
42
79
|
disablePadding: true,
|
|
43
80
|
children: /*#__PURE__*/ _jsx(ListItemText, {
|
|
44
|
-
primary:
|
|
45
|
-
secondary:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
81
|
+
primary: name,
|
|
82
|
+
secondary: valueComponent,
|
|
83
|
+
slotProps: {
|
|
84
|
+
primary: {
|
|
85
|
+
variant: 'h5'
|
|
86
|
+
},
|
|
87
|
+
secondary: {
|
|
88
|
+
variant: 'body1',
|
|
89
|
+
sx: {
|
|
90
|
+
wordBreak: 'break-word'
|
|
91
|
+
}
|
|
53
92
|
}
|
|
54
93
|
}
|
|
55
94
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/DetailPane/Attributes.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { Link, List, ListItem, ListItemText } from '@mui/material';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { otlpcommonv1 } from '@perses-dev/core';\n\nexport type AttributeLinks = Record<string, (attributes: Record<string, otlpcommonv1.AnyValue>) => string>;\n\nexport interface AttributeListProps {\n attributeLinks?: AttributeLinks;\n attributes: otlpcommonv1.KeyValue[];\n}\n\nexport function AttributeList(props: AttributeListProps): ReactElement {\n const { attributeLinks, attributes } = props;\n const attributesMap = useMemo(\n () => Object.fromEntries(attributes.map((attr) => [attr.key, attr.value])),\n [attributes]\n );\n\n return (\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/DetailPane/Attributes.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { Divider, Link, List, ListItem, ListItemText } from '@mui/material';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { otlpcommonv1 } from '@perses-dev/core';\nimport { Span, Trace } from '../trace';\nimport { formatDuration } from '../utils';\n\nexport type AttributeLinks = Record<string, (attributes: Record<string, otlpcommonv1.AnyValue>) => string>;\n\nexport interface TraceAttributesProps {\n trace: Trace;\n span: Span;\n attributeLinks?: AttributeLinks;\n}\n\nexport function TraceAttributes(props: TraceAttributesProps) {\n const { trace, span, attributeLinks } = props;\n\n return (\n <>\n <List>\n <AttributeItem name=\"span ID\" value={span.spanId} />\n <AttributeItem name=\"start\" value={formatDuration(span.startTimeUnixMs - trace.startTimeUnixMs)} />\n <AttributeItem name=\"duration\" value={formatDuration(span.endTimeUnixMs - span.startTimeUnixMs)} />\n </List>\n <Divider />\n {span.attributes.length > 0 && (\n <>\n <AttributeList attributeLinks={attributeLinks} attributes={span.attributes} />\n <Divider />\n </>\n )}\n <AttributeList attributeLinks={attributeLinks} attributes={span.resource.attributes} />\n </>\n );\n}\n\nexport interface AttributeListProps {\n attributeLinks?: AttributeLinks;\n attributes: otlpcommonv1.KeyValue[];\n}\n\nexport function AttributeList(props: AttributeListProps): ReactElement {\n const { attributeLinks, attributes } = props;\n const attributesMap = useMemo(\n () => Object.fromEntries(attributes.map((attr) => [attr.key, attr.value])),\n [attributes]\n );\n\n return (\n <List>\n {attributes\n .sort((a, b) => a.key.localeCompare(b.key))\n .map((attribute, i) => (\n <AttributeItem\n key={i}\n name={attribute.key}\n value={renderAttributeValue(attribute.value)}\n link={attributeLinks?.[attribute.key]?.(attributesMap)}\n />\n ))}\n </List>\n );\n}\n\ninterface AttributeItemProps {\n name: string;\n value: string;\n link?: string;\n}\n\nfunction AttributeItem(props: AttributeItemProps): ReactElement {\n const { name, value, link } = props;\n\n const valueComponent = link ? (\n <Link component={RouterLink} to={link}>\n {value}\n </Link>\n ) : (\n value\n );\n\n return (\n <ListItem disablePadding>\n <ListItemText\n primary={name}\n secondary={valueComponent}\n slotProps={{\n primary: { variant: 'h5' },\n secondary: { variant: 'body1', sx: { wordBreak: 'break-word' } },\n }}\n />\n </ListItem>\n );\n}\n\nfunction renderAttributeValue(value: otlpcommonv1.AnyValue): string {\n if ('stringValue' in value) return value.stringValue.length > 0 ? value.stringValue : '<empty string>';\n if ('intValue' in value) return value.intValue;\n if ('boolValue' in value) return value.boolValue.toString();\n if ('arrayValue' in value) return value.arrayValue.values.map(renderAttributeValue).join(', ');\n return 'unknown';\n}\n"],"names":["useMemo","Divider","Link","List","ListItem","ListItemText","RouterLink","formatDuration","TraceAttributes","props","trace","span","attributeLinks","AttributeItem","name","value","spanId","startTimeUnixMs","endTimeUnixMs","attributes","length","AttributeList","resource","attributesMap","Object","fromEntries","map","attr","key","sort","a","b","localeCompare","attribute","i","renderAttributeValue","link","valueComponent","component","to","disablePadding","primary","secondary","slotProps","variant","sx","wordBreak","stringValue","intValue","boolValue","toString","arrayValue","values","join"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,YAAY,QAAQ,gBAAgB;AAC5E,SAASH,QAAQI,UAAU,QAAQ,mBAAmB;AAGtD,SAASC,cAAc,QAAQ,WAAW;AAU1C,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,KAAK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AYiC,IAAIH;kBAC9BrB;SAGHA;IAGF,qBACE,KAACX;QAASoC,cAAc;kBACtB,cAAA,KAACnC;YACCoC,SAAS3B;YACT4B,WAAWL;YACXM,WAAW;gBACTF,SAAS;oBAAEG,SAAS;gBAAK;gBACzBF,WAAW;oBAAEE,SAAS;oBAASC,IAAI;wBAAEC,WAAW;oBAAa;gBAAE;YACjE;;;AAIR;AAEA,SAASX,qBAAqBpB,KAA4B;IACxD,IAAI,iBAAiBA,OAAO,OAAOA,MAAMgC,WAAW,CAAC3B,MAAM,GAAG,IAAIL,MAAMgC,WAAW,GAAG;IACtF,IAAI,cAAchC,OAAO,OAAOA,MAAMiC,QAAQ;IAC9C,IAAI,eAAejC,OAAO,OAAOA,MAAMkC,SAAS,CAACC,QAAQ;IACzD,IAAI,gBAAgBnC,OAAO,OAAOA,MAAMoC,UAAU,CAACC,MAAM,CAAC1B,GAAG,CAACS,sBAAsBkB,IAAI,CAAC;IACzF,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailPane.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/DetailPane/DetailPane.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"DetailPane.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/DetailPane/DetailPane.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AAG/D,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CA6B/D"}
|
|
@@ -10,11 +10,11 @@
|
|
|
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 { jsx as _jsx, jsxs as _jsxs
|
|
14
|
-
import { Box,
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Box, IconButton, Tab, Tabs, Typography } from '@mui/material';
|
|
15
15
|
import { useState } from 'react';
|
|
16
16
|
import CloseIcon from 'mdi-material-ui/Close';
|
|
17
|
-
import {
|
|
17
|
+
import { TraceAttributes } from './Attributes';
|
|
18
18
|
import { SpanEventList } from './SpanEvents';
|
|
19
19
|
/**
|
|
20
20
|
* DetailPane renders a sidebar showing the span attributes etc.
|
|
@@ -71,18 +71,10 @@ import { SpanEventList } from './SpanEvents';
|
|
|
71
71
|
]
|
|
72
72
|
})
|
|
73
73
|
}),
|
|
74
|
-
tab === 'attributes' && /*#__PURE__*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
attributes: span.attributes
|
|
79
|
-
}),
|
|
80
|
-
span.attributes.length > 0 && /*#__PURE__*/ _jsx(Divider, {}),
|
|
81
|
-
/*#__PURE__*/ _jsx(AttributeList, {
|
|
82
|
-
attributeLinks: attributeLinks,
|
|
83
|
-
attributes: span.resource.attributes
|
|
84
|
-
})
|
|
85
|
-
]
|
|
74
|
+
tab === 'attributes' && /*#__PURE__*/ _jsx(TraceAttributes, {
|
|
75
|
+
trace: trace,
|
|
76
|
+
span: span,
|
|
77
|
+
attributeLinks: attributeLinks
|
|
86
78
|
}),
|
|
87
79
|
tab === 'events' && /*#__PURE__*/ _jsx(SpanEventList, {
|
|
88
80
|
trace: trace,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/DetailPane/DetailPane.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box,
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/DetailPane/DetailPane.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, IconButton, Tab, Tabs, Typography } from '@mui/material';\nimport { ReactElement, useState } from 'react';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { Span, Trace } from '../trace';\nimport { AttributeLinks, TraceAttributes } from './Attributes';\nimport { SpanEventList } from './SpanEvents';\n\nexport interface DetailPaneProps {\n attributeLinks?: AttributeLinks;\n trace: Trace;\n span: Span;\n onCloseBtnClick: () => void;\n}\n\n/**\n * DetailPane renders a sidebar showing the span attributes etc.\n */\nexport function DetailPane(props: DetailPaneProps): ReactElement {\n const { attributeLinks, trace, span, onCloseBtnClick } = props;\n const [tab, setTab] = useState<'attributes' | 'events'>('attributes');\n\n // if the events tab is selected, and then a span without events is clicked,\n // we need to switch the current selected tab back to the attributes tab.\n if (tab === 'events' && span.events.length === 0) {\n setTab('attributes');\n }\n\n return (\n <Box>\n <IconButton sx={{ float: 'right' }} onClick={onCloseBtnClick}>\n <CloseIcon />\n </IconButton>\n <Typography sx={{ wordBreak: 'break-word' }}>{span.resource.serviceName}</Typography>\n <Typography variant=\"h2\" sx={{ wordBreak: 'break-word' }}>\n {span.name}\n </Typography>\n <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>\n <Tabs value={tab} onChange={(_, tab) => setTab(tab)}>\n <Tab sx={{ p: 0 }} value=\"attributes\" label=\"Attributes\" />\n {span.events.length > 0 && <Tab value=\"events\" label=\"Events\" />}\n </Tabs>\n </Box>\n {tab === 'attributes' && <TraceAttributes trace={trace} span={span} attributeLinks={attributeLinks} />}\n {tab === 'events' && <SpanEventList trace={trace} span={span} />}\n </Box>\n );\n}\n"],"names":["Box","IconButton","Tab","Tabs","Typography","useState","CloseIcon","TraceAttributes","SpanEventList","DetailPane","props","attributeLinks","trace","span","onCloseBtnClick","tab","setTab","events","length","sx","float","onClick","wordBreak","resource","serviceName","variant","name","borderBottom","borderColor","value","onChange","_","p","label"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,UAAU,EAAEC,GAAG,EAAEC,IAAI,EAAEC,UAAU,QAAQ,gBAAgB;AACvE,SAAuBC,QAAQ,QAAQ,QAAQ;AAC/C,OAAOC,eAAe,wBAAwB;AAE9C,SAAyBC,eAAe,QAAQ,eAAe;AAC/D,SAASC,aAAa,QAAQ,eAAe;AAS7C;;CAEC,GACD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,cAAc,EAAEC,KAAK,EAAEC,IAAI,EAAEC,eAAe,EAAE,GAAGJ;IACzD,MAAM,CAACK,KAAKC,OAAO,GAAG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
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Stack, Typography } from '@mui/material';
|
|
15
|
+
import { useTimeZone } from '@perses-dev/components';
|
|
16
|
+
import { formatDuration } from './utils';
|
|
17
|
+
const DATE_FORMAT_OPTIONS = {
|
|
18
|
+
year: 'numeric',
|
|
19
|
+
month: 'long',
|
|
20
|
+
day: 'numeric',
|
|
21
|
+
hour: 'numeric',
|
|
22
|
+
minute: 'numeric',
|
|
23
|
+
second: 'numeric',
|
|
24
|
+
fractionalSecondDigits: 3,
|
|
25
|
+
timeZoneName: 'short'
|
|
26
|
+
};
|
|
27
|
+
export function TraceDetails(props) {
|
|
28
|
+
const { trace } = props;
|
|
29
|
+
const { dateFormatOptionsWithUserTimeZone } = useTimeZone();
|
|
30
|
+
const dateFormatOptions = dateFormatOptionsWithUserTimeZone(DATE_FORMAT_OPTIONS);
|
|
31
|
+
const dateFormatter = new Intl.DateTimeFormat(undefined, dateFormatOptions);
|
|
32
|
+
const rootSpan = trace.rootSpans[0];
|
|
33
|
+
if (!rootSpan) {
|
|
34
|
+
return /*#__PURE__*/ _jsx(Typography, {
|
|
35
|
+
children: "Trace contains no spans."
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
39
|
+
direction: "row",
|
|
40
|
+
sx: {
|
|
41
|
+
justifyContent: 'space-between'
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
45
|
+
variant: "h3",
|
|
46
|
+
children: [
|
|
47
|
+
rootSpan.resource.serviceName,
|
|
48
|
+
": ",
|
|
49
|
+
rootSpan.name,
|
|
50
|
+
" (",
|
|
51
|
+
formatDuration(trace.endTimeUnixMs - trace.startTimeUnixMs),
|
|
52
|
+
")"
|
|
53
|
+
]
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
56
|
+
variant: "h4",
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
59
|
+
component: "span",
|
|
60
|
+
sx: {
|
|
61
|
+
px: 1
|
|
62
|
+
},
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
65
|
+
children: "Start:"
|
|
66
|
+
}),
|
|
67
|
+
" ",
|
|
68
|
+
dateFormatter.format(trace.startTimeUnixMs)
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
72
|
+
component: "span",
|
|
73
|
+
sx: {
|
|
74
|
+
px: 1
|
|
75
|
+
},
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
78
|
+
children: "Trace ID:"
|
|
79
|
+
}),
|
|
80
|
+
" ",
|
|
81
|
+
rootSpan.traceId
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=TraceDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/TraceDetails.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Stack, Typography } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { useTimeZone } from '@perses-dev/components';\nimport { formatDuration } from './utils';\nimport { Trace } from './trace';\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 TraceDetailsProps {\n trace: Trace;\n}\n\nexport function TraceDetails(props: TraceDetailsProps): ReactElement {\n const { trace } = props;\n\n const { dateFormatOptionsWithUserTimeZone } = useTimeZone();\n const dateFormatOptions = dateFormatOptionsWithUserTimeZone(DATE_FORMAT_OPTIONS);\n const dateFormatter = new Intl.DateTimeFormat(undefined, dateFormatOptions);\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=\"row\" sx={{ justifyContent: 'space-between' }}>\n <Typography variant=\"h3\">\n {rootSpan.resource.serviceName}: {rootSpan.name} ({formatDuration(trace.endTimeUnixMs - trace.startTimeUnixMs)})\n </Typography>\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 );\n}\n"],"names":["Stack","Typography","useTimeZone","formatDuration","DATE_FORMAT_OPTIONS","year","month","day","hour","minute","second","fractionalSecondDigits","timeZoneName","TraceDetails","props","trace","dateFormatOptionsWithUserTimeZone","dateFormatOptions","dateFormatter","Intl","DateTimeFormat","undefined","rootSpan","rootSpans","direction","sx","justifyContent","variant","resource","serviceName","name","endTimeUnixMs","startTimeUnixMs","component","px","strong","format","traceId"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAElD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,cAAc,QAAQ,UAAU;AAGzC,MAAMC,sBAAkD;IACtDC,MAAM;IACNC,OAAO;IACPC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,wBAAwB;IACxBC,cAAc;AAChB;AAMA,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EAAEC,KAAK,EAAE,GAAGD;IAElB,MAAM,EAAEE,iCAAiC,EAAE,GAAGd;IAC9C,MAAMe,oBAAoBD,kCAAkCZ;IAC5D,MAAMc,gBAAgB,IAAIC,KAAKC,cAAc,CAACC,WAAWJ;IAEzD,MAAMK,WAAWP,MAAMQ,SAAS,CAAC,EAAE;IACnC,IAAI,CAACD,UAAU;QACb,qBAAO,KAACrB;sBAAW;;IACrB;IAEA,qBACE,MAACD;QAAMwB,WAAU;QAAMC,IAAI;YAAEC,gBAAgB;QAAgB;;0BAC3D,MAACzB;gBAAW0B,SAAQ;;oBACjBL,SAASM,QAAQ,CAACC,WAAW;oBAAC;oBAAGP,SAASQ,IAAI;oBAAC;oBAAG3B,eAAeY,MAAMgB,aAAa,GAAGhB,MAAMiB,eAAe;oBAAE;;;0BAEjH,MAAC/B;gBAAW0B,SAAQ;;kCAClB,MAAC1B;wBAAWgC,WAAU;wBAAOR,IAAI;4BAAES,IAAI;wBAAE;;0CACvC,KAACC;0CAAO;;4BAAe;4BAAEjB,cAAckB,MAAM,CAACrB,MAAMiB,eAAe;;;kCAErE,MAAC/B;wBAAWgC,WAAU;wBAAOR,IAAI;4BAAES,IAAI;wBAAE;;0CACvC,KAACC;0CAAO;;4BAAkB;4BAAEb,SAASe,OAAO;;;;;;;AAKtD"}
|
|
@@ -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,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAOhE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
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,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAOhE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,wBAAwB,CAAC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAqD7E"}
|
|
@@ -19,6 +19,7 @@ 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 { TraceDetails } from './TraceDetails';
|
|
22
23
|
/**
|
|
23
24
|
* The core GanttChart panel for Perses.
|
|
24
25
|
*
|
|
@@ -61,6 +62,9 @@ import { getTraceModel } from './trace';
|
|
|
61
62
|
gap
|
|
62
63
|
},
|
|
63
64
|
children: [
|
|
65
|
+
/*#__PURE__*/ _jsx(TraceDetails, {
|
|
66
|
+
trace: trace
|
|
67
|
+
}),
|
|
64
68
|
/*#__PURE__*/ _jsx(MiniGanttChart, {
|
|
65
69
|
options: options,
|
|
66
70
|
trace: trace,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo, useRef, useState } from 'react';\nimport { Box, Stack, useTheme } from '@mui/material';\nimport { otlptracev1 } from '@perses-dev/core';\nimport { 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 { AttributeLinks } from './DetailPane/Attributes';\nimport { getTraceModel, Span } from './trace';\n\nexport interface TracingGanttChartProps {\n options: TracingGanttChartOptions;\n attributeLinks?: AttributeLinks;\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, attributeLinks, trace: otlpTrace } = props;\n\n const theme = useTheme();\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>(undefined);\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\n return (\n <Stack ref={ganttChart} direction=\"row\" sx={{ height: '100%', minHeight: '240px', gap }}>\n <Stack sx={{ flexGrow: 1, gap }}>\n <MiniGanttChart options={options} trace={trace} viewport={viewport} setViewport={setViewport} />\n <GanttTableProvider>\n <GanttTable\n options={options}\n trace={trace}\n viewport={viewport}\n selectedSpan={selectedSpan}\n onSpanClick={setSelectedSpan}\n />\n </GanttTableProvider>\n </Stack>\n {selectedSpan && (\n <>\n <ResizableDivider parentRef={ganttChart} spacing={parseInt(theme.spacing(gap))} onMove={setTableWidth} />\n <Box sx={{ width: `${(1 - tableWidth) * 100}%`, overflow: 'auto' }}>\n <DetailPane\n attributeLinks={attributeLinks}\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","useTheme","MiniGanttChart","DetailPane","GanttTable","GanttTableProvider","ResizableDivider","getTraceModel","TracingGanttChart","props","options","attributeLinks","trace","otlpTrace","theme","e","Error","viewport","setViewport","startTimeUnixMs","endTimeUnixMs","selectedSpan","setSelectedSpan","undefined","ganttChart","tableWidth","setTableWidth","gap","ref","direction","sx","height","minHeight","flexGrow","onSpanClick","parentRef","spacing","parseInt","onMove","width","overflow","span","onCloseBtnClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,GAAG,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAGrD,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,SAASC,aAAa,QAAc,UAAU;AAQ9C;;;;;CAKC,GACD,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,OAAO,EAAEC,cAAc,EAAEC,OAAOC,SAAS,EAAE,GAAGJ;IAEtD,MAAMK,
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo, useRef, useState } from 'react';\nimport { Box, Stack, useTheme } from '@mui/material';\nimport { otlptracev1 } from '@perses-dev/core';\nimport { 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 { AttributeLinks } from './DetailPane/Attributes';\nimport { getTraceModel, Span } from './trace';\nimport { TraceDetails } from './TraceDetails';\n\nexport interface TracingGanttChartProps {\n options: TracingGanttChartOptions;\n attributeLinks?: AttributeLinks;\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, attributeLinks, trace: otlpTrace } = props;\n\n const theme = useTheme();\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>(undefined);\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\n return (\n <Stack ref={ganttChart} direction=\"row\" sx={{ height: '100%', minHeight: '240px', gap }}>\n <Stack sx={{ flexGrow: 1, gap }}>\n <TraceDetails trace={trace} />\n <MiniGanttChart options={options} trace={trace} viewport={viewport} setViewport={setViewport} />\n <GanttTableProvider>\n <GanttTable\n options={options}\n trace={trace}\n viewport={viewport}\n selectedSpan={selectedSpan}\n onSpanClick={setSelectedSpan}\n />\n </GanttTableProvider>\n </Stack>\n {selectedSpan && (\n <>\n <ResizableDivider parentRef={ganttChart} spacing={parseInt(theme.spacing(gap))} onMove={setTableWidth} />\n <Box sx={{ width: `${(1 - tableWidth) * 100}%`, overflow: 'auto' }}>\n <DetailPane\n attributeLinks={attributeLinks}\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","useTheme","MiniGanttChart","DetailPane","GanttTable","GanttTableProvider","ResizableDivider","getTraceModel","TraceDetails","TracingGanttChart","props","options","attributeLinks","trace","otlpTrace","theme","e","Error","viewport","setViewport","startTimeUnixMs","endTimeUnixMs","selectedSpan","setSelectedSpan","undefined","ganttChart","tableWidth","setTableWidth","gap","ref","direction","sx","height","minHeight","flexGrow","onSpanClick","parentRef","spacing","parseInt","onMove","width","overflow","span","onCloseBtnClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,GAAG,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAGrD,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,UAAU,QAAQ,0BAA0B;AAErD,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,SAASC,aAAa,QAAc,UAAU;AAC9C,SAASC,YAAY,QAAQ,iBAAiB;AAQ9C;;;;;CAKC,GACD,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAE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IAAMpB,gBAAgBC;;;;;;;AAOrD"}
|
|
@@ -14,16 +14,62 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
AttributeList: function() {
|
|
20
25
|
return AttributeList;
|
|
26
|
+
},
|
|
27
|
+
TraceAttributes: function() {
|
|
28
|
+
return TraceAttributes;
|
|
21
29
|
}
|
|
22
30
|
});
|
|
23
31
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
32
|
const _react = require("react");
|
|
25
33
|
const _material = require("@mui/material");
|
|
26
34
|
const _reactrouterdom = require("react-router-dom");
|
|
35
|
+
const _utils = require("../utils");
|
|
36
|
+
function TraceAttributes(props) {
|
|
37
|
+
const { trace, span, attributeLinks } = props;
|
|
38
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.List, {
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(AttributeItem, {
|
|
43
|
+
name: "span ID",
|
|
44
|
+
value: span.spanId
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(AttributeItem, {
|
|
47
|
+
name: "start",
|
|
48
|
+
value: (0, _utils.formatDuration)(span.startTimeUnixMs - trace.startTimeUnixMs)
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(AttributeItem, {
|
|
51
|
+
name: "duration",
|
|
52
|
+
value: (0, _utils.formatDuration)(span.endTimeUnixMs - span.startTimeUnixMs)
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {}),
|
|
57
|
+
span.attributes.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(AttributeList, {
|
|
60
|
+
attributeLinks: attributeLinks,
|
|
61
|
+
attributes: span.attributes
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {})
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(AttributeList, {
|
|
67
|
+
attributeLinks: attributeLinks,
|
|
68
|
+
attributes: span.resource.attributes
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
27
73
|
function AttributeList(props) {
|
|
28
74
|
const { attributeLinks, attributes } = props;
|
|
29
75
|
const attributesMap = (0, _react.useMemo)(()=>Object.fromEntries(attributes.map((attr)=>[
|
|
@@ -32,34 +78,35 @@ function AttributeList(props) {
|
|
|
32
78
|
])), [
|
|
33
79
|
attributes
|
|
34
80
|
]);
|
|
35
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
36
|
-
children:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
81
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.List, {
|
|
82
|
+
children: attributes.sort((a, b)=>a.key.localeCompare(b.key)).map((attribute, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(AttributeItem, {
|
|
83
|
+
name: attribute.key,
|
|
84
|
+
value: renderAttributeValue(attribute.value),
|
|
85
|
+
link: attributeLinks?.[attribute.key]?.(attributesMap)
|
|
86
|
+
}, i))
|
|
42
87
|
});
|
|
43
88
|
}
|
|
44
89
|
function AttributeItem(props) {
|
|
45
|
-
const {
|
|
46
|
-
const
|
|
90
|
+
const { name, value, link } = props;
|
|
91
|
+
const valueComponent = link ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Link, {
|
|
47
92
|
component: _reactrouterdom.Link,
|
|
48
|
-
to:
|
|
49
|
-
children:
|
|
50
|
-
}) :
|
|
93
|
+
to: link,
|
|
94
|
+
children: value
|
|
95
|
+
}) : value;
|
|
51
96
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItem, {
|
|
52
97
|
disablePadding: true,
|
|
53
98
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItemText, {
|
|
54
|
-
primary:
|
|
55
|
-
secondary:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
99
|
+
primary: name,
|
|
100
|
+
secondary: valueComponent,
|
|
101
|
+
slotProps: {
|
|
102
|
+
primary: {
|
|
103
|
+
variant: 'h5'
|
|
104
|
+
},
|
|
105
|
+
secondary: {
|
|
106
|
+
variant: 'body1',
|
|
107
|
+
sx: {
|
|
108
|
+
wordBreak: 'break-word'
|
|
109
|
+
}
|
|
63
110
|
}
|
|
64
111
|
}
|
|
65
112
|
})
|
|
@@ -84,18 +84,10 @@ function DetailPane(props) {
|
|
|
84
84
|
]
|
|
85
85
|
})
|
|
86
86
|
}),
|
|
87
|
-
tab === 'attributes' && /*#__PURE__*/ (0, _jsxruntime.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
attributes: span.attributes
|
|
92
|
-
}),
|
|
93
|
-
span.attributes.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {}),
|
|
94
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Attributes.AttributeList, {
|
|
95
|
-
attributeLinks: attributeLinks,
|
|
96
|
-
attributes: span.resource.attributes
|
|
97
|
-
})
|
|
98
|
-
]
|
|
87
|
+
tab === 'attributes' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Attributes.TraceAttributes, {
|
|
88
|
+
trace: trace,
|
|
89
|
+
span: span,
|
|
90
|
+
attributeLinks: attributeLinks
|
|
99
91
|
}),
|
|
100
92
|
tab === 'events' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_SpanEvents.SpanEventList, {
|
|
101
93
|
trace: trace,
|