@perses-dev/tempo-plugin 0.57.0-beta.0 → 0.57.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 (155) hide show
  1. package/__mf/js/{Tempo.7093dd4a.js → Tempo.a15c7ca4.js} +3 -3
  2. package/__mf/js/async/1728.988e2b29.js +1 -0
  3. package/__mf/js/async/1905.d3c01a20.js +2 -0
  4. package/__mf/js/async/{7583.bfd2f519.js → 3064.2462a755.js} +1 -1
  5. package/__mf/js/async/392.b27ef564.js +2 -0
  6. package/__mf/js/async/54.812deb71.js +22 -0
  7. package/__mf/js/async/7902.57efc83f.js +2 -0
  8. package/__mf/js/async/7958.4ba5d596.js +7 -0
  9. package/__mf/js/async/9877.d18186e5.js +38 -0
  10. package/__mf/js/async/{__federation_expose_TempoDatasource.a0c321ab.js → __federation_expose_TempoDatasource.1f9ab43f.js} +2 -2
  11. package/__mf/js/async/__federation_expose_TempoExplorer.003c9970.js +1 -0
  12. package/__mf/js/async/{__federation_expose_TempoTraceQuery.e1786579.js → __federation_expose_TempoTraceQuery.eff34861.js} +1 -1
  13. package/__mf/js/async/lib-router.66abf9e6.js +2 -0
  14. package/__mf/js/async/{lib-router.4c755752.js.LICENSE.txt → lib-router.66abf9e6.js.LICENSE.txt} +3 -3
  15. package/__mf/js/{main.db74e654.js → main.6a6654b6.js} +3 -3
  16. package/lib/bootstrap.js +1 -1
  17. package/lib/bootstrap.js.map +1 -1
  18. package/lib/cjs/bootstrap.js +1 -1
  19. package/lib/cjs/components/AttributeFilters.js +1 -1
  20. package/lib/cjs/components/ClosableAlert.js +40 -0
  21. package/lib/cjs/components/TraceQLEditor.js +1 -1
  22. package/lib/cjs/components/TraceQLExtension.js +1 -1
  23. package/lib/cjs/components/complete.js +1 -1
  24. package/lib/cjs/components/filter/filter.js +12 -0
  25. package/lib/cjs/components/filter/filter_to_traceql.js +12 -0
  26. package/lib/cjs/components/filter/index.js +1 -1
  27. package/lib/cjs/components/filter/traceql_to_filter.js +12 -0
  28. package/lib/cjs/components/highlight.js +1 -1
  29. package/lib/cjs/components/index.js +1 -1
  30. package/lib/cjs/env.d.js +1 -1
  31. package/lib/cjs/explore/TempoExplorer.js +6 -5
  32. package/lib/cjs/explore/index.js +12 -0
  33. package/lib/cjs/explore/links.js +1 -1
  34. package/lib/cjs/getPluginModule.js +12 -0
  35. package/lib/cjs/index-federation.js +1 -1
  36. package/lib/cjs/index.js +12 -0
  37. package/lib/cjs/model/api-types.js +1 -1
  38. package/lib/cjs/model/index.js +1 -1
  39. package/lib/cjs/model/tempo-client.js +1 -1
  40. package/lib/cjs/model/tempo-selectors.js +1 -1
  41. package/lib/cjs/model/trace-query-model.js +1 -1
  42. package/lib/cjs/plugins/TempoDatasourceEditor.js +1 -1
  43. package/lib/cjs/plugins/index.js +12 -0
  44. package/lib/cjs/plugins/tempo-datasource-types.js +1 -1
  45. package/lib/cjs/plugins/tempo-datasource.js +1 -1
  46. package/lib/cjs/plugins/tempo-trace-query/TempoTraceQuery.js +1 -1
  47. package/lib/cjs/plugins/tempo-trace-query/TempoTraceQueryEditor.js +1 -1
  48. package/lib/cjs/plugins/tempo-trace-query/get-trace-data.js +1 -1
  49. package/lib/cjs/plugins/tempo-trace-query/index.js +12 -0
  50. package/lib/cjs/plugins/tempo-trace-query/query-editor-model.js +1 -1
  51. package/lib/cjs/setup-tests.js +1 -1
  52. package/lib/cjs/test/index.js +1 -1
  53. package/lib/cjs/test/mock-data.js +1 -1
  54. package/lib/cjs/test/setup-tests.js +1 -1
  55. package/lib/components/AttributeFilters.js +1 -1
  56. package/lib/components/AttributeFilters.js.map +1 -1
  57. package/lib/components/ClosableAlert.d.ts +3 -0
  58. package/lib/components/ClosableAlert.d.ts.map +1 -0
  59. package/lib/components/ClosableAlert.js +32 -0
  60. package/lib/components/ClosableAlert.js.map +1 -0
  61. package/lib/components/TraceQLEditor.js +1 -1
  62. package/lib/components/TraceQLEditor.js.map +1 -1
  63. package/lib/components/TraceQLExtension.js +1 -1
  64. package/lib/components/TraceQLExtension.js.map +1 -1
  65. package/lib/components/complete.js +1 -1
  66. package/lib/components/complete.js.map +1 -1
  67. package/lib/components/filter/filter.d.ts.map +1 -1
  68. package/lib/components/filter/filter.js +12 -0
  69. package/lib/components/filter/filter.js.map +1 -1
  70. package/lib/components/filter/filter_to_traceql.d.ts.map +1 -1
  71. package/lib/components/filter/filter_to_traceql.js +12 -0
  72. package/lib/components/filter/filter_to_traceql.js.map +1 -1
  73. package/lib/components/filter/index.js +1 -1
  74. package/lib/components/filter/index.js.map +1 -1
  75. package/lib/components/filter/traceql_to_filter.d.ts.map +1 -1
  76. package/lib/components/filter/traceql_to_filter.js +12 -0
  77. package/lib/components/filter/traceql_to_filter.js.map +1 -1
  78. package/lib/components/highlight.js +1 -1
  79. package/lib/components/highlight.js.map +1 -1
  80. package/lib/components/index.js +1 -1
  81. package/lib/components/index.js.map +1 -1
  82. package/lib/env.d.js +1 -1
  83. package/lib/env.d.js.map +1 -1
  84. package/lib/explore/TempoExplorer.d.ts.map +1 -1
  85. package/lib/explore/TempoExplorer.js +7 -6
  86. package/lib/explore/TempoExplorer.js.map +1 -1
  87. package/lib/explore/index.d.ts.map +1 -1
  88. package/lib/explore/index.js +12 -0
  89. package/lib/explore/index.js.map +1 -1
  90. package/lib/explore/links.js +1 -1
  91. package/lib/explore/links.js.map +1 -1
  92. package/lib/getPluginModule.d.ts.map +1 -1
  93. package/lib/getPluginModule.js +12 -0
  94. package/lib/getPluginModule.js.map +1 -1
  95. package/lib/index-federation.js +1 -1
  96. package/lib/index-federation.js.map +1 -1
  97. package/lib/index.d.ts.map +1 -1
  98. package/lib/index.js +12 -0
  99. package/lib/index.js.map +1 -1
  100. package/lib/model/api-types.js +1 -1
  101. package/lib/model/api-types.js.map +1 -1
  102. package/lib/model/index.js +1 -1
  103. package/lib/model/index.js.map +1 -1
  104. package/lib/model/tempo-client.js +1 -1
  105. package/lib/model/tempo-client.js.map +1 -1
  106. package/lib/model/tempo-selectors.js +1 -1
  107. package/lib/model/tempo-selectors.js.map +1 -1
  108. package/lib/model/trace-query-model.js +1 -1
  109. package/lib/model/trace-query-model.js.map +1 -1
  110. package/lib/plugins/TempoDatasourceEditor.js +1 -1
  111. package/lib/plugins/TempoDatasourceEditor.js.map +1 -1
  112. package/lib/plugins/index.d.ts.map +1 -1
  113. package/lib/plugins/index.js +12 -0
  114. package/lib/plugins/index.js.map +1 -1
  115. package/lib/plugins/tempo-datasource-types.js +1 -1
  116. package/lib/plugins/tempo-datasource-types.js.map +1 -1
  117. package/lib/plugins/tempo-datasource.js +1 -1
  118. package/lib/plugins/tempo-datasource.js.map +1 -1
  119. package/lib/plugins/tempo-trace-query/TempoTraceQuery.js +1 -1
  120. package/lib/plugins/tempo-trace-query/TempoTraceQuery.js.map +1 -1
  121. package/lib/plugins/tempo-trace-query/TempoTraceQueryEditor.js +1 -1
  122. package/lib/plugins/tempo-trace-query/TempoTraceQueryEditor.js.map +1 -1
  123. package/lib/plugins/tempo-trace-query/get-trace-data.js +1 -1
  124. package/lib/plugins/tempo-trace-query/get-trace-data.js.map +1 -1
  125. package/lib/plugins/tempo-trace-query/index.d.ts.map +1 -1
  126. package/lib/plugins/tempo-trace-query/index.js +12 -0
  127. package/lib/plugins/tempo-trace-query/index.js.map +1 -1
  128. package/lib/plugins/tempo-trace-query/query-editor-model.js +1 -1
  129. package/lib/plugins/tempo-trace-query/query-editor-model.js.map +1 -1
  130. package/lib/setup-tests.js +1 -1
  131. package/lib/setup-tests.js.map +1 -1
  132. package/lib/test/index.js +1 -1
  133. package/lib/test/index.js.map +1 -1
  134. package/lib/test/mock-data.js +1 -1
  135. package/lib/test/mock-data.js.map +1 -1
  136. package/lib/test/setup-tests.js +1 -1
  137. package/lib/test/setup-tests.js.map +1 -1
  138. package/mf-manifest.json +36 -36
  139. package/mf-stats.json +36 -36
  140. package/package.json +6 -6
  141. package/__mf/js/async/1490.cc0a832d.js +0 -22
  142. package/__mf/js/async/1728.21067e6f.js +0 -1
  143. package/__mf/js/async/3849.d1b5a7aa.js +0 -7
  144. package/__mf/js/async/392.fd3eade4.js +0 -2
  145. package/__mf/js/async/4746.c0ce20c6.js +0 -2
  146. package/__mf/js/async/5214.d2077bec.js +0 -2
  147. package/__mf/js/async/8035.ce79a5fb.js +0 -38
  148. package/__mf/js/async/__federation_expose_TempoExplorer.79065666.js +0 -1
  149. package/__mf/js/async/lib-router.4c755752.js +0 -2
  150. /package/__mf/js/async/{4746.c0ce20c6.js.LICENSE.txt → 1905.d3c01a20.js.LICENSE.txt} +0 -0
  151. /package/__mf/js/async/{392.fd3eade4.js.LICENSE.txt → 392.b27ef564.js.LICENSE.txt} +0 -0
  152. /package/__mf/js/async/{1490.cc0a832d.js.LICENSE.txt → 54.812deb71.js.LICENSE.txt} +0 -0
  153. /package/__mf/js/async/{5214.d2077bec.js.LICENSE.txt → 7902.57efc83f.js.LICENSE.txt} +0 -0
  154. /package/__mf/js/async/{3849.d1b5a7aa.js.LICENSE.txt → 7958.4ba5d596.js.LICENSE.txt} +0 -0
  155. /package/__mf/js/async/{__federation_expose_TempoDatasource.a0c321ab.js.LICENSE.txt → __federation_expose_TempoDatasource.1f9ab43f.js.LICENSE.txt} +0 -0
@@ -1,3 +1,15 @@
1
+ // Copyright 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.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,3 +1,15 @@
1
+ // Copyright 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.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
package/lib/cjs/env.d.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -28,6 +28,7 @@ const _dashboards = require("@perses-dev/dashboards");
28
28
  const _explore = require("@perses-dev/explore");
29
29
  const _pluginsystem = require("@perses-dev/plugin-system");
30
30
  const _react = require("react");
31
+ const _ClosableAlert = require("../components/ClosableAlert");
31
32
  const _links = require("./links");
32
33
  function SearchResultsPanel({ queries }) {
33
34
  const { isFetching, isLoading, queryResults } = (0, _pluginsystem.useDataQueries)('TraceQuery');
@@ -55,6 +56,10 @@ function SearchResultsPanel({ queries }) {
55
56
  },
56
57
  gap: 2,
57
58
  children: [
59
+ hasMoreResults && /*#__PURE__*/ (0, _jsxruntime.jsx)(_ClosableAlert.ClosableAlert, {
60
+ severity: "warning",
61
+ children: "Not all matching traces are currently visible. Increase the display limit to view more."
62
+ }),
58
63
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
59
64
  sx: {
60
65
  height: '35%',
@@ -105,10 +110,6 @@ function SearchResultsPanel({ queries }) {
105
110
  }
106
111
  }
107
112
  }
108
- }),
109
- hasMoreResults && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Alert, {
110
- severity: "info",
111
- children: "Not all matching traces are currently displayed. Increase the result limit to view additional traces."
112
113
  })
113
114
  ]
114
115
  });
@@ -1,3 +1,15 @@
1
+ // Copyright 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.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -16,7 +16,7 @@ _export(exports, {
16
16
  return linkToTrace;
17
17
  }
18
18
  });
19
- // Copyright 2025 The Perses Authors
19
+ // Copyright The Perses Authors
20
20
  // Licensed under the Apache License, Version 2.0 (the "License");
21
21
  // you may not use this file except in compliance with the License.
22
22
  // You may obtain a copy of the License at
@@ -1,3 +1,15 @@
1
+ // Copyright 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.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -40,7 +40,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
40
40
  }
41
41
  return newObj;
42
42
  }
43
- // Copyright 2024 The Perses Authors
43
+ // Copyright The Perses Authors
44
44
  // Licensed under the Apache License, Version 2.0 (the "License");
45
45
  // you may not use this file except in compliance with the License.
46
46
  // You may obtain a copy of the License at
package/lib/cjs/index.js CHANGED
@@ -1,3 +1,15 @@
1
+ // Copyright 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.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,3 +1,15 @@
1
+ // Copyright 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.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,3 +1,15 @@
1
+ // Copyright 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.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // Copyright 2025 The Perses Authors
2
+ // Copyright The Perses Authors
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
5
5
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/AttributeFilters.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, SyntheticEvent, useCallback, useEffect, useState } from 'react';\nimport { Autocomplete, Checkbox, Stack, TextField, TextFieldProps } from '@mui/material';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { useQuery } from '@tanstack/react-query';\nimport { TempoClient } from '../model';\nimport { getUnixTimeRange } from '../plugins/tempo-trace-query/get-trace-data';\nimport { filterToTraceQL } from './filter/filter_to_traceql';\nimport { traceQLToFilter } from './filter/traceql_to_filter';\nimport { DurationField, Filter, splitByUnquotedWhitespace } from './filter/filter';\n\nconst statusOptions = ['unset', 'ok', 'error'];\n\nexport interface AttributeFiltersProps {\n client?: TempoClient;\n query: string;\n setQuery: (x: string) => void;\n}\n\nexport function AttributeFilters(props: AttributeFiltersProps): ReactElement {\n const { client, query, setQuery } = props;\n\n const filter = traceQLToFilter(query);\n const setFilter = (filter: Filter) => {\n setQuery(filterToTraceQL(filter));\n };\n\n const { absoluteTimeRange } = useTimeRange();\n const { start, end } = getUnixTimeRange(absoluteTimeRange);\n\n const { data: serviceNameOptions } = useTagValues(\n client,\n 'resource.service.name',\n filterToTraceQL({ ...filter, serviceName: [] }),\n start,\n end\n );\n const { data: spanNameOptions } = useTagValues(\n client,\n 'name',\n filterToTraceQL({ ...filter, spanName: [] }),\n start,\n end\n );\n\n return (\n <>\n <StringAttributeFilter\n label=\"Service Name\"\n options={serviceNameOptions ?? []}\n value={filter.serviceName}\n setValue={(x) => setFilter({ ...filter, serviceName: x })}\n />\n <StringAttributeFilter\n label=\"Span Name\"\n options={spanNameOptions ?? []}\n value={filter.spanName}\n setValue={(x) => setFilter({ ...filter, spanName: x })}\n />\n <StringAttributeFilter\n label=\"Status\"\n width={210}\n options={statusOptions ?? []}\n value={filter.status}\n setValue={(x) => setFilter({ ...filter, status: x })}\n />\n <DurationAttributeFilter\n label=\"Trace Duration\"\n value={filter.traceDuration}\n setValue={(value) => setFilter({ ...filter, traceDuration: value })}\n />\n <CustomAttributesFilter\n label=\"Custom Attributes\"\n value={filter.customMatchers}\n setValue={(value) => setFilter({ ...filter, customMatchers: value })}\n />\n </>\n );\n}\n\ninterface StringAttributeFilterProps {\n label: string;\n width?: number;\n options: string[];\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction StringAttributeFilter(props: StringAttributeFilterProps) {\n const { label, width, options, value, setValue } = props;\n\n return (\n <Autocomplete\n multiple\n size=\"small\"\n limitTags={1}\n disableCloseOnSelect\n value={value}\n onChange={(_event: SyntheticEvent, newValue: string[]) => setValue(newValue)}\n options={options}\n renderOption={(props, option, { selected }) => {\n const { key, ...optionProps } = props;\n return (\n <li key={key} {...optionProps}>\n <Checkbox style={{ marginRight: 8 }} checked={selected} />\n {option}\n </li>\n );\n }}\n renderInput={(params) => <TextField {...params} label={label} />}\n // Reduce the size of the chips to make space for the <input> element, the +X text and the X button to avoid a line break.\n // See https://github.com/mui/material-ui/issues/38835 for more details.\n slotProps={{ chip: { sx: { maxWidth: 'calc(100% - 45px) !important' } } }}\n // Reduce the size of the <input> field\n sx={{ width: width ?? 250, '& input': { minWidth: '5px !important' } }}\n />\n );\n}\n\ninterface DurationAttributeFilterProps {\n label: string;\n value: DurationField;\n setValue: (value: DurationField) => void;\n}\n\nfunction DurationAttributeFilter(props: DurationAttributeFilterProps) {\n const { label, value, setValue } = props;\n const { min, max } = value;\n\n return (\n <Stack direction=\"row\" gap={0.5}>\n <DurationTextInput label={`Min ${label}`} value={min ?? ''} setValue={(min) => setValue({ min, max })} />\n <DurationTextInput label={`Max ${label}`} value={max ?? ''} setValue={(max) => setValue({ min, max })} />\n </Stack>\n );\n}\n\nconst durationFormatRegex = /^([0-9]+\\.)?[0-9]+(ns|ms|s|m|h)$/;\n\ninterface DurationTextInputProps {\n label: string;\n value: string;\n setValue: (value: string) => void;\n}\n\nfunction DurationTextInput(props: DurationTextInputProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n value={value}\n setValue={setValue}\n validationRegex={durationFormatRegex}\n validationFailedMessage=\"Invalid format. Accepted format e.g. 100ms, accepted units: ns, ms, s, m, h\"\n sx={{ width: 150 }}\n />\n );\n}\n\ninterface CustomAttributesFilterProps {\n label: string;\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction CustomAttributesFilter(props: CustomAttributesFilterProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n placeholder='span.http.status_code=200 span.http.method=\"GET\"'\n value={value.join(' ')}\n setValue={(x) => setValue(splitByUnquotedWhitespace(x))}\n sx={{ flexGrow: 1 }}\n />\n );\n}\n\ninterface LazyTextInputProps extends Omit<TextFieldProps, 'variant'> {\n validationRegex?: RegExp;\n validationFailedMessage?: string;\n value: string;\n setValue: (value: string) => void;\n}\n\n/** A <TextField> which calls props.setValue when the input field is blurred and the validation passes. */\nfunction LazyTextInput(props: LazyTextInputProps) {\n const { validationRegex, validationFailedMessage, value, setValue, ...otherProps } = props;\n const [draftValue, setDraftValue] = useState(value);\n const isValidInput = draftValue == '' || validationRegex == undefined || validationRegex.test(draftValue);\n\n useEffect(() => {\n setDraftValue(value);\n }, [value, setDraftValue]);\n\n const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setDraftValue(event.target.value);\n }, []);\n\n const handleBlur = useCallback(() => {\n if (isValidInput) {\n setValue(draftValue);\n }\n }, [isValidInput, setValue, draftValue]);\n\n return (\n <TextField\n {...otherProps}\n error={!isValidInput}\n helperText={isValidInput ? undefined : validationFailedMessage}\n value={draftValue}\n onChange={handleChange}\n onBlur={handleBlur}\n />\n );\n}\n\nfunction useTagValues(client: TempoClient | undefined, tag: string, query: string, start?: number, end?: number) {\n return useQuery({\n queryKey: ['useTagValues', client, tag, query, start, end],\n enabled: !!client,\n queryFn: async function () {\n if (!client) return;\n const values = await client.searchTagValues({ tag, q: query, start, end });\n return values.tagValues.map((tagValue) => tagValue.value ?? '').sort();\n },\n staleTime: 60 * 1000, // cache tag value response for 1m\n });\n}\n"],"names":["useCallback","useEffect","useState","Autocomplete","Checkbox","Stack","TextField","useTimeRange","useQuery","getUnixTimeRange","filterToTraceQL","traceQLToFilter","splitByUnquotedWhitespace","statusOptions","AttributeFilters","props","client","query","setQuery","filter","setFilter","absoluteTimeRange","start","end","data","serviceNameOptions","useTagValues","serviceName","spanNameOptions","spanName","StringAttributeFilter","label","options","value","setValue","x","width","status","DurationAttributeFilter","traceDuration","CustomAttributesFilter","customMatchers","multiple","size","limitTags","disableCloseOnSelect","onChange","_event","newValue","renderOption","option","selected","key","optionProps","li","style","marginRight","checked","renderInput","params","slotProps","chip","sx","maxWidth","minWidth","min","max","direction","gap","DurationTextInput","durationFormatRegex","LazyTextInput","validationRegex","validationFailedMessage","placeholder","join","flexGrow","otherProps","draftValue","setDraftValue","isValidInput","undefined","test","handleChange","event","target","handleBlur","error","helperText","onBlur","tag","queryKey","enabled","queryFn","values","searchTagValues","q","tagValues","map","tagValue","sort","staleTime"],"mappings":";AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAuCA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AACvF,SAASC,YAAY,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,SAAS,QAAwB,gBAAgB;AACzF,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,QAAQ,QAAQ,wBAAwB;AAEjD,SAASC,gBAAgB,QAAQ,8CAA8C;AAC/E,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAAgCC,yBAAyB,QAAQ,kBAAkB;AAEnF,MAAMC,gBAAgB;IAAC;IAAS;IAAM;CAAQ;AAQ9C,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGH;IAEpC,MAAMI,SAASR,gBAAgBM;IAC/B,MAAMG,YAAY,CAACD;QACjBD,SAASR,gBAAgBS;IAC3B;IAEA,MAAM,EAAEE,iBAAiB,EAAE,GAAGd;IAC9B,MAAM,EAAEe,KAAK,EAAEC,GAAG,EAAE,GAAGd,iBAAiBY;IAExC,MAAM,EAAEG,MAAMC,kBAAkB,EAAE,GAAGC,aACnCV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YAAOK;YAAOC;SAAI;QAC1DqE,SAAS,CAAC,CAAC5E;QACX6E,SAAS;YACP,IAAI,CAAC7E,QAAQ;YACb,MAAM8E,SAAS,MAAM9E,OAAO+E,eAAe,CAAC;gBAAEL;gBAAKM,GAAG/E;gBAAOK;gBAAOC;YAAI;YACxE,OAAOuE,OAAOG,SAAS,CAACC,GAAG,CAAC,CAACC,WAAaA,SAASlE,KAAK,IAAI,IAAImE,IAAI;QACtE;QACAC,WAAW,KAAK;IAClB;AACF"}
1
+ {"version":3,"sources":["../../../src/components/AttributeFilters.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, SyntheticEvent, useCallback, useEffect, useState } from 'react';\nimport { Autocomplete, Checkbox, Stack, TextField, TextFieldProps } from '@mui/material';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { useQuery } from '@tanstack/react-query';\nimport { TempoClient } from '../model';\nimport { getUnixTimeRange } from '../plugins/tempo-trace-query/get-trace-data';\nimport { filterToTraceQL } from './filter/filter_to_traceql';\nimport { traceQLToFilter } from './filter/traceql_to_filter';\nimport { DurationField, Filter, splitByUnquotedWhitespace } from './filter/filter';\n\nconst statusOptions = ['unset', 'ok', 'error'];\n\nexport interface AttributeFiltersProps {\n client?: TempoClient;\n query: string;\n setQuery: (x: string) => void;\n}\n\nexport function AttributeFilters(props: AttributeFiltersProps): ReactElement {\n const { client, query, setQuery } = props;\n\n const filter = traceQLToFilter(query);\n const setFilter = (filter: Filter) => {\n setQuery(filterToTraceQL(filter));\n };\n\n const { absoluteTimeRange } = useTimeRange();\n const { start, end } = getUnixTimeRange(absoluteTimeRange);\n\n const { data: serviceNameOptions } = useTagValues(\n client,\n 'resource.service.name',\n filterToTraceQL({ ...filter, serviceName: [] }),\n start,\n end\n );\n const { data: spanNameOptions } = useTagValues(\n client,\n 'name',\n filterToTraceQL({ ...filter, spanName: [] }),\n start,\n end\n );\n\n return (\n <>\n <StringAttributeFilter\n label=\"Service Name\"\n options={serviceNameOptions ?? []}\n value={filter.serviceName}\n setValue={(x) => setFilter({ ...filter, serviceName: x })}\n />\n <StringAttributeFilter\n label=\"Span Name\"\n options={spanNameOptions ?? []}\n value={filter.spanName}\n setValue={(x) => setFilter({ ...filter, spanName: x })}\n />\n <StringAttributeFilter\n label=\"Status\"\n width={210}\n options={statusOptions ?? []}\n value={filter.status}\n setValue={(x) => setFilter({ ...filter, status: x })}\n />\n <DurationAttributeFilter\n label=\"Trace Duration\"\n value={filter.traceDuration}\n setValue={(value) => setFilter({ ...filter, traceDuration: value })}\n />\n <CustomAttributesFilter\n label=\"Custom Attributes\"\n value={filter.customMatchers}\n setValue={(value) => setFilter({ ...filter, customMatchers: value })}\n />\n </>\n );\n}\n\ninterface StringAttributeFilterProps {\n label: string;\n width?: number;\n options: string[];\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction StringAttributeFilter(props: StringAttributeFilterProps) {\n const { label, width, options, value, setValue } = props;\n\n return (\n <Autocomplete\n multiple\n size=\"small\"\n limitTags={1}\n disableCloseOnSelect\n value={value}\n onChange={(_event: SyntheticEvent, newValue: string[]) => setValue(newValue)}\n options={options}\n renderOption={(props, option, { selected }) => {\n const { key, ...optionProps } = props;\n return (\n <li key={key} {...optionProps}>\n <Checkbox style={{ marginRight: 8 }} checked={selected} />\n {option}\n </li>\n );\n }}\n renderInput={(params) => <TextField {...params} label={label} />}\n // Reduce the size of the chips to make space for the <input> element, the +X text and the X button to avoid a line break.\n // See https://github.com/mui/material-ui/issues/38835 for more details.\n slotProps={{ chip: { sx: { maxWidth: 'calc(100% - 45px) !important' } } }}\n // Reduce the size of the <input> field\n sx={{ width: width ?? 250, '& input': { minWidth: '5px !important' } }}\n />\n );\n}\n\ninterface DurationAttributeFilterProps {\n label: string;\n value: DurationField;\n setValue: (value: DurationField) => void;\n}\n\nfunction DurationAttributeFilter(props: DurationAttributeFilterProps) {\n const { label, value, setValue } = props;\n const { min, max } = value;\n\n return (\n <Stack direction=\"row\" gap={0.5}>\n <DurationTextInput label={`Min ${label}`} value={min ?? ''} setValue={(min) => setValue({ min, max })} />\n <DurationTextInput label={`Max ${label}`} value={max ?? ''} setValue={(max) => setValue({ min, max })} />\n </Stack>\n );\n}\n\nconst durationFormatRegex = /^([0-9]+\\.)?[0-9]+(ns|ms|s|m|h)$/;\n\ninterface DurationTextInputProps {\n label: string;\n value: string;\n setValue: (value: string) => void;\n}\n\nfunction DurationTextInput(props: DurationTextInputProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n value={value}\n setValue={setValue}\n validationRegex={durationFormatRegex}\n validationFailedMessage=\"Invalid format. Accepted format e.g. 100ms, accepted units: ns, ms, s, m, h\"\n sx={{ width: 150 }}\n />\n );\n}\n\ninterface CustomAttributesFilterProps {\n label: string;\n value: string[];\n setValue: (value: string[]) => void;\n}\n\nfunction CustomAttributesFilter(props: CustomAttributesFilterProps) {\n const { label, value, setValue } = props;\n\n return (\n <LazyTextInput\n label={label}\n size=\"small\"\n placeholder='span.http.status_code=200 span.http.method=\"GET\"'\n value={value.join(' ')}\n setValue={(x) => setValue(splitByUnquotedWhitespace(x))}\n sx={{ flexGrow: 1 }}\n />\n );\n}\n\ninterface LazyTextInputProps extends Omit<TextFieldProps, 'variant'> {\n validationRegex?: RegExp;\n validationFailedMessage?: string;\n value: string;\n setValue: (value: string) => void;\n}\n\n/** A <TextField> which calls props.setValue when the input field is blurred and the validation passes. */\nfunction LazyTextInput(props: LazyTextInputProps) {\n const { validationRegex, validationFailedMessage, value, setValue, ...otherProps } = props;\n const [draftValue, setDraftValue] = useState(value);\n const isValidInput = draftValue == '' || validationRegex == undefined || validationRegex.test(draftValue);\n\n useEffect(() => {\n setDraftValue(value);\n }, [value, setDraftValue]);\n\n const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setDraftValue(event.target.value);\n }, []);\n\n const handleBlur = useCallback(() => {\n if (isValidInput) {\n setValue(draftValue);\n }\n }, [isValidInput, setValue, draftValue]);\n\n return (\n <TextField\n {...otherProps}\n error={!isValidInput}\n helperText={isValidInput ? undefined : validationFailedMessage}\n value={draftValue}\n onChange={handleChange}\n onBlur={handleBlur}\n />\n );\n}\n\nfunction useTagValues(client: TempoClient | undefined, tag: string, query: string, start?: number, end?: number) {\n return useQuery({\n queryKey: ['useTagValues', client, tag, query, start, end],\n enabled: !!client,\n queryFn: async function () {\n if (!client) return;\n const values = await client.searchTagValues({ tag, q: query, start, end });\n return values.tagValues.map((tagValue) => tagValue.value ?? '').sort();\n },\n staleTime: 60 * 1000, // cache tag value response for 1m\n });\n}\n"],"names":["useCallback","useEffect","useState","Autocomplete","Checkbox","Stack","TextField","useTimeRange","useQuery","getUnixTimeRange","filterToTraceQL","traceQLToFilter","splitByUnquotedWhitespace","statusOptions","AttributeFilters","props","client","query","setQuery","filter","setFilter","absoluteTimeRange","start","end","data","serviceNameOptions","useTagValues","serviceName","spanNameOptions","spanName","StringAttributeFilter","label","options","value","setValue","x","width","status","DurationAttributeFilter","traceDuration","CustomAttributesFilter","customMatchers","multiple","size","limitTags","disableCloseOnSelect","onChange","_event","newValue","renderOption","option","selected","key","optionProps","li","style","marginRight","checked","renderInput","params","slotProps","chip","sx","maxWidth","minWidth","min","max","direction","gap","DurationTextInput","durationFormatRegex","LazyTextInput","validationRegex","validationFailedMessage","placeholder","join","flexGrow","otherProps","draftValue","setDraftValue","isValidInput","undefined","test","handleChange","event","target","handleBlur","error","helperText","onBlur","tag","queryKey","enabled","queryFn","values","searchTagValues","q","tagValues","map","tagValue","sort","staleTime"],"mappings":";AAAA,+BA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0,0 +1,3 @@
1
+ import { AlertProps } from '@mui/material';
2
+ export declare function ClosableAlert(props: AlertProps): import("react/jsx-runtime").JSX.Element | null;
3
+ //# sourceMappingURL=ClosableAlert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClosableAlert.d.ts","sourceRoot":"","sources":["../../../src/components/ClosableAlert.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAS,UAAU,EAAE,MAAM,eAAe,CAAC;AAElD,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,kDAY9C"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { useCallback, useState } from 'react';
15
+ import { Alert } from '@mui/material';
16
+ export function ClosableAlert(props) {
17
+ const [isVisible, setVisible] = useState(true);
18
+ const handleClose = useCallback(()=>{
19
+ setVisible(false);
20
+ }, [
21
+ setVisible
22
+ ]);
23
+ if (!isVisible) {
24
+ return null;
25
+ }
26
+ return /*#__PURE__*/ _jsx(Alert, {
27
+ ...props,
28
+ onClose: handleClose
29
+ });
30
+ }
31
+
32
+ //# sourceMappingURL=ClosableAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ClosableAlert.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useCallback, useState } from 'react';\nimport { Alert, AlertProps } from '@mui/material';\n\nexport function ClosableAlert(props: AlertProps) {\n const [isVisible, setVisible] = useState(true);\n\n const handleClose = useCallback(() => {\n setVisible(false);\n }, [setVisible]);\n\n if (!isVisible) {\n return null;\n }\n\n return <Alert {...props} onClose={handleClose} />;\n}\n"],"names":["useCallback","useState","Alert","ClosableAlert","props","isVisible","setVisible","handleClose","onClose"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAC9C,SAASC,KAAK,QAAoB,gBAAgB;AAElD,OAAO,SAASC,cAAcC,KAAiB;IAC7C,MAAM,CAACC,WAAWC,WAAW,GAAGL,SAAS;IAEzC,MAAMM,cAAcP,YAAY;QAC9BM,WAAW;IACb,GAAG;QAACA;KAAW;IAEf,IAAI,CAACD,WAAW;QACd,OAAO;IACT;IAEA,qBAAO,KAACH;QAAO,GAAGE,KAAK;QAAEI,SAASD;;AACpC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // Copyright 2025 The Perses Authors
2
+ // Copyright The Perses Authors
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
5
5
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/TraceQLEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { InputLabel, Stack, useTheme } from '@mui/material';\nimport CodeMirror, { EditorView, ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { isValidTraceId } from '@perses-dev/core';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { TempoClient } from '../model';\nimport { TraceQLExtension } from './TraceQLExtension';\n\nexport interface TraceQLEditorProps extends Omit<ReactCodeMirrorProps, 'theme' | 'extensions'> {\n client?: TempoClient;\n}\n\nexport function TraceQLEditor({ client, ...rest }: TraceQLEditorProps): ReactElement {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const { absoluteTimeRange } = useTimeRange();\n const traceQLExtension = useMemo(() => {\n return TraceQLExtension({ client, timeRange: absoluteTimeRange });\n }, [client, absoluteTimeRange]);\n\n const codemirrorTheme = useMemo(() => {\n // https://github.com/mui/material-ui/blob/v5.16.7/packages/mui-material/src/OutlinedInput/OutlinedInput.js#L43\n const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';\n\n return EditorView.theme({\n '&': {\n backgroundColor: 'transparent !important', // required for dark mode\n border: `1px solid ${borderColor}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n },\n '&.cm-focused.cm-editor': {\n outline: 'none', // remove dotted outline on focus\n },\n '.cm-content': {\n padding: '8px',\n },\n });\n }, [theme]);\n\n return (\n <Stack position=\"relative\" sx={{ flexGrow: 1 }}>\n <InputLabel // reproduce the same kind of input label that regular MUI TextFields have\n shrink\n sx={{\n position: 'absolute',\n top: '-6px',\n left: '10px',\n padding: '0 4px',\n color: theme.palette.text.primary,\n backgroundColor: theme.palette.background.default,\n zIndex: 1,\n }}\n >\n TraceQL Expression\n </InputLabel>\n <CodeMirror\n {...rest}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n lineNumbers: false,\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n // The explore view accepts either a TraceQL query or a Trace ID as input. The lezer grammar marks Trace IDs as invalid,\n // therefore let's disable syntax highlighting if the input is a Trace ID.\n syntaxHighlighting: !isValidTraceId(rest.value ?? ''),\n }}\n extensions={[EditorView.lineWrapping, traceQLExtension, codemirrorTheme]}\n placeholder='Example: {span.http.method = \"GET\"}'\n />\n </Stack>\n );\n}\n"],"names":["useMemo","InputLabel","Stack","useTheme","CodeMirror","EditorView","isValidTraceId","useTimeRange","TraceQLExtension","TraceQLEditor","client","rest","theme","isDarkMode","palette","mode","absoluteTimeRange","traceQLExtension","timeRange","codemirrorTheme","borderColor","backgroundColor","border","borderRadius","shape","outline","padding","position","sx","flexGrow","shrink","top","left","color","text","primary","background","default","zIndex","basicSetup","lineNumbers","highlightActiveLine","highlightActiveLineGutter","foldGutter","syntaxHighlighting","value","extensions","lineWrapping","placeholder"],"mappings":";AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAC5D,OAAOC,cAAcC,UAAU,QAA8B,wBAAwB;AACrF,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,gBAAgB,QAAQ,qBAAqB;AAMtD,OAAO,SAASC,cAAc,EAAEC,MAAM,EAAE,GAAGC,MAA0B;IACnE,MAAMC,QAAQT;IACd,MAAMU,aAAa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../../src/components/TraceQLEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { InputLabel, Stack, useTheme } from '@mui/material';\nimport CodeMirror, { EditorView, ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { isValidTraceId } from '@perses-dev/core';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { TempoClient } from '../model';\nimport { TraceQLExtension } from './TraceQLExtension';\n\nexport interface TraceQLEditorProps extends Omit<ReactCodeMirrorProps, 'theme' | 'extensions'> {\n client?: TempoClient;\n}\n\nexport function TraceQLEditor({ client, ...rest }: TraceQLEditorProps): ReactElement {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const { absoluteTimeRange } = useTimeRange();\n const traceQLExtension = useMemo(() => {\n return TraceQLExtension({ client, timeRange: absoluteTimeRange });\n }, [client, absoluteTimeRange]);\n\n const codemirrorTheme = useMemo(() => {\n // https://github.com/mui/material-ui/blob/v5.16.7/packages/mui-material/src/OutlinedInput/OutlinedInput.js#L43\n const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';\n\n return EditorView.theme({\n '&': {\n backgroundColor: 'transparent !important', // required for dark mode\n border: `1px solid ${borderColor}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n },\n '&.cm-focused.cm-editor': {\n outline: 'none', // remove dotted outline on focus\n },\n '.cm-content': {\n padding: '8px',\n },\n });\n }, [theme]);\n\n return (\n <Stack position=\"relative\" sx={{ flexGrow: 1 }}>\n <InputLabel // reproduce the same kind of input label that regular MUI TextFields have\n shrink\n sx={{\n position: 'absolute',\n top: '-6px',\n left: '10px',\n padding: '0 4px',\n color: theme.palette.text.primary,\n backgroundColor: theme.palette.background.default,\n zIndex: 1,\n }}\n >\n TraceQL Expression\n </InputLabel>\n <CodeMirror\n {...rest}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n lineNumbers: false,\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n // The explore view accepts either a TraceQL query or a Trace ID as input. The lezer grammar marks Trace IDs as invalid,\n // therefore let's disable syntax highlighting if the input is a Trace ID.\n syntaxHighlighting: !isValidTraceId(rest.value ?? ''),\n }}\n extensions={[EditorView.lineWrapping, traceQLExtension, codemirrorTheme]}\n placeholder='Example: {span.http.method = \"GET\"}'\n />\n </Stack>\n );\n}\n"],"names":["useMemo","InputLabel","Stack","useTheme","CodeMirror","EditorView","isValidTraceId","useTimeRange","TraceQLExtension","TraceQLEditor","client","rest","theme","isDarkMode","palette","mode","absoluteTimeRange","traceQLExtension","timeRange","codemirrorTheme","borderColor","backgroundColor","border","borderRadius","shape","outline","padding","position","sx","flexGrow","shrink","top","left","color","text","primary","background","default","zIndex","basicSetup","lineNumbers","highlightActiveLine","highlightActiveLineGutter","foldGutter","syntaxHighlighting","value","extensions","lineWrapping","placeholder"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAC5D,OAAOC,cAAcC,UAAU,QAA8B,wBAAwB;AACrF,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,gBAA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pD;gBACAC,YAAY;oBAACzC,WAAW0C,YAAY;oBAAE9B;oBAAkBE;iBAAgB;gBACxE6B,aAAY;;;;AAIpB"}
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/TraceQLExtension.ts"],"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 { LRLanguage } from '@codemirror/language';\nimport { parser } from '@grafana/lezer-traceql';\nimport { CompletionContext } from '@codemirror/autocomplete';\nimport { Extension } from '@uiw/react-codemirror';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { TempoClient } from '../model/tempo-client';\nimport { traceQLHighlight } from './highlight';\nimport { complete } from './complete';\n\nfunction traceQLLanguage(): LRLanguage {\n return LRLanguage.define({\n parser: parser.configure({\n props: [traceQLHighlight],\n }),\n languageData: {\n closeBrackets: { brackets: ['(', '[', '{', \"'\", '\"', '`'] },\n commentTokens: { line: '//' },\n },\n });\n}\n\nexport interface CompletionConfig {\n /** a TempoClient instance, can be created with TempoDatasource.createClient() */\n client?: TempoClient;\n\n /** search for tag values in a given time range */\n timeRange?: AbsoluteTimeRange;\n\n /** limit number of returned tag values */\n limit?: number;\n\n /**\n * stop search early if number of cache hits exceeds this setting\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\n maxStaleValues?: number;\n}\n\nexport function TraceQLExtension(completionCfg: CompletionConfig): Array<LRLanguage | Extension> {\n const language = traceQLLanguage();\n const completion = language.data.of({\n autocomplete: (ctx: CompletionContext) =>\n complete(completionCfg, ctx).catch((e) => console.error('error during TraceQL auto-complete', e)),\n });\n return [language, completion];\n}\n"],"names":["LRLanguage","parser","traceQLHighlight","complete","traceQLLanguage","define","configure","props","languageData","closeBrackets","brackets","commentTokens","line","TraceQLExtension","completionCfg","language","completion","data","of","autocomplete","ctx","catch","e","console","error"],"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,UAAU,QAAQ,uBAAuB;AAClD,SAASC,MAAM,QAAQ,yBAAyB;AAKhD,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC;IACP,OAAOJ,WAAWK,MAAM,CAAC;QACvBJ,QAAQA,OAAOK,SAAS,CAAC;YACvBC,OAAO;gBAACL;aAAiB;QAC3B;QACAM,cAAc;YACZC,eAAe;gBAAEC,UAAU;oBAAC;oBAAK;oBAAK;oBAAK;oBAAK;oBAAK;iBAAI;YAAC;YAC1DC,eAAe;gBAAEC,MAAM;YAAK;QAC9B;IACF;AACF;AAmBA,OAAO,SAASC,iBAAiBC,aAA+B;IAC9D,MAAMC,WAAWX;IACjB,MAAMY,aAAaD,SAASE,IAAI,CAACC,EAAE,CAAC;QAClCC,cAAc,CAACC,MACbjB,SAASW,eAAeM,KAAKC,KAAK,CAAC,CAACC,IAAMC,QAAQC,KAAK,CAAC,sCAAsCF;IAClG;IACA,OAAO;QAACP;QAAUC;KAAW;AAC/B"}
1
+ {"version":3,"sources":["../../../src/components/TraceQLExtension.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LRLanguage } from '@codemirror/language';\nimport { parser } from '@grafana/lezer-traceql';\nimport { CompletionContext } from '@codemirror/autocomplete';\nimport { Extension } from '@uiw/react-codemirror';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { TempoClient } from '../model/tempo-client';\nimport { traceQLHighlight } from './highlight';\nimport { complete } from './complete';\n\nfunction traceQLLanguage(): LRLanguage {\n return LRLanguage.define({\n parser: parser.configure({\n props: [traceQLHighlight],\n }),\n languageData: {\n closeBrackets: { brackets: ['(', '[', '{', \"'\", '\"', '`'] },\n commentTokens: { line: '//' },\n },\n });\n}\n\nexport interface CompletionConfig {\n /** a TempoClient instance, can be created with TempoDatasource.createClient() */\n client?: TempoClient;\n\n /** search for tag values in a given time range */\n timeRange?: AbsoluteTimeRange;\n\n /** limit number of returned tag values */\n limit?: number;\n\n /**\n * stop search early if number of cache hits exceeds this setting\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\n maxStaleValues?: number;\n}\n\nexport function TraceQLExtension(completionCfg: CompletionConfig): Array<LRLanguage | Extension> {\n const language = traceQLLanguage();\n const completion = language.data.of({\n autocomplete: (ctx: CompletionContext) =>\n complete(completionCfg, ctx).catch((e) => console.error('error during TraceQL auto-complete', e)),\n });\n return [language, completion];\n}\n"],"names":["LRLanguage","parser","traceQLHighlight","complete","traceQLLanguage","define","configure","props","languageData","closeBrackets","brackets","commentTokens","line","TraceQLExtension","completionCfg","language","completion","data","of","autocomplete","ctx","catch","e","console","error"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,MAAM,QAAQ,yBAAyB;AAKhD,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC;IACP,OAAOJ,WAAWK,MAAM,CAAC;QACvBJ,QAAQA,OAAOK,SAAS,CAAC;YACvBC,OAAO;gBAACL;aAAiB;QAC3B;QACAM,cAAc;YACZC,eAAe;gBAAEC,UAAU;oBAAC;oBAAK;oBAAK;oBAAK;oBAAK;oBAAK;iBAAI;YAAC;YAC1DC,eAAe;gBAAEC,MAAM;YAAK;QAC9B;IACF;AACF;AAmBA,OAAO,SAASC,iBAAiBC,aAA+B;IAC9D,MAAMC,WAAWX;IACjB,MAAMY,aAAaD,SAASE,IAAI,CAACC,EAAE,CAAC;QAClCC,cAAc,CAACC,MACbjB,SAASW,eAAeM,KAAKC,KAAK,CAAC,CAACC,IAAMC,QAAQC,KAAK,CAAC,sCAAsCF;IAClG;IACA,OAAO;QAACP;QAAUC;KAAW;AAC/B"}
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at