@perses-dev/trace-table-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.
Files changed (108) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/341.3d4493d2.css +1 -0
  4. package/__mf/css/async/759.3d4493d2.css +1 -0
  5. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  6. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  7. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  8. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  9. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  10. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  11. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  12. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  13. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  17. package/__mf/js/152.cad35107.js +5 -0
  18. package/__mf/js/TraceTable.80656031.js +5 -0
  19. package/__mf/js/async/129.6a1a1c7d.js +147 -0
  20. package/__mf/js/async/129.6a1a1c7d.js.LICENSE.txt +27 -0
  21. package/__mf/js/async/156.525f3a44.js +1 -0
  22. package/__mf/js/async/173.f0db00ba.js +2 -0
  23. package/__mf/js/async/173.f0db00ba.js.LICENSE.txt +19 -0
  24. package/__mf/js/async/377.d6e7ba1a.js +2 -0
  25. package/__mf/js/async/377.d6e7ba1a.js.LICENSE.txt +32 -0
  26. package/__mf/js/async/559.b30e0b88.js +29 -0
  27. package/__mf/js/async/559.b30e0b88.js.LICENSE.txt +84 -0
  28. package/__mf/js/async/620.006d05f8.js +2 -0
  29. package/__mf/js/async/620.006d05f8.js.LICENSE.txt +9 -0
  30. package/__mf/js/async/651.4fdbe698.js +1 -0
  31. package/__mf/js/async/694.3c3c415f.js +1 -0
  32. package/__mf/js/async/740.fe5d3770.js +1 -0
  33. package/__mf/js/async/75.c1d82ca8.js +1 -0
  34. package/__mf/js/async/770.6cac4f4b.js +1 -0
  35. package/__mf/js/async/835.2f07f9d8.js +80 -0
  36. package/__mf/js/async/835.2f07f9d8.js.LICENSE.txt +9 -0
  37. package/__mf/js/async/960.dc16b984.js +2 -0
  38. package/__mf/js/async/960.dc16b984.js.LICENSE.txt +8 -0
  39. package/__mf/js/async/964.01c67113.js +2 -0
  40. package/__mf/js/async/964.01c67113.js.LICENSE.txt +9 -0
  41. package/__mf/js/async/__federation_expose_TraceTable.0f16deca.js +1 -0
  42. package/__mf/js/main.57cf0123.js +1 -0
  43. package/lib/DataTable.d.ts +15 -0
  44. package/lib/DataTable.d.ts.map +1 -0
  45. package/lib/DataTable.js +240 -0
  46. package/lib/DataTable.js.map +1 -0
  47. package/lib/TraceTable.d.ts +8 -0
  48. package/lib/TraceTable.d.ts.map +1 -0
  49. package/lib/TraceTable.js +25 -0
  50. package/lib/TraceTable.js.map +1 -0
  51. package/lib/TraceTablePanel.d.ts +19 -0
  52. package/lib/TraceTablePanel.d.ts.map +1 -0
  53. package/lib/TraceTablePanel.js +55 -0
  54. package/lib/TraceTablePanel.js.map +1 -0
  55. package/lib/bootstrap.d.ts +2 -0
  56. package/lib/bootstrap.d.ts.map +1 -0
  57. package/lib/bootstrap.js +19 -0
  58. package/lib/bootstrap.js.map +1 -0
  59. package/lib/cjs/DataTable.js +253 -0
  60. package/lib/cjs/TraceTable.js +31 -0
  61. package/lib/cjs/TraceTablePanel.js +71 -0
  62. package/lib/cjs/bootstrap.js +26 -0
  63. package/lib/cjs/env.d.js +14 -0
  64. package/lib/cjs/getPluginModule.js +27 -0
  65. package/lib/cjs/index-federation.js +55 -0
  66. package/lib/cjs/index.js +28 -0
  67. package/lib/cjs/setup-tests.js +19 -0
  68. package/lib/cjs/test/mock-trace-data.js +130 -0
  69. package/lib/cjs/trace-table-model.js +28 -0
  70. package/lib/cjs/utils/palette.js +83 -0
  71. package/lib/cjs/utils/utils.js +40 -0
  72. package/lib/env.d.js +15 -0
  73. package/lib/env.d.js.map +1 -0
  74. package/lib/getPluginModule.d.ts +6 -0
  75. package/lib/getPluginModule.d.ts.map +1 -0
  76. package/lib/getPluginModule.js +16 -0
  77. package/lib/getPluginModule.js.map +1 -0
  78. package/lib/index-federation.d.ts +1 -0
  79. package/lib/index-federation.d.ts.map +1 -0
  80. package/lib/index-federation.js +15 -0
  81. package/lib/index-federation.js.map +1 -0
  82. package/lib/index.d.ts +6 -0
  83. package/lib/index.d.ts.map +1 -0
  84. package/lib/index.js +7 -0
  85. package/lib/index.js.map +1 -0
  86. package/lib/setup-tests.d.ts +2 -0
  87. package/lib/setup-tests.d.ts.map +1 -0
  88. package/lib/setup-tests.js +17 -0
  89. package/lib/setup-tests.js.map +1 -0
  90. package/lib/test/mock-trace-data.d.ts +73 -0
  91. package/lib/test/mock-trace-data.d.ts.map +1 -0
  92. package/lib/test/mock-trace-data.js +114 -0
  93. package/lib/test/mock-trace-data.js.map +1 -0
  94. package/lib/trace-table-model.d.ts +17 -0
  95. package/lib/trace-table-model.d.ts.map +1 -0
  96. package/lib/trace-table-model.js +22 -0
  97. package/lib/trace-table-model.js.map +1 -0
  98. package/lib/utils/palette.d.ts +6 -0
  99. package/lib/utils/palette.d.ts.map +1 -0
  100. package/lib/utils/palette.js +64 -0
  101. package/lib/utils/palette.js.map +1 -0
  102. package/lib/utils/utils.d.ts +4 -0
  103. package/lib/utils/utils.d.ts.map +1 -0
  104. package/lib/utils/utils.js +32 -0
  105. package/lib/utils/utils.js.map +1 -0
  106. package/mf-manifest.json +235 -0
  107. package/mf-stats.json +271 -0
  108. package/package.json +56 -0
@@ -0,0 +1,253 @@
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, "DataTable", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return DataTable;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _core = require("@perses-dev/core");
26
+ const _reactrouterdom = require("react-router-dom");
27
+ const _Information = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Information"));
28
+ const _components = require("@perses-dev/components");
29
+ const _xdatagrid = require("@mui/x-data-grid");
30
+ const _react = require("react");
31
+ const _utils = require("./utils/utils");
32
+ function _interop_require_default(obj) {
33
+ return obj && obj.__esModule ? obj : {
34
+ default: obj
35
+ };
36
+ }
37
+ const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
38
+ dateStyle: 'long',
39
+ timeStyle: 'medium'
40
+ }).format;
41
+ const UTC_DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
42
+ dateStyle: 'long',
43
+ timeStyle: 'long',
44
+ timeZone: 'UTC'
45
+ }).format;
46
+ function DataTable(props) {
47
+ const { options, result, traceLink } = props;
48
+ const muiTheme = (0, _material.useTheme)();
49
+ const chartsTheme = (0, _components.useChartsTheme)();
50
+ const paletteMode = options.visual?.palette?.mode;
51
+ const serviceColorGenerator = (0, _react.useCallback)((serviceName)=>(0, _utils.getServiceColor)(muiTheme, chartsTheme, paletteMode, serviceName), [
52
+ muiTheme,
53
+ chartsTheme,
54
+ paletteMode
55
+ ]);
56
+ const rows = [];
57
+ for (const query of result){
58
+ for (const trace of query.data?.searchResult || []){
59
+ rows.push({
60
+ ...trace,
61
+ id: trace.traceId,
62
+ traceLink: traceLink?.({
63
+ query: query.definition,
64
+ traceId: trace.traceId
65
+ })
66
+ });
67
+ }
68
+ }
69
+ const columns = (0, _react.useMemo)(()=>[
70
+ {
71
+ field: 'name',
72
+ headerName: 'Trace name',
73
+ type: 'string',
74
+ flex: 4,
75
+ display: 'flex',
76
+ valueGetter: (_, trace)=>`${trace.rootServiceName}: ${trace.rootTraceName}`,
77
+ renderCell: ({ row })=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
78
+ sx: {
79
+ my: 1
80
+ },
81
+ children: [
82
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TraceName, {
83
+ row: row
84
+ }),
85
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("br", {}),
86
+ Object.entries(row.serviceStats).map(([serviceName, stats])=>/*#__PURE__*/ (0, _jsxruntime.jsx)(ServiceChip, {
87
+ serviceName: serviceName,
88
+ stats: stats,
89
+ serviceColor: serviceColorGenerator(serviceName)
90
+ }, serviceName))
91
+ ]
92
+ })
93
+ },
94
+ {
95
+ field: 'spanCount',
96
+ headerName: 'Spans',
97
+ type: 'number',
98
+ headerAlign: 'left',
99
+ align: 'left',
100
+ flex: 2,
101
+ minWidth: 145,
102
+ display: 'flex',
103
+ valueGetter: (_, trace)=>Object.values(trace.serviceStats).reduce((acc, val)=>acc + val.spanCount, 0),
104
+ renderCell: ({ row })=>{
105
+ let totalSpanCount = 0;
106
+ let totalErrorCount = 0;
107
+ for (const stats of Object.values(row.serviceStats)){
108
+ totalSpanCount += stats.spanCount;
109
+ totalErrorCount += stats.errorCount ?? 0;
110
+ }
111
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
112
+ children: [
113
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
114
+ display: "inline",
115
+ children: [
116
+ totalSpanCount,
117
+ " spans"
118
+ ]
119
+ }),
120
+ totalErrorCount > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Chip, {
121
+ label: `${totalErrorCount} error${totalErrorCount === 1 ? '' : 's'}`,
122
+ sx: {
123
+ marginLeft: '5px'
124
+ },
125
+ icon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Information.default, {}),
126
+ variant: "outlined",
127
+ size: "small",
128
+ color: "error"
129
+ })
130
+ ]
131
+ });
132
+ }
133
+ },
134
+ {
135
+ field: 'durationMs',
136
+ headerName: 'Duration',
137
+ type: 'number',
138
+ headerAlign: 'left',
139
+ align: 'left',
140
+ flex: 1,
141
+ minWidth: 70,
142
+ display: 'flex',
143
+ renderCell: ({ row })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
144
+ display: "inline",
145
+ children: row.durationMs < 1 ? '<1ms' : (0, _core.formatDuration)((0, _core.msToPrometheusDuration)(row.durationMs))
146
+ })
147
+ },
148
+ {
149
+ field: 'startTimeUnixMs',
150
+ headerName: 'Start time',
151
+ type: 'number',
152
+ headerAlign: 'left',
153
+ align: 'left',
154
+ flex: 3,
155
+ minWidth: 240,
156
+ display: 'flex',
157
+ renderCell: ({ row })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
158
+ title: UTC_DATE_FORMATTER(new Date(row.startTimeUnixMs)),
159
+ placement: "top",
160
+ arrow: true,
161
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
162
+ display: "inline",
163
+ children: DATE_FORMATTER(new Date(row.startTimeUnixMs))
164
+ }, `st-${row.traceId}`)
165
+ })
166
+ }
167
+ ], [
168
+ serviceColorGenerator
169
+ ]);
170
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_xdatagrid.DataGrid, {
171
+ sx: {
172
+ borderWidth: 0
173
+ },
174
+ columns: columns,
175
+ rows: rows,
176
+ getRowHeight: ()=>'auto',
177
+ getEstimatedRowHeight: ()=>66,
178
+ disableRowSelectionOnClick: true,
179
+ pageSizeOptions: [
180
+ 10,
181
+ 20,
182
+ 50,
183
+ 100
184
+ ],
185
+ initialState: {
186
+ pagination: {
187
+ paginationModel: {
188
+ pageSize: 20
189
+ }
190
+ }
191
+ }
192
+ });
193
+ }
194
+ function TraceName({ row: trace }) {
195
+ if (trace.traceLink) {
196
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Link, {
197
+ variant: "body1",
198
+ color: "inherit",
199
+ underline: "hover",
200
+ component: _reactrouterdom.Link,
201
+ to: trace.traceLink,
202
+ children: [
203
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("strong", {
204
+ children: [
205
+ trace.rootServiceName,
206
+ ":"
207
+ ]
208
+ }),
209
+ " ",
210
+ trace.rootTraceName
211
+ ]
212
+ });
213
+ }
214
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
215
+ display: "inline",
216
+ children: [
217
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("strong", {
218
+ children: [
219
+ trace.rootServiceName,
220
+ ":"
221
+ ]
222
+ }),
223
+ " ",
224
+ trace.rootTraceName
225
+ ]
226
+ });
227
+ }
228
+ function ServiceChip({ serviceName, stats, serviceColor }) {
229
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Chip, {
230
+ label: serviceName,
231
+ variant: "outlined",
232
+ size: "small",
233
+ style: {
234
+ ['--service-color']: serviceColor
235
+ },
236
+ sx: {
237
+ marginTop: '5px',
238
+ marginRight: '5px',
239
+ borderColor: 'var(--service-color)'
240
+ },
241
+ avatar: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Avatar, {
242
+ sx: {
243
+ minWidth: 'fit-content',
244
+ padding: '6px',
245
+ backgroundColor: 'var(--service-color)',
246
+ fontSize: '0.65rem',
247
+ fontWeight: 'bold',
248
+ textShadow: '0 0 5px #fff'
249
+ },
250
+ children: stats.spanCount
251
+ })
252
+ });
253
+ }
@@ -0,0 +1,31 @@
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, "TraceTable", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return TraceTable;
21
+ }
22
+ });
23
+ const _TraceTablePanel = require("./TraceTablePanel");
24
+ const _tracetablemodel = require("./trace-table-model");
25
+ const TraceTable = {
26
+ PanelComponent: _TraceTablePanel.TraceTablePanel,
27
+ supportedQueryTypes: [
28
+ 'TraceQuery'
29
+ ],
30
+ createInitialOptions: _tracetablemodel.createInitialTraceTableOptions
31
+ };
@@ -0,0 +1,71 @@
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
+ 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
+ TraceTablePanel: function() {
25
+ return TraceTablePanel;
26
+ },
27
+ defaultTraceLink: function() {
28
+ return defaultTraceLink;
29
+ }
30
+ });
31
+ const _jsxruntime = require("react/jsx-runtime");
32
+ const _material = require("@mui/material");
33
+ const _components = require("@perses-dev/components");
34
+ const _DataTable = require("./DataTable");
35
+ function defaultTraceLink({ query: originalQuery, traceId }) {
36
+ // clone the original query spec (including the datasource) and replace the query value with the trace id
37
+ const query = JSON.parse(JSON.stringify(originalQuery));
38
+ query.spec.plugin.spec.query = traceId;
39
+ const traceLinkParams = new URLSearchParams({
40
+ explorer: 'Tempo-TempoExplorer',
41
+ data: JSON.stringify({
42
+ queries: [
43
+ query
44
+ ]
45
+ })
46
+ });
47
+ return `/explore?${traceLinkParams}`;
48
+ }
49
+ function TraceTablePanel(props) {
50
+ const { spec, queryResults, traceLink } = props;
51
+ const chartsTheme = (0, _components.useChartsTheme)();
52
+ const contentPadding = chartsTheme.container.padding.default;
53
+ const tracesFound = queryResults.some((traceData)=>(traceData.data?.searchResult ?? []).length > 0);
54
+ if (!tracesFound) {
55
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.NoDataOverlay, {
56
+ resource: "traces"
57
+ });
58
+ }
59
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
60
+ sx: {
61
+ height: '100%',
62
+ padding: `${contentPadding}px`,
63
+ overflowY: 'auto'
64
+ },
65
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DataTable.DataTable, {
66
+ options: spec,
67
+ result: queryResults,
68
+ traceLink: traceLink === null ? undefined : traceLink ?? defaultTraceLink
69
+ })
70
+ });
71
+ }
@@ -0,0 +1,26 @@
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
+ const _jsxruntime = require("react/jsx-runtime");
18
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
19
+ const _client = /*#__PURE__*/ _interop_require_default(require("react-dom/client"));
20
+ function _interop_require_default(obj) {
21
+ return obj && obj.__esModule ? obj : {
22
+ default: obj
23
+ };
24
+ }
25
+ const root = _client.default.createRoot(document.getElementById('root'));
26
+ root.render(/*#__PURE__*/ (0, _jsxruntime.jsx)(_react.default.StrictMode, {}));
@@ -0,0 +1,14 @@
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
+ /// <reference types="@rsbuild/core/types" />
14
+ "use strict";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getPluginModule", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getPluginModule;
9
+ }
10
+ });
11
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function getPluginModule() {
18
+ const { name, version, perses } = _packagejson.default;
19
+ return {
20
+ kind: 'PluginModule',
21
+ metadata: {
22
+ name,
23
+ version
24
+ },
25
+ spec: perses
26
+ };
27
+ }
@@ -0,0 +1,55 @@
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
+ function _getRequireWildcardCache(nodeInterop) {
15
+ if (typeof WeakMap !== "function") return null;
16
+ var cacheBabelInterop = new WeakMap();
17
+ var cacheNodeInterop = new WeakMap();
18
+ return (_getRequireWildcardCache = function(nodeInterop) {
19
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
20
+ })(nodeInterop);
21
+ }
22
+ function _interop_require_wildcard(obj, nodeInterop) {
23
+ if (!nodeInterop && obj && obj.__esModule) {
24
+ return obj;
25
+ }
26
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
27
+ return {
28
+ default: obj
29
+ };
30
+ }
31
+ var cache = _getRequireWildcardCache(nodeInterop);
32
+ if (cache && cache.has(obj)) {
33
+ return cache.get(obj);
34
+ }
35
+ var newObj = {
36
+ __proto__: null
37
+ };
38
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
39
+ for(var key in obj){
40
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
41
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
42
+ if (desc && (desc.get || desc.set)) {
43
+ Object.defineProperty(newObj, key, desc);
44
+ } else {
45
+ newObj[key] = obj[key];
46
+ }
47
+ }
48
+ }
49
+ newObj.default = obj;
50
+ if (cache) {
51
+ cache.set(obj, newObj);
52
+ }
53
+ return newObj;
54
+ }
55
+ Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getPluginModule", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _getPluginModule.getPluginModule;
9
+ }
10
+ });
11
+ _export_star(require("./DataTable"), exports);
12
+ const _getPluginModule = require("./getPluginModule");
13
+ _export_star(require("./trace-table-model"), exports);
14
+ _export_star(require("./TraceTable"), exports);
15
+ _export_star(require("./TraceTablePanel"), exports);
16
+ function _export_star(from, to) {
17
+ Object.keys(from).forEach(function(k) {
18
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
19
+ Object.defineProperty(to, k, {
20
+ enumerable: true,
21
+ get: function() {
22
+ return from[k];
23
+ }
24
+ });
25
+ }
26
+ });
27
+ return from;
28
+ }
@@ -0,0 +1,19 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ require("@testing-library/jest-dom");
18
+ // Always mock e-charts during tests since we don't have a proper canvas in jsdom
19
+ jest.mock('echarts/core');
@@ -0,0 +1,130 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ MOCK_TRACE_SEARCH_RESULT: function() {
25
+ return MOCK_TRACE_SEARCH_RESULT;
26
+ },
27
+ MOCK_TRACE_SEARCH_RESULT_EMPTY: function() {
28
+ return MOCK_TRACE_SEARCH_RESULT_EMPTY;
29
+ },
30
+ MOCK_TRACE_SEARCH_RESULT_QUERY_RESULT: function() {
31
+ return MOCK_TRACE_SEARCH_RESULT_QUERY_RESULT;
32
+ },
33
+ MOCK_TRACE_SEARCH_RESULT_QUERY_RESULT_EMPTY: function() {
34
+ return MOCK_TRACE_SEARCH_RESULT_QUERY_RESULT_EMPTY;
35
+ }
36
+ });
37
+ const MOCK_TRACE_SEARCH_RESULT = {
38
+ searchResult: [
39
+ {
40
+ startTimeUnixMs: 1702915645000,
41
+ durationMs: 100,
42
+ serviceStats: {
43
+ 'service-name': {
44
+ spanCount: 10
45
+ },
46
+ 'second-service-name': {
47
+ spanCount: 3,
48
+ errorCount: 2
49
+ }
50
+ },
51
+ traceId: '123',
52
+ rootServiceName: 'service-name',
53
+ rootTraceName: 'span-name'
54
+ }
55
+ ],
56
+ metadata: {
57
+ executedQueryString: '{duration > 500ms}'
58
+ }
59
+ };
60
+ const MOCK_TRACE_SEARCH_RESULT_EMPTY = {
61
+ searchResult: [],
62
+ metadata: {
63
+ executedQueryString: '{duration > 500ms}'
64
+ }
65
+ };
66
+ const MOCK_TRACE_SEARCH_RESULT_QUERY_RESULT = [
67
+ {
68
+ status: 'success',
69
+ fetchStatus: 'idle',
70
+ isLoading: false,
71
+ isSuccess: true,
72
+ isError: false,
73
+ data: MOCK_TRACE_SEARCH_RESULT,
74
+ dataUpdatedAt: 1666500979895,
75
+ definition: {
76
+ kind: 'TraceQuery',
77
+ spec: {
78
+ plugin: {
79
+ kind: 'TempoTraceQuery',
80
+ spec: {
81
+ query: '{}',
82
+ datasource: {
83
+ kind: 'TempoDatasource',
84
+ name: 'tempolocal'
85
+ }
86
+ }
87
+ }
88
+ }
89
+ },
90
+ error: null,
91
+ errorUpdatedAt: 0,
92
+ failureCount: 0,
93
+ errorUpdateCount: 0,
94
+ isFetched: true,
95
+ isFetchedAfterMount: true,
96
+ isFetching: false,
97
+ isRefetching: false,
98
+ isLoadingError: false,
99
+ isPaused: false,
100
+ isPlaceholderData: false,
101
+ isPreviousData: false,
102
+ isRefetchError: false,
103
+ isStale: true
104
+ }
105
+ ];
106
+ const MOCK_TRACE_SEARCH_RESULT_QUERY_RESULT_EMPTY = [
107
+ {
108
+ status: 'success',
109
+ fetchStatus: 'idle',
110
+ isLoading: false,
111
+ isSuccess: true,
112
+ isError: false,
113
+ data: MOCK_TRACE_SEARCH_RESULT_EMPTY,
114
+ dataUpdatedAt: 1666500979895,
115
+ error: null,
116
+ errorUpdatedAt: 0,
117
+ failureCount: 0,
118
+ errorUpdateCount: 0,
119
+ isFetched: true,
120
+ isFetchedAfterMount: true,
121
+ isFetching: false,
122
+ isRefetching: false,
123
+ isLoadingError: false,
124
+ isPaused: false,
125
+ isPlaceholderData: false,
126
+ isPreviousData: false,
127
+ isRefetchError: false,
128
+ isStale: true
129
+ }
130
+ ];