@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 +1 @@
1
- {"version":3,"sources":["../../../src/model/api-types.ts"],"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 { otlpcommonv1, otlptracev1 } from '@perses-dev/core';\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchRequestParameters {\n q: string;\n start?: number;\n end?: number;\n /** max number of search results, default: 20 */\n limit?: number;\n /** max number of matching spans per trace in search result, default: 3 */\n spss?: number;\n}\n\nexport const DEFAULT_SEARCH_LIMIT = 20;\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchResponse {\n traces: TraceSearchResponse[];\n}\n\nexport interface TraceSearchResponse {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n /** unset if duration is less than 1ms */\n durationMs?: number;\n /** @deprecated spanSet is deprecated in favor of spanSets */\n spanSet?: {\n spans: SpanSearchResponse[];\n matched: number;\n };\n spanSets?: Array<{\n spans: SpanSearchResponse[];\n matched: number;\n }>;\n /** ServiceStats are only available in Tempo vParquet4+ blocks */\n serviceStats?: Record<string, ServiceStats>;\n}\n\nexport interface SpanSearchResponse {\n spanID: string;\n name?: string;\n startTimeUnixNano: string;\n durationNanos: string;\n attributes?: otlpcommonv1.KeyValue[];\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * https://grafana.com/docs/tempo/latest/api_docs/#query\n */\nexport interface QueryRequestParameters {\n traceId: string;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * OTEL trace proto: https://github.com/open-telemetry/opentelemetry-proto-go/blob/main/otlp/trace/v1/trace.pb.go\n */\nexport interface QueryResponse {\n batches: otlptracev1.ResourceSpan[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsRequestParameters {\n scope?: 'resource' | 'span' | 'intrinsic';\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsResponse {\n scopes: SearchTagsScope[];\n}\n\nexport interface SearchTagsScope {\n name: 'resource' | 'span' | 'intrinsic';\n tags: string[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesRequestParameters {\n tag: string;\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesResponse {\n tagValues: SearchTagValue[];\n}\n\nexport interface SearchTagValue {\n type: string;\n /** The tag value. Empty strings are omitted (i.e. undefined) in the response. */\n value?: string;\n}\n"],"names":["DEFAULT_SEARCH_LIMIT"],"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;AAkBjC,OAAO,MAAMA,uBAAuB,GAAG"}
1
+ {"version":3,"sources":["../../../src/model/api-types.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 { otlpcommonv1, otlptracev1 } from '@perses-dev/core';\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchRequestParameters {\n q: string;\n start?: number;\n end?: number;\n /** max number of search results, default: 20 */\n limit?: number;\n /** max number of matching spans per trace in search result, default: 3 */\n spss?: number;\n}\n\nexport const DEFAULT_SEARCH_LIMIT = 20;\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchResponse {\n traces: TraceSearchResponse[];\n}\n\nexport interface TraceSearchResponse {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n /** unset if duration is less than 1ms */\n durationMs?: number;\n /** @deprecated spanSet is deprecated in favor of spanSets */\n spanSet?: {\n spans: SpanSearchResponse[];\n matched: number;\n };\n spanSets?: Array<{\n spans: SpanSearchResponse[];\n matched: number;\n }>;\n /** ServiceStats are only available in Tempo vParquet4+ blocks */\n serviceStats?: Record<string, ServiceStats>;\n}\n\nexport interface SpanSearchResponse {\n spanID: string;\n name?: string;\n startTimeUnixNano: string;\n durationNanos: string;\n attributes?: otlpcommonv1.KeyValue[];\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * https://grafana.com/docs/tempo/latest/api_docs/#query\n */\nexport interface QueryRequestParameters {\n traceId: string;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * OTEL trace proto: https://github.com/open-telemetry/opentelemetry-proto-go/blob/main/otlp/trace/v1/trace.pb.go\n */\nexport interface QueryResponse {\n batches: otlptracev1.ResourceSpan[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsRequestParameters {\n scope?: 'resource' | 'span' | 'intrinsic';\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsResponse {\n scopes: SearchTagsScope[];\n}\n\nexport interface SearchTagsScope {\n name: 'resource' | 'span' | 'intrinsic';\n tags: string[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesRequestParameters {\n tag: string;\n q?: string;\n start?: number;\n end?: number;\n limit?: number;\n maxStaleValues?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesResponse {\n tagValues: SearchTagValue[];\n}\n\nexport interface SearchTagValue {\n type: string;\n /** The tag value. Empty strings are omitted (i.e. undefined) in the response. */\n value?: string;\n}\n"],"names":["DEFAULT_SEARCH_LIMIT"],"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;AAkBjC,OAAO,MAAMA,uBAAuB,GAAG"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/model/index.ts"],"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\nexport * from './tempo-client';\nexport * from './tempo-selectors';\nexport * from './trace-query-model';\nexport * from './api-types';\n"],"names":[],"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,cAAc,iBAAiB;AAC/B,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../../src/model/index.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\nexport * from './tempo-client';\nexport * from './tempo-selectors';\nexport * from './trace-query-model';\nexport * from './api-types';\n"],"names":[],"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,cAAc,iBAAiB;AAC/B,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,cAAc"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/model/tempo-client.ts"],"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 { fetch, otlptracev1, RequestHeaders } from '@perses-dev/core';\nimport { DatasourceClient } from '@perses-dev/plugin-system';\nimport {\n QueryRequestParameters,\n SearchRequestParameters,\n SearchTagsRequestParameters,\n SearchTagsResponse,\n QueryResponse,\n ServiceStats,\n SearchResponse,\n SearchTagValuesRequestParameters,\n SearchTagValuesResponse,\n} from './api-types';\n\ninterface TempoClientOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport interface TempoClient extends DatasourceClient {\n options: TempoClientOptions;\n // https://grafana.com/docs/tempo/latest/api_docs/\n query(params: QueryRequestParameters, headers?: RequestHeaders): Promise<QueryResponse>;\n search(params: SearchRequestParameters, headers?: RequestHeaders): Promise<SearchResponse>;\n searchWithFallback(params: SearchRequestParameters, headers?: RequestHeaders): Promise<SearchResponse>;\n searchTags(params: SearchTagsRequestParameters, headers?: RequestHeaders): Promise<SearchTagsResponse>;\n searchTagValues(params: SearchTagValuesRequestParameters, headers?: RequestHeaders): Promise<SearchTagValuesResponse>;\n}\n\nexport interface QueryOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport const executeRequest = async <T>(...args: Parameters<typeof global.fetch>): Promise<T> => {\n const response = await fetch(...args);\n try {\n return await response.json();\n } catch (e) {\n console.error('Invalid response from server', e);\n throw new Error('Invalid response from server');\n }\n};\n\nfunction fetchWithGet<TRequest extends RequestParams<TRequest>, TResponse>(\n apiURI: string,\n params: TRequest,\n queryOptions: QueryOptions\n): Promise<TResponse> {\n const { datasourceUrl, headers = {} } = queryOptions;\n\n let url = `${datasourceUrl}${apiURI}`;\n const urlParams = buildSearchParams(params).toString();\n if (urlParams !== '') {\n url += '?' + urlParams;\n }\n const init = {\n method: 'GET',\n headers,\n };\n\n return executeRequest<TResponse>(url, init);\n}\n\ntype RequestParams<T> = { [K in keyof T]: string | number };\n\nfunction buildSearchParams<T>(params: RequestParams<T>): URLSearchParams {\n const urlSearchParams = new URLSearchParams();\n for (const key in params) {\n const value = params[key];\n switch (typeof value) {\n case 'string':\n urlSearchParams.append(key, value);\n break;\n\n case 'number':\n urlSearchParams.append(key, value.toString());\n break;\n }\n }\n return urlSearchParams;\n}\n\n/**\n * Returns a summary report of traces that satisfy the query.\n */\nexport function search(params: SearchRequestParameters, queryOptions: QueryOptions): Promise<SearchResponse> {\n return fetchWithGet<SearchRequestParameters, SearchResponse>('/api/search', params, queryOptions);\n}\n\n/**\n * Returns an entire trace.\n */\nexport function query(params: QueryRequestParameters, queryOptions: QueryOptions): Promise<QueryResponse> {\n return fetchWithGet<Record<string, never>, QueryResponse>(\n `/api/traces/${encodeURIComponent(params.traceId)}`,\n {},\n queryOptions\n );\n}\n\n/**\n * Returns a summary report of traces that satisfy the query.\n *\n * If the serviceStats field is missing in the response, fetches all traces\n * and calculates the serviceStats.\n *\n * Tempo computes the serviceStats field during ingestion since vParquet4,\n * this fallback is required for older block formats.\n */\nexport async function searchWithFallback(\n params: SearchRequestParameters,\n queryOptions: QueryOptions\n): Promise<SearchResponse> {\n // Get a list of traces that satisfy the query.\n const searchResponse = await search(params, queryOptions);\n if (!searchResponse.traces || searchResponse.traces.length === 0) {\n return { traces: [] };\n }\n\n // exit early if fallback is not required (serviceStats are contained in the response)\n if (searchResponse.traces.every((t) => t.serviceStats)) {\n return searchResponse;\n }\n\n // calculate serviceStats (number of spans and errors) per service\n return {\n traces: await Promise.all(\n searchResponse.traces.map(async (trace) => {\n if (trace.serviceStats) {\n // fallback not required, serviceStats are contained in the response\n return trace;\n }\n\n const serviceStats: Record<string, ServiceStats> = {};\n const searchTraceIDResponse = await query({ traceId: trace.traceID }, queryOptions);\n\n // For every trace, get the full trace, and find the number of spans and errors.\n for (const batch of searchTraceIDResponse.batches) {\n let serviceName = 'unknown';\n for (const attr of batch.resource?.attributes ?? []) {\n if (attr.key === 'service.name' && 'stringValue' in attr.value) {\n serviceName = attr.value.stringValue;\n break;\n }\n }\n\n const stats = serviceStats[serviceName] ?? { spanCount: 0 };\n for (const scopeSpan of batch.scopeSpans) {\n stats.spanCount += scopeSpan.spans.length;\n for (const span of scopeSpan.spans) {\n if (span.status?.code === otlptracev1.StatusCodeError) {\n stats.errorCount = (stats.errorCount ?? 0) + 1;\n }\n }\n }\n serviceStats[serviceName] = stats;\n }\n\n return {\n ...trace,\n serviceStats,\n };\n })\n ),\n };\n}\n\n/**\n * Returns a list of all tag names for a given scope.\n */\nexport function searchTags(\n params: SearchTagsRequestParameters,\n queryOptions: QueryOptions\n): Promise<SearchTagsResponse> {\n return fetchWithGet<SearchTagsRequestParameters, SearchTagsResponse>('/api/v2/search/tags', params, queryOptions);\n}\n\n/**\n * Returns a list of all tag values for a given tag.\n */\nexport function searchTagValues(\n params: SearchTagValuesRequestParameters,\n queryOptions: QueryOptions\n): Promise<SearchTagValuesResponse> {\n const { tag, ...rest } = params;\n return fetchWithGet<Omit<SearchTagValuesRequestParameters, 'tag'>, SearchTagValuesResponse>(\n `/api/v2/search/tag/${encodeURIComponent(tag)}/values`,\n rest,\n queryOptions\n );\n}\n"],"names":["fetch","otlptracev1","executeRequest","args","response","json","e","console","error","Error","fetchWithGet","apiURI","params","queryOptions","datasourceUrl","headers","url","urlParams","buildSearchParams","toString","init","method","urlSearchParams","URLSearchParams","key","value","append","search","query","encodeURIComponent","traceId","searchWithFallback","searchResponse","traces","length","every","t","serviceStats","Promise","all","map","trace","searchTraceIDResponse","traceID","batch","batches","serviceName","attr","resource","attributes","stringValue","stats","spanCount","scopeSpan","scopeSpans","spans","span","status","code","StatusCodeError","errorCount","searchTags","searchTagValues","tag","rest"],"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,WAAW,QAAwB,mBAAmB;AAkCtE,OAAO,MAAMC,iBAAiB,OAAU,GAAGC;IACzC,MAAMC,WAAW,MAAMJ,SAASG;IAChC,IAAI;QACF,OAAO,MAAMC,SAASC,IAAI;IAC5B,EAAE,OAAOC,GAAG;QACVC,QAAQC,KAAK,CAAC,gCAAgCF;QAC9C,MAAM,IAAIG,MAAM;IAClB;AACF,EAAE;AAEF,SAASC,aACPC,MAAc,EACdC,MAAgB,EAChBC,YAA0B;IAE1B,MAAM,EAAEC,aAAa,EAAEC,UAAU,CAAC,CAAC,EAAE,GAAGF;IAExC,IAAIG,MAAM,GAAGF,gBAAgBH,QAAQ;IACrC,MAAMM,YAAYC,kBAAkBN,QAAQO,QAAQ;IACpD,IAAIF,cAAc,IAAI;QACpBD,OAAO,MAAMC;IACf;IACA,MAAMG,OAAO;QACXC,QAAQ;QACRN;IACF;IAEA,OAAOb,eAA0Bc,KAAKI;AACxC;AAIA,SAASF,kBAAqBN,MAAwB;IACpD,MAAMU,kBAAkB,IAAIC;IAC5B,IAAK,MAAMC,OAAOZ,OAAQ;QACxB,MAAMa,QAAQb,MAAM,CAACY,IAAI;QACzB,OAAQ,OAAOC;YACb,KAAK;gBACHH,gBAAgBI,MAAM,CAACF,KAAKC;gBAC5B;YAEF,KAAK;gBACHH,gBAAgBI,MAAM,CAACF,KAAKC,MAAMN,QAAQ;gBAC1C;QACJ;IACF;IACA,OAAOG;AACT;AAEA;;CAEC,GACD,OAAO,SAASK,OAAOf,MAA+B,EAAEC,YAA0B;IAChF,OAAOH,aAAsD,eA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AMC,SAAS,IAAIC,UAAUE,KAAK,CAACrB,MAAM;oBACzC,KAAK,MAAMsB,QAAQH,UAAUE,KAAK,CAAE;wBAClC,IAAIC,KAAKC,MAAM,EAAEC,SAASzD,YAAY0D,eAAe,EAAE;4BACrDR,MAAMS,UAAU,GAAG,AAACT,CAAAA,MAAMS,UAAU,IAAI,CAAA,IAAK;wBAC/C;oBACF;gBACF;gBACAvB,YAAY,CAACS,YAAY,GAAGK;YAC9B;YAEA,OAAO;gBACL,GAAGV,KAAK;gBACRJ;YACF;QACF;IAEJ;AACF;AAEA;;CAEC,GACD,OAAO,SAASwB,WACdjD,MAAmC,EACnCC,YAA0B;IAE1B,OAAOH,aAA8D,uBAAuBE,QAAQC;AACtG;AAEA;;CAEC,GACD,OAAO,SAASiD,gBACdlD,MAAwC,EACxCC,YAA0B;IAE1B,MAAM,EAAEkD,GAAG,EAAE,GAAGC,MAAM,GAAGpD;IACzB,OAAOF,aACL,CAAC,mBAAmB,EAAEmB,mBAAmBkC,KAAK,OAAO,CAAC,EACtDC,MACAnD;AAEJ"}
1
+ {"version":3,"sources":["../../../src/model/tempo-client.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 { fetch, otlptracev1, RequestHeaders } from '@perses-dev/core';\nimport { DatasourceClient } from '@perses-dev/plugin-system';\nimport {\n QueryRequestParameters,\n SearchRequestParameters,\n SearchTagsRequestParameters,\n SearchTagsResponse,\n QueryResponse,\n ServiceStats,\n SearchResponse,\n SearchTagValuesRequestParameters,\n SearchTagValuesResponse,\n} from './api-types';\n\ninterface TempoClientOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport interface TempoClient extends DatasourceClient {\n options: TempoClientOptions;\n // https://grafana.com/docs/tempo/latest/api_docs/\n query(params: QueryRequestParameters, headers?: RequestHeaders): Promise<QueryResponse>;\n search(params: SearchRequestParameters, headers?: RequestHeaders): Promise<SearchResponse>;\n searchWithFallback(params: SearchRequestParameters, headers?: RequestHeaders): Promise<SearchResponse>;\n searchTags(params: SearchTagsRequestParameters, headers?: RequestHeaders): Promise<SearchTagsResponse>;\n searchTagValues(params: SearchTagValuesRequestParameters, headers?: RequestHeaders): Promise<SearchTagValuesResponse>;\n}\n\nexport interface QueryOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport const executeRequest = async <T>(...args: Parameters<typeof global.fetch>): Promise<T> => {\n const response = await fetch(...args);\n try {\n return await response.json();\n } catch (e) {\n console.error('Invalid response from server', e);\n throw new Error('Invalid response from server');\n }\n};\n\nfunction fetchWithGet<TRequest extends RequestParams<TRequest>, TResponse>(\n apiURI: string,\n params: TRequest,\n queryOptions: QueryOptions\n): Promise<TResponse> {\n const { datasourceUrl, headers = {} } = queryOptions;\n\n let url = `${datasourceUrl}${apiURI}`;\n const urlParams = buildSearchParams(params).toString();\n if (urlParams !== '') {\n url += '?' + urlParams;\n }\n const init = {\n method: 'GET',\n headers,\n };\n\n return executeRequest<TResponse>(url, init);\n}\n\ntype RequestParams<T> = { [K in keyof T]: string | number };\n\nfunction buildSearchParams<T>(params: RequestParams<T>): URLSearchParams {\n const urlSearchParams = new URLSearchParams();\n for (const key in params) {\n const value = params[key];\n switch (typeof value) {\n case 'string':\n urlSearchParams.append(key, value);\n break;\n\n case 'number':\n urlSearchParams.append(key, value.toString());\n break;\n }\n }\n return urlSearchParams;\n}\n\n/**\n * Returns a summary report of traces that satisfy the query.\n */\nexport function search(params: SearchRequestParameters, queryOptions: QueryOptions): Promise<SearchResponse> {\n return fetchWithGet<SearchRequestParameters, SearchResponse>('/api/search', params, queryOptions);\n}\n\n/**\n * Returns an entire trace.\n */\nexport function query(params: QueryRequestParameters, queryOptions: QueryOptions): Promise<QueryResponse> {\n return fetchWithGet<Record<string, never>, QueryResponse>(\n `/api/traces/${encodeURIComponent(params.traceId)}`,\n {},\n queryOptions\n );\n}\n\n/**\n * Returns a summary report of traces that satisfy the query.\n *\n * If the serviceStats field is missing in the response, fetches all traces\n * and calculates the serviceStats.\n *\n * Tempo computes the serviceStats field during ingestion since vParquet4,\n * this fallback is required for older block formats.\n */\nexport async function searchWithFallback(\n params: SearchRequestParameters,\n queryOptions: QueryOptions\n): Promise<SearchResponse> {\n // Get a list of traces that satisfy the query.\n const searchResponse = await search(params, queryOptions);\n if (!searchResponse.traces || searchResponse.traces.length === 0) {\n return { traces: [] };\n }\n\n // exit early if fallback is not required (serviceStats are contained in the response)\n if (searchResponse.traces.every((t) => t.serviceStats)) {\n return searchResponse;\n }\n\n // calculate serviceStats (number of spans and errors) per service\n return {\n traces: await Promise.all(\n searchResponse.traces.map(async (trace) => {\n if (trace.serviceStats) {\n // fallback not required, serviceStats are contained in the response\n return trace;\n }\n\n const serviceStats: Record<string, ServiceStats> = {};\n const searchTraceIDResponse = await query({ traceId: trace.traceID }, queryOptions);\n\n // For every trace, get the full trace, and find the number of spans and errors.\n for (const batch of searchTraceIDResponse.batches) {\n let serviceName = 'unknown';\n for (const attr of batch.resource?.attributes ?? []) {\n if (attr.key === 'service.name' && 'stringValue' in attr.value) {\n serviceName = attr.value.stringValue;\n break;\n }\n }\n\n const stats = serviceStats[serviceName] ?? { spanCount: 0 };\n for (const scopeSpan of batch.scopeSpans) {\n stats.spanCount += scopeSpan.spans.length;\n for (const span of scopeSpan.spans) {\n if (span.status?.code === otlptracev1.StatusCodeError) {\n stats.errorCount = (stats.errorCount ?? 0) + 1;\n }\n }\n }\n serviceStats[serviceName] = stats;\n }\n\n return {\n ...trace,\n serviceStats,\n };\n })\n ),\n };\n}\n\n/**\n * Returns a list of all tag names for a given scope.\n */\nexport function searchTags(\n params: SearchTagsRequestParameters,\n queryOptions: QueryOptions\n): Promise<SearchTagsResponse> {\n return fetchWithGet<SearchTagsRequestParameters, SearchTagsResponse>('/api/v2/search/tags', params, queryOptions);\n}\n\n/**\n * Returns a list of all tag values for a given tag.\n */\nexport function searchTagValues(\n params: SearchTagValuesRequestParameters,\n queryOptions: QueryOptions\n): Promise<SearchTagValuesResponse> {\n const { tag, ...rest } = params;\n return fetchWithGet<Omit<SearchTagValuesRequestParameters, 'tag'>, SearchTagValuesResponse>(\n `/api/v2/search/tag/${encodeURIComponent(tag)}/values`,\n rest,\n queryOptions\n );\n}\n"],"names":["fetch","otlptracev1","executeRequest","args","response","json","e","console","error","Error","fetchWithGet","apiURI","params","queryOptions","datasourceUrl","headers","url","urlParams","buildSearchParams","toString","init","method","urlSearchParams","URLSearchParams","key","value","append","search","query","encodeURIComponent","traceId","searchWithFallback","searchResponse","traces","length","every","t","serviceStats","Promise","all","map","trace","searchTraceIDResponse","traceID","batch","batches","serviceName","attr","resource","attributes","stringValue","stats","spanCount","scopeSpan","scopeSpans","spans","span","status","code","StatusCodeError","errorCount","searchTags","searchTagValues","tag","rest"],"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,KAAK,EAAEC,WAAW,QAAwB,mBAAmB;AAkCtE,OAAO,MAAMC,iBAAiB,OAAU,GAAGC;IACzC,MAAMC,WAAW,MAAMJ,SAASG;IAChC,IAAI;QACF,OAAO,MAAMC,SAASC,IAAI;IAC5B,EAAE,OAAOC,GAAG;QACVC,QAAQC,KAAK,CAAC,gCAAgCF;QAC9C,MAAM,IAAIG,MAAM;IAClB;AACF,EAAE;AAEF,SAASC,aACPC,MAAc,EACdC,MAAgB,EAChBC,YAA0B;IAE1B,MAAM,EAAEC,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F,aACL,CAAC,mBAAmB,EAAEmB,mBAAmBkC,KAAK,OAAO,CAAC,EACtDC,MACAnD;AAEJ"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/model/tempo-selectors.ts"],"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 { DatasourceSelector } from '@perses-dev/core';\nimport { DatasourceSelectValue, isVariableDatasource } from '@perses-dev/plugin-system';\n\nexport const TEMPO_DATASOURCE_KIND = 'TempoDatasource' as const;\n\n/**\n * DatasourceSelector for Tempo Datasources.\n */\nexport interface TempoDatasourceSelector extends DatasourceSelector {\n kind: typeof TEMPO_DATASOURCE_KIND;\n}\n\n/**\n * A default selector that asks for the default Tempo Datasource.\n */\nexport const DEFAULT_TEMPO: TempoDatasourceSelector = { kind: TEMPO_DATASOURCE_KIND };\n\n/**\n * Returns true if the provided datasourceSelectValue is the default TempoDatasourceSelector.\n */\nexport function isDefaultTempoSelector(datasourceSelectValue: DatasourceSelectValue): boolean {\n return !isVariableDatasource(datasourceSelectValue) && datasourceSelectValue.name === undefined;\n}\n\n/**\n * Type guard to make sure a datasourceSelectValue is a Tempo one.\n */\nexport function isTempoDatasourceSelector(\n datasourceSelectValue: DatasourceSelectValue\n): datasourceSelectValue is TempoDatasourceSelector {\n return isVariableDatasource(datasourceSelectValue) || datasourceSelectValue.kind === TEMPO_DATASOURCE_KIND;\n}\n"],"names":["isVariableDatasource","TEMPO_DATASOURCE_KIND","DEFAULT_TEMPO","kind","isDefaultTempoSelector","datasourceSelectValue","name","undefined","isTempoDatasourceSelector"],"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;AAGjC,SAAgCA,oBAAoB,QAAQ,4BAA4B;AAExF,OAAO,MAAMC,wBAAwB,kBAA2B;AAShE;;CAEC,GACD,OAAO,MAAMC,gBAAyC;IAAEC,MAAMF;AAAsB,EAAE;AAEtF;;CAEC,GACD,OAAO,SAASG,uBAAuBC,qBAA4C;IACjF,OAAO,CAACL,qBAAqBK,0BAA0BA,sBAAsBC,IAAI,KAAKC;AACxF;AAEA;;CAEC,GACD,OAAO,SAASC,0BACdH,qBAA4C;IAE5C,OAAOL,qBAAqBK,0BAA0BA,sBAAsBF,IAAI,KAAKF;AACvF"}
1
+ {"version":3,"sources":["../../../src/model/tempo-selectors.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 { DatasourceSelector } from '@perses-dev/core';\nimport { DatasourceSelectValue, isVariableDatasource } from '@perses-dev/plugin-system';\n\nexport const TEMPO_DATASOURCE_KIND = 'TempoDatasource' as const;\n\n/**\n * DatasourceSelector for Tempo Datasources.\n */\nexport interface TempoDatasourceSelector extends DatasourceSelector {\n kind: typeof TEMPO_DATASOURCE_KIND;\n}\n\n/**\n * A default selector that asks for the default Tempo Datasource.\n */\nexport const DEFAULT_TEMPO: TempoDatasourceSelector = { kind: TEMPO_DATASOURCE_KIND };\n\n/**\n * Returns true if the provided datasourceSelectValue is the default TempoDatasourceSelector.\n */\nexport function isDefaultTempoSelector(datasourceSelectValue: DatasourceSelectValue): boolean {\n return !isVariableDatasource(datasourceSelectValue) && datasourceSelectValue.name === undefined;\n}\n\n/**\n * Type guard to make sure a datasourceSelectValue is a Tempo one.\n */\nexport function isTempoDatasourceSelector(\n datasourceSelectValue: DatasourceSelectValue\n): datasourceSelectValue is TempoDatasourceSelector {\n return isVariableDatasource(datasourceSelectValue) || datasourceSelectValue.kind === TEMPO_DATASOURCE_KIND;\n}\n"],"names":["isVariableDatasource","TEMPO_DATASOURCE_KIND","DEFAULT_TEMPO","kind","isDefaultTempoSelector","datasourceSelectValue","name","undefined","isTempoDatasourceSelector"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAgCA,oBAAoB,QAAQ,4BAA4B;AAExF,OAAO,MAAMC,wBAAwB,kBAA2B;AAShE;;CAEC,GACD,OAAO,MAAMC,gBAAyC;IAAEC,MAAMF;AAAsB,EAAE;AAEtF;;CAEC,GACD,OAAO,SAASG,uBAAuBC,qBAA4C;IACjF,OAAO,CAACL,qBAAqBK,0BAA0BA,sBAAsBC,IAAI,KAAKC;AACxF;AAEA;;CAEC,GACD,OAAO,SAASC,0BACdH,qBAA4C;IAE5C,OAAOL,qBAAqBK,0BAA0BA,sBAAsBF,IAAI,KAAKF;AACvF"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/model/trace-query-model.ts"],"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 { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { TempoDatasourceSelector } from './tempo-selectors';\n/**\n * The spec/options for the TempoTraceQuery plugin.\n */\nexport interface TempoTraceQuerySpec {\n query: string;\n limit?: number;\n datasource?: DatasourceSelectValue<TempoDatasourceSelector>;\n}\n"],"names":[],"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;AAIjC;;CAEC,GACD,WAIC"}
1
+ {"version":3,"sources":["../../../src/model/trace-query-model.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 { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { TempoDatasourceSelector } from './tempo-selectors';\n/**\n * The spec/options for the TempoTraceQuery plugin.\n */\nexport interface TempoTraceQuerySpec {\n query: string;\n limit?: number;\n datasource?: DatasourceSelectValue<TempoDatasourceSelector>;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;CAEC,GACD,WAIC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } 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/plugins/TempoDatasourceEditor.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 { HTTPSettingsEditor } from '@perses-dev/plugin-system';\nimport React, { ReactElement } from 'react';\nimport { TempoDatasourceSpec } from './tempo-datasource-types';\n\nexport interface TempoDatasourceEditorProps {\n value: TempoDatasourceSpec;\n onChange: (next: TempoDatasourceSpec) => void;\n isReadonly?: boolean;\n}\n\nexport function TempoDatasourceEditor(props: TempoDatasourceEditorProps): ReactElement {\n const { value, onChange, isReadonly } = props;\n\n const initialSpecDirect: TempoDatasourceSpec = {\n directUrl: '',\n };\n\n const initialSpecProxy: TempoDatasourceSpec = {\n proxy: {\n kind: 'HTTPProxy',\n spec: {\n allowedEndpoints: [\n // list of standard endpoints suggested by default\n {\n endpointPattern: '/api/search',\n method: 'GET',\n },\n {\n endpointPattern: '/api/traces',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tags',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tag',\n method: 'GET',\n },\n ],\n url: '',\n },\n },\n };\n\n return (\n <HTTPSettingsEditor\n value={value}\n onChange={onChange}\n isReadonly={isReadonly}\n initialSpecDirect={initialSpecDirect}\n initialSpecProxy={initialSpecProxy}\n />\n );\n}\n"],"names":["HTTPSettingsEditor","React","TempoDatasourceEditor","props","value","onChange","isReadonly","initialSpecDirect","directUrl","initialSpecProxy","proxy","kind","spec","allowedEndpoints","endpointPattern","method","url"],"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,kBAAkB,QAAQ,4BAA4B;AAC/D,OAAOC,WAA6B,QAAQ;AAS5C,OAAO,SAASC,sBAAsBC,KAAiC;IACrE,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGH;IAExC,MAAMI,oBAAyC;QAC7CC,WAAW;IACb;IAEA,MAAMC,mBAAwC;QAC5CC,OAAO;YACLC,MAAM;YACNC,MAAM;gBACJC,kBAAkB;oBAChB,kDAAkD;oBAClD;wBACEC,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;iBACD;gBACDC,KAAK;YACP;QACF;IACF;IAEA,qBACE,KAAChB;QACCI,OAAOA;QACPC,UAAUA;QACVC,YAAYA;QACZC,mBAAmBA;QACnBE,kBAAkBA;;AAGxB"}
1
+ {"version":3,"sources":["../../../src/plugins/TempoDatasourceEditor.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 { HTTPSettingsEditor } from '@perses-dev/plugin-system';\nimport React, { ReactElement } from 'react';\nimport { TempoDatasourceSpec } from './tempo-datasource-types';\n\nexport interface TempoDatasourceEditorProps {\n value: TempoDatasourceSpec;\n onChange: (next: TempoDatasourceSpec) => void;\n isReadonly?: boolean;\n}\n\nexport function TempoDatasourceEditor(props: TempoDatasourceEditorProps): ReactElement {\n const { value, onChange, isReadonly } = props;\n\n const initialSpecDirect: TempoDatasourceSpec = {\n directUrl: '',\n };\n\n const initialSpecProxy: TempoDatasourceSpec = {\n proxy: {\n kind: 'HTTPProxy',\n spec: {\n allowedEndpoints: [\n // list of standard endpoints suggested by default\n {\n endpointPattern: '/api/search',\n method: 'GET',\n },\n {\n endpointPattern: '/api/traces',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tags',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v2/search/tag',\n method: 'GET',\n },\n ],\n url: '',\n },\n },\n };\n\n return (\n <HTTPSettingsEditor\n value={value}\n onChange={onChange}\n isReadonly={isReadonly}\n initialSpecDirect={initialSpecDirect}\n initialSpecProxy={initialSpecProxy}\n />\n );\n}\n"],"names":["HTTPSettingsEditor","React","TempoDatasourceEditor","props","value","onChange","isReadonly","initialSpecDirect","directUrl","initialSpecProxy","proxy","kind","spec","allowedEndpoints","endpointPattern","method","url"],"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,kBAAkB,QAAQ,4BAA4B;AAC/D,OAAOC,WAA6B,QAAQ;AAS5C,OAAO,SAASC,sBAAsBC,KAAiC;IACrE,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGH;IAExC,MAAMI,oBAAyC;QAC7CC,WAAW;IACb;IAEA,MAAMC,mBAAwC;QAC5CC,OAAO;YACLC,MAAM;YACNC,MAAM;gBACJC,kBAAkB;oBAChB,kDAAkD;oBAClD;wBACEC,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;iBACD;gBACDC,KAAK;YACP;QACF;IACF;IAEA,qBACE,KAAChB;QACCI,OAAOA;QACPC,UAAUA;QACVC,YAAYA;QACZC,mBAAmBA;QACnBE,kBAAkBA;;AAGxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
@@ -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
  export * from './tempo-datasource';
2
14
  export * from './tempo-datasource-types';
3
15
  export * from './tempo-trace-query';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/plugins/index.ts"],"sourcesContent":["export * from './tempo-datasource';\nexport * from './tempo-datasource-types';\nexport * from './tempo-trace-query';\nexport * from './TempoDatasourceEditor';\n"],"names":[],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,sBAAsB;AACpC,cAAc,0BAA0B"}
1
+ {"version":3,"sources":["../../../src/plugins/index.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\nexport * from './tempo-datasource';\nexport * from './tempo-datasource-types';\nexport * from './tempo-trace-query';\nexport * from './TempoDatasourceEditor';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,sBAAsB;AACpC,cAAc,0BAA0B"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/plugins/tempo-datasource-types.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 { HTTPProxy } from '@perses-dev/core';\n\nexport interface TempoDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n}\n"],"names":[],"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;AAIjC,WAGC"}
1
+ {"version":3,"sources":["../../../src/plugins/tempo-datasource-types.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 { HTTPProxy } from '@perses-dev/core';\n\nexport interface TempoDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/plugins/tempo-datasource.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 { DatasourcePlugin } from '@perses-dev/plugin-system';\nimport { TempoClient, query, search, searchTagValues, searchTags, searchWithFallback } from '../model/tempo-client';\nimport { TempoDatasourceSpec } from './tempo-datasource-types';\nimport { TempoDatasourceEditor } from './TempoDatasourceEditor';\n\n/**\n * Creates a TempoClient for a specific datasource spec.\n */\nconst createClient: DatasourcePlugin<TempoDatasourceSpec, TempoClient>['createClient'] = (spec, options) => {\n const { directUrl, proxy } = spec;\n const { proxyUrl } = options;\n\n // Use the direct URL if specified, but fallback to the proxyUrl by default if not specified\n const datasourceUrl = directUrl ?? proxyUrl;\n if (datasourceUrl === undefined) {\n throw new Error('No URL specified for Tempo client. You can use directUrl in the spec to configure it.');\n }\n\n const specHeaders = proxy?.spec.headers;\n\n return {\n options: {\n datasourceUrl,\n },\n query: (params, headers) => query(params, { datasourceUrl, headers: headers ?? specHeaders }),\n search: (params, headers) => search(params, { datasourceUrl, headers: headers ?? specHeaders }),\n searchWithFallback: (params, headers) =>\n searchWithFallback(params, { datasourceUrl, headers: headers ?? specHeaders }),\n searchTags: (params, headers) => searchTags(params, { datasourceUrl, headers: headers ?? specHeaders }),\n searchTagValues: (params, headers) => searchTagValues(params, { datasourceUrl, headers: headers ?? specHeaders }),\n };\n};\n\nexport const TempoDatasource: DatasourcePlugin<TempoDatasourceSpec, TempoClient> = {\n createClient,\n OptionsEditorComponent: TempoDatasourceEditor,\n createInitialOptions: () => ({ directUrl: '' }),\n};\n"],"names":["query","search","searchTagValues","searchTags","searchWithFallback","TempoDatasourceEditor","createClient","spec","options","directUrl","proxy","proxyUrl","datasourceUrl","undefined","Error","specHeaders","headers","params","TempoDatasource","OptionsEditorComponent","createInitialOptions"],"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;AAGjC,SAAsBA,KAAK,EAAEC,MAAM,EAAEC,eAAe,EAAEC,UAAU,EAAEC,kBAAkB,QAAQ,wBAAwB;AAEpH,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE;;CAEC,GACD,MAAMC,eAAmF,CAACC,MAAMC;IAC9F,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGH;IAC7B,MAAM,EAAEI,QAAQ,EAAE,GAAGH;IAErB,4FAA4F;IAC5F,MAAMI,gBAAgBH,aAAaE;IACnC,IAAIC,kBAAkBC,WAAW;QAC/B,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,cAAcL,OAAOH,KAAKS;IAEhC,OAAO;QACLR,SAAS;YACPI;QACF;QACAZ,OAAO,CAACiB,QAAQD,UAAYhB,MAAMiB,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC3Fd,QAAQ,CAACgB,QAAQD,UAAYf,OAAOgB,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC7FX,oBAAoB,CAACa,QAAQD,UAC3BZ,mBAAmBa,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC9EZ,YAAY,CAACc,QAAQD,UAAYb,WAAWc,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QACrGb,iBAAiB,CAACe,QAAQD,UAAYd,gBAAgBe,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;IACjH;AACF;AAEA,OAAO,MAAMG,kBAAsE;IACjFZ;IACAa,wBAAwBd;IACxBe,sBAAsB,IAAO,CAAA;YAAEX,WAAW;QAAG,CAAA;AAC/C,EAAE"}
1
+ {"version":3,"sources":["../../../src/plugins/tempo-datasource.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 { DatasourcePlugin } from '@perses-dev/plugin-system';\nimport { TempoClient, query, search, searchTagValues, searchTags, searchWithFallback } from '../model/tempo-client';\nimport { TempoDatasourceSpec } from './tempo-datasource-types';\nimport { TempoDatasourceEditor } from './TempoDatasourceEditor';\n\n/**\n * Creates a TempoClient for a specific datasource spec.\n */\nconst createClient: DatasourcePlugin<TempoDatasourceSpec, TempoClient>['createClient'] = (spec, options) => {\n const { directUrl, proxy } = spec;\n const { proxyUrl } = options;\n\n // Use the direct URL if specified, but fallback to the proxyUrl by default if not specified\n const datasourceUrl = directUrl ?? proxyUrl;\n if (datasourceUrl === undefined) {\n throw new Error('No URL specified for Tempo client. You can use directUrl in the spec to configure it.');\n }\n\n const specHeaders = proxy?.spec.headers;\n\n return {\n options: {\n datasourceUrl,\n },\n query: (params, headers) => query(params, { datasourceUrl, headers: headers ?? specHeaders }),\n search: (params, headers) => search(params, { datasourceUrl, headers: headers ?? specHeaders }),\n searchWithFallback: (params, headers) =>\n searchWithFallback(params, { datasourceUrl, headers: headers ?? specHeaders }),\n searchTags: (params, headers) => searchTags(params, { datasourceUrl, headers: headers ?? specHeaders }),\n searchTagValues: (params, headers) => searchTagValues(params, { datasourceUrl, headers: headers ?? specHeaders }),\n };\n};\n\nexport const TempoDatasource: DatasourcePlugin<TempoDatasourceSpec, TempoClient> = {\n createClient,\n OptionsEditorComponent: TempoDatasourceEditor,\n createInitialOptions: () => ({ directUrl: '' }),\n};\n"],"names":["query","search","searchTagValues","searchTags","searchWithFallback","TempoDatasourceEditor","createClient","spec","options","directUrl","proxy","proxyUrl","datasourceUrl","undefined","Error","specHeaders","headers","params","TempoDatasource","OptionsEditorComponent","createInitialOptions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAsBA,KAAK,EAAEC,MAAM,EAAEC,eAAe,EAAEC,UAAU,EAAEC,kBAAkB,QAAQ,wBAAwB;AAEpH,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE;;CAEC,GACD,MAAMC,eAAmF,CAACC,MAAMC;IAC9F,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGH;IAC7B,MAAM,EAAEI,QAAQ,EAAE,GAAGH;IAErB,4FAA4F;IAC5F,MAAMI,gBAAgBH,aAAaE;IACnC,IAAIC,kBAAkBC,WAAW;QAC/B,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,cAAcL,OAAOH,KAAKS;IAEhC,OAAO;QACLR,SAAS;YACPI;QACF;QACAZ,OAAO,CAACiB,QAAQD,UAAYhB,MAAMiB,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC3Fd,QAAQ,CAACgB,QAAQD,UAAYf,OAAOgB,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC7FX,oBAAoB,CAACa,QAAQD,UAC3BZ,mBAAmBa,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC9EZ,YAAY,CAACc,QAAQD,UAAYb,WAAWc,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QACrGb,iBAAiB,CAACe,QAAQD,UAAYd,gBAAgBe,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;IACjH;AACF;AAEA,OAAO,MAAMG,kBAAsE;IACjFZ;IACAa,wBAAwBd;IACxBe,sBAAsB,IAAO,CAAA;YAAEX,WAAW;QAAG,CAAA;AAC/C,EAAE"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/TempoTraceQuery.ts"],"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 { isVariableDatasource, parseVariables, TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { TempoTraceQuerySpec } from '../../model';\nimport { getTraceData } from './get-trace-data';\nimport { TempoTraceQueryEditor } from './TempoTraceQueryEditor';\n\n/**\n * The core Tempo TraceQuery plugin for Perses.\n */\nexport const TempoTraceQuery: TraceQueryPlugin<TempoTraceQuerySpec> = {\n getTraceData,\n OptionsEditorComponent: TempoTraceQueryEditor,\n createInitialOptions: () => ({\n query: '',\n limit: 20,\n datasource: undefined,\n }),\n dependsOn: (spec) => {\n const datasourceVariables = isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource ?? '') : [];\n\n return {\n variables: [...datasourceVariables],\n };\n },\n};\n"],"names":["isVariableDatasource","parseVariables","getTraceData","TempoTraceQueryEditor","TempoTraceQuery","OptionsEditorComponent","createInitialOptions","query","limit","datasource","undefined","dependsOn","spec","datasourceVariables","variables"],"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,oBAAoB,EAAEC,cAAc,QAA0B,4BAA4B;AAEnG,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE;;CAEC,GACD,OAAO,MAAMC,kBAAyD;IACpEF;IACAG,wBAAwBF;IACxBG,sBAAsB,IAAO,CAAA;YAC3BC,OAAO;YACPC,OAAO;YACPC,YAAYC;QACd,CAAA;IACAC,WAAW,CAACC;QACV,MAAMC,sBAAsBb,qBAAqBY,KAAKH,UAAU,IAAIR,eAAeW,KAAKH,UAAU,IAAI,MAAM,EAAE;QAE9G,OAAO;YACLK,WAAW;mBAAID;aAAoB;QACrC;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/TempoTraceQuery.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 { isVariableDatasource, parseVariables, TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { TempoTraceQuerySpec } from '../../model';\nimport { getTraceData } from './get-trace-data';\nimport { TempoTraceQueryEditor } from './TempoTraceQueryEditor';\n\n/**\n * The core Tempo TraceQuery plugin for Perses.\n */\nexport const TempoTraceQuery: TraceQueryPlugin<TempoTraceQuerySpec> = {\n getTraceData,\n OptionsEditorComponent: TempoTraceQueryEditor,\n createInitialOptions: () => ({\n query: '',\n limit: 20,\n datasource: undefined,\n }),\n dependsOn: (spec) => {\n const datasourceVariables = isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource ?? '') : [];\n\n return {\n variables: [...datasourceVariables],\n };\n },\n};\n"],"names":["isVariableDatasource","parseVariables","getTraceData","TempoTraceQueryEditor","TempoTraceQuery","OptionsEditorComponent","createInitialOptions","query","limit","datasource","undefined","dependsOn","spec","datasourceVariables","variables"],"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,oBAAoB,EAAEC,cAAc,QAA0B,4BAA4B;AAEnG,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE;;CAEC,GACD,OAAO,MAAMC,kBAAyD;IACpEF;IACAG,wBAAwBF;IACxBG,sBAAsB,IAAO,CAAA;YAC3BC,OAAO;YACPC,OAAO;YACPC,YAAYC;QACd,CAAA;IACAC,WAAW,CAACC;QACV,MAAMC,sBAAsBb,qBAAqBY,KAAKH,UAAU,IAAIR,eAAeW,KAAKH,UAAU,IAAI,MAAM,EAAE;QAE9G,OAAO;YACLK,WAAW;mBAAID;aAAoB;QACrC;IACF;AACF,EAAE"}
@@ -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/plugins/tempo-trace-query/TempoTraceQueryEditor.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 { Box, Button, FormControl, InputLabel, MenuItem, Select, Stack } from '@mui/material';\nimport { useId } from '@perses-dev/components';\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n useDatasourceClient,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport { ReactElement, useCallback, useState } from 'react';\nimport {\n TempoClient,\n DEFAULT_TEMPO,\n isDefaultTempoSelector,\n isTempoDatasourceSelector,\n TEMPO_DATASOURCE_KIND,\n} from '../../model';\nimport { AttributeFilters } from '../../components/AttributeFilters';\nimport { TraceQLEditor, filterToTraceQL, traceQLToFilter } from '../../components';\nimport { TraceQueryEditorProps, useQueryState } from './query-editor-model';\n\nexport function TempoTraceQueryEditor(props: TraceQueryEditorProps): ReactElement {\n const {\n onChange,\n value,\n value: { datasource, limit },\n } = props;\n\n const datasourceSelectValue = datasource ?? DEFAULT_TEMPO;\n const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, TEMPO_DATASOURCE_KIND);\n const datasourceSelectLabelID = useId('tempo-datasource-label'); // for panels with multiple queries, this component is rendered multiple times on the same page\n\n const { data: client } = useDatasourceClient<TempoClient>(selectedDatasource);\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n const [showAttributeFilters, setShowAttributeFilters] = useState(() => isSimpleTraceQLQuery(query));\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (next) => {\n if (isTempoDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n const nextDatasource = isDefaultTempoSelector(next) ? undefined : next;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Tempo datasource selector');\n };\n\n const runQuery = (newQuery: string) => {\n onChange(\n produce(value, (draft) => {\n draft.query = newQuery;\n })\n );\n };\n\n const handleTraceQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\" fullWidth={false}>\n <DatasourceSelect\n datasourcePluginKind={TEMPO_DATASOURCE_KIND}\n value={datasourceSelectValue}\n onChange={handleDatasourceChange}\n labelId={datasourceSelectLabelID}\n label=\"Tempo Datasource\"\n notched\n />\n </FormControl>\n <Stack direction=\"row\" spacing={2} sx={{ alignItems: 'flex-start' }}>\n {showAttributeFilters ? (\n <AttributeFilters client={client} query={query} setQuery={runQuery} />\n ) : (\n <TraceQLEditor client={client} value={query} onChange={handleTraceQueryChange} onBlur={handleQueryBlur} />\n )}\n <Button onClick={() => setShowAttributeFilters(!showAttributeFilters)}>\n {showAttributeFilters ? 'Show query' : 'Hide query'}\n </Button>\n <LimitSelect\n value={limit ?? 20}\n setValue={(newLimit: number) =>\n onChange(\n produce(value, (draft) => {\n draft.limit = newLimit;\n })\n )\n }\n />\n </Stack>\n </Stack>\n );\n}\n\nfunction isSimpleTraceQLQuery(query: string) {\n // if a query can be transformed to a filter and back to the original query, we can show the attribute filter toolbar\n return query == '' || filterToTraceQL(traceQLToFilter(query)) === query;\n}\n\nconst limitOptions = [20, 50, 100, 500, 1000, 5000];\n\ninterface LimitSelectProps {\n value: number;\n setValue: (x: number) => void;\n}\n\nexport function LimitSelect(props: LimitSelectProps) {\n const { value, setValue } = props;\n\n // the outer <Box> is required, because <FormControl> has display: inline-flex, which doesn't work with the parent <Stack> of the query editor\n return (\n <Box>\n <FormControl size=\"small\">\n <InputLabel id=\"max-traces-label\">Max Traces</InputLabel>\n <Select\n labelId=\"max-traces-label\"\n id=\"max-traces-select\"\n value={value}\n label=\"Max Traces\"\n onChange={(e) => setValue(typeof e.target.value === 'number' ? e.target.value : parseInt(e.target.value))}\n sx={{ width: 110 }}\n >\n {limitOptions.map((option) => (\n <MenuItem key={option} value={option}>\n {option}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </Box>\n );\n}\n"],"names":["Box","Button","FormControl","InputLabel","MenuItem","Select","Stack","useId","DatasourceSelect","useDatasourceClient","useDatasourceSelectValueToSelector","produce","useCallback","useState","DEFAULT_TEMPO","isDefaultTempoSelector","isTempoDatasourceSelector","TEMPO_DATASOURCE_KIND","AttributeFilters","TraceQLEditor","filterToTraceQL","traceQLToFilter","useQueryState","TempoTraceQueryEditor","props","onChange","value","datasource","limit","datasourceSelectValue","selectedDatasource","datasourceSelectLabelID","data","client","query","handleQueryChange","handleQueryBlur","showAttributeFilters","setShowAttributeFilters","isSimpleTraceQLQuery","handleDatasourceChange","next","draft","nextDatasource","undefined","Error","runQuery","newQuery","handleTraceQueryChange","e","spacing","margin","fullWidth","datasourcePluginKind","labelId","label","notched","direction","sx","alignItems","setQuery","onBlur","onClick","LimitSelect","setValue","newLimit","limitOptions","size","id","target","parseInt","width","map","option"],"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,MAAM,EAAEC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,QAAQ,g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AWuB,EAAEoB,MAAM,CAAC3C,KAAK,GAAG4C,SAASrB,EAAEoB,MAAM,CAAC3C,KAAK;oBACvGgC,IAAI;wBAAEa,OAAO;oBAAI;8BAEhBL,aAAaM,GAAG,CAAC,CAACC,uBACjB,KAACrE;4BAAsBsB,OAAO+C;sCAC3BA;2BADYA;;;;;AAQ3B"}
1
+ {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/TempoTraceQueryEditor.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 { Box, Button, FormControl, InputLabel, MenuItem, Select, Stack } from '@mui/material';\nimport { useId } from '@perses-dev/components';\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n useDatasourceClient,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport { ReactElement, useCallback, useState } from 'react';\nimport {\n TempoClient,\n DEFAULT_TEMPO,\n isDefaultTempoSelector,\n isTempoDatasourceSelector,\n TEMPO_DATASOURCE_KIND,\n} from '../../model';\nimport { AttributeFilters } from '../../components/AttributeFilters';\nimport { TraceQLEditor, filterToTraceQL, traceQLToFilter } from '../../components';\nimport { TraceQueryEditorProps, useQueryState } from './query-editor-model';\n\nexport function TempoTraceQueryEditor(props: TraceQueryEditorProps): ReactElement {\n const {\n onChange,\n value,\n value: { datasource, limit },\n } = props;\n\n const datasourceSelectValue = datasource ?? DEFAULT_TEMPO;\n const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, TEMPO_DATASOURCE_KIND);\n const datasourceSelectLabelID = useId('tempo-datasource-label'); // for panels with multiple queries, this component is rendered multiple times on the same page\n\n const { data: client } = useDatasourceClient<TempoClient>(selectedDatasource);\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n const [showAttributeFilters, setShowAttributeFilters] = useState(() => isSimpleTraceQLQuery(query));\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (next) => {\n if (isTempoDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n const nextDatasource = isDefaultTempoSelector(next) ? undefined : next;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Tempo datasource selector');\n };\n\n const runQuery = (newQuery: string) => {\n onChange(\n produce(value, (draft) => {\n draft.query = newQuery;\n })\n );\n };\n\n const handleTraceQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\" fullWidth={false}>\n <DatasourceSelect\n datasourcePluginKind={TEMPO_DATASOURCE_KIND}\n value={datasourceSelectValue}\n onChange={handleDatasourceChange}\n labelId={datasourceSelectLabelID}\n label=\"Tempo Datasource\"\n notched\n />\n </FormControl>\n <Stack direction=\"row\" spacing={2} sx={{ alignItems: 'flex-start' }}>\n {showAttributeFilters ? (\n <AttributeFilters client={client} query={query} setQuery={runQuery} />\n ) : (\n <TraceQLEditor client={client} value={query} onChange={handleTraceQueryChange} onBlur={handleQueryBlur} />\n )}\n <Button onClick={() => setShowAttributeFilters(!showAttributeFilters)}>\n {showAttributeFilters ? 'Show query' : 'Hide query'}\n </Button>\n <LimitSelect\n value={limit ?? 20}\n setValue={(newLimit: number) =>\n onChange(\n produce(value, (draft) => {\n draft.limit = newLimit;\n })\n )\n }\n />\n </Stack>\n </Stack>\n );\n}\n\nfunction isSimpleTraceQLQuery(query: string) {\n // if a query can be transformed to a filter and back to the original query, we can show the attribute filter toolbar\n return query == '' || filterToTraceQL(traceQLToFilter(query)) === query;\n}\n\nconst limitOptions = [20, 50, 100, 500, 1000, 5000];\n\ninterface LimitSelectProps {\n value: number;\n setValue: (x: number) => void;\n}\n\nexport function LimitSelect(props: LimitSelectProps) {\n const { value, setValue } = props;\n\n // the outer <Box> is required, because <FormControl> has display: inline-flex, which doesn't work with the parent <Stack> of the query editor\n return (\n <Box>\n <FormControl size=\"small\">\n <InputLabel id=\"max-traces-label\">Max Traces</InputLabel>\n <Select\n labelId=\"max-traces-label\"\n id=\"max-traces-select\"\n value={value}\n label=\"Max Traces\"\n onChange={(e) => setValue(typeof e.target.value === 'number' ? e.target.value : parseInt(e.target.value))}\n sx={{ width: 110 }}\n >\n {limitOptions.map((option) => (\n <MenuItem key={option} value={option}>\n {option}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </Box>\n );\n}\n"],"names":["Box","Button","FormControl","InputLabel","MenuItem","Select","Stack","useId","DatasourceSelect","useDatasourceClient","useDatasourceSelectValueToSelector","produce","useCallback","useState","DEFAULT_TEMPO","isDefaultTempoSelector","isTempoDatasourceSelector","TEMPO_DATASOURCE_KIND","AttributeFilters","TraceQLEditor","filterToTraceQL","traceQLToFilter","useQueryState","TempoTraceQueryEditor","props","onChange","value","datasource","limit","datasourceSelectValue","selectedDatasource","datasourceSelectLabelID","data","client","query","handleQueryChange","handleQueryBlur","showAttributeFilters","setShowAttributeFilters","isSimpleTraceQLQuery","handleDatasourceChange","next","draft","nextDatasource","undefined","Error","runQuery","newQuery","handleTraceQueryChange","e","spacing","margin","fullWidth","datasourcePluginKind","labelId","label","notched","direction","sx","alignItems","setQuery","onBlur","onClick","LimitSelect","setValue","newLimit","limitOptions","size","id","target","parseInt","width","map","option"],"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,GAAG,EAAEC,MA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oBACN9B,UAAU,CAACwB,IAAMe,SAAS,OAAOf,EAAEoB,MAAM,CAAC3C,KAAK,KAAK,WAAWuB,EAAEoB,MAAM,CAAC3C,KAAK,GAAG4C,SAASrB,EAAEoB,MAAM,CAAC3C,KAAK;oBACvGgC,IAAI;wBAAEa,OAAO;oBAAI;8BAEhBL,aAAaM,GAAG,CAAC,CAACC,uBACjB,KAACrE;4BAAsBsB,OAAO+C;sCAC3BA;2BADYA;;;;;AAQ3B"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/get-trace-data.ts"],"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 { AbsoluteTimeRange, isValidTraceId, Notice, otlptracev1, TraceSearchResult } from '@perses-dev/core';\nimport { datasourceSelectValueToSelector, TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { getUnixTime } from 'date-fns';\nimport { TEMPO_DATASOURCE_KIND, TempoDatasourceSelector, TempoTraceQuerySpec } from '../../model';\nimport { DEFAULT_SEARCH_LIMIT, QueryResponse, SearchRequestParameters, SearchResponse } from '../../model/api-types';\nimport { TempoClient } from '../../model/tempo-client';\n\nexport function getUnixTimeRange(timeRange: AbsoluteTimeRange): { start: number; end: number } {\n const { start, end } = timeRange;\n return {\n start: Math.ceil(getUnixTime(start)),\n end: Math.ceil(getUnixTime(end)),\n };\n}\n\nexport const getTraceData: TraceQueryPlugin<TempoTraceQuerySpec>['getTraceData'] = async (spec, context) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n // Do not make a request to the backend, instead return an empty TraceData\n console.error('TempoTraceQuery is undefined, null, or an empty string.');\n return { searchResult: [] };\n }\n\n const defaultTempoDatasource: TempoDatasourceSelector = {\n kind: TEMPO_DATASOURCE_KIND,\n };\n\n const listDatasourceSelectItems = await context.datasourceStore.listDatasourceSelectItems(TEMPO_DATASOURCE_KIND);\n const datasourceSelector =\n datasourceSelectValueToSelector(spec.datasource, context.variableState, listDatasourceSelectItems) ??\n defaultTempoDatasource;\n\n const client = await context.datasourceStore.getDatasourceClient<TempoClient>(datasourceSelector);\n\n /**\n * determine type of query:\n * if the query is a valid traceId, fetch the trace by traceId\n * otherwise, execute a TraceQL query\n */\n if (isValidTraceId(spec.query)) {\n const response = await client.query({ traceId: spec.query });\n return {\n trace: parseTraceResponse(response),\n metadata: {\n executedQueryString: spec.query,\n },\n };\n } else {\n const params: SearchRequestParameters = {\n q: spec.query,\n };\n\n // handle time range selection from UI drop down (e.g. last 5 minutes, last 1 hour )\n if (context.absoluteTimeRange) {\n const { start, end } = getUnixTimeRange(context.absoluteTimeRange);\n params.start = start;\n params.end = end;\n }\n\n // Fetch one more trace than requested.\n // This way we can check if there are more traces available matching the search request, and show a notice to the user.\n const limit = spec.limit ?? DEFAULT_SEARCH_LIMIT;\n params.limit = limit + 1;\n\n const response = await client.searchWithFallback(params);\n const searchResult = parseSearchResponse(response);\n const hasMoreResults = searchResult.length > limit;\n\n const notices: Notice[] = [];\n if (hasMoreResults) {\n notices.push({\n type: 'info',\n message:\n 'Not all matching traces are currently displayed. Increase the result limit to view additional traces.',\n });\n\n // Remove the extra element, i.e. do not return more results than requested.\n searchResult.splice(limit);\n }\n\n return {\n searchResult,\n metadata: {\n executedQueryString: spec.query,\n hasMoreResults,\n notices,\n },\n };\n }\n};\n\nfunction parseTraceResponse(response: QueryResponse): otlptracev1.TracesData {\n const trace = {\n resourceSpans: response.batches,\n };\n\n // Tempo returns Trace ID and Span ID base64-encoded.\n // The OTLP spec defines the encoding in the hex format:\n // Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#retrieving-the-traceid-and-spanid\n // Therefore, let's convert it to hex encoding.\n for (const resourceSpan of trace.resourceSpans) {\n for (const scopeSpan of resourceSpan.scopeSpans) {\n for (const span of scopeSpan.spans) {\n if (span.traceId.length != 32) {\n span.traceId = base64ToHex(span.traceId);\n }\n if (span.spanId.length != 16) {\n span.spanId = base64ToHex(span.spanId);\n }\n if (span.parentSpanId && span.parentSpanId.length != 16) {\n span.parentSpanId = base64ToHex(span.parentSpanId);\n }\n\n for (const link of span.links ?? []) {\n if (link.traceId.length != 32) {\n link.traceId = base64ToHex(link.traceId);\n }\n if (link.spanId.length != 16) {\n link.spanId = base64ToHex(link.spanId);\n }\n }\n }\n }\n }\n\n return trace;\n}\n\nfunction base64ToHex(str: string) {\n try {\n return atob(str)\n .split('')\n .map((char) => char.charCodeAt(0).toString(16).padStart(2, '0'))\n .join('');\n } catch {\n return str;\n }\n}\n\nfunction parseSearchResponse(response: SearchResponse): TraceSearchResult[] {\n return response.traces.map((trace) => ({\n startTimeUnixMs: parseInt(trace.startTimeUnixNano) * 1e-6, // convert to millisecond for eChart time format,\n durationMs: trace.durationMs ?? 0, // Tempo API doesn't return 0 values\n traceId: trace.traceID,\n rootServiceName: trace.rootServiceName,\n rootTraceName: trace.rootTraceName,\n serviceStats: trace.serviceStats || {},\n }));\n}\n"],"names":["isValidTraceId","datasourceSelectValueToSelector","getUnixTime","TEMPO_DATASOURCE_KIND","DEFAULT_SEARCH_LIMIT","getUnixTimeRange","timeRange","start","end","Math","ceil","getTraceData","spec","context","query","undefined","console","error","searchResult","defaultTempoDatasource","kind","listDatasourceSelectItems","datasourceStore","datasourceSelector","datasource","variableState","client","getDatasourceClient","response","traceId","trace","parseTraceResponse","metadata","executedQueryString","params","q","absoluteTimeRange","limit","searchWithFallback","parseSearchResponse","hasMoreResults","length","notices","push","type","message","splice","resourceSpans","batches","resourceSpan","scopeSpan","scopeSpans","span","spans","base64ToHex","spanId","parentSpanId","link","links","str","atob","split","map","char","charCodeAt","toString","padStart","join","traces","startTimeUnixMs","parseInt","startTimeUnixNano","durationMs","traceID","rootServiceName","rootTraceName","serviceStats"],"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,SAA4BA,cAAc,QAAgD,mBAAmB;AAC7G,SAASC,+BAA+B,QAA0B,4BAA4B;AAC9F,SAASC,WAAW,QAAQ,WAAW;AACvC,SAASC,qBAAqB,QAAsD,cAAc;AAClG,SAASC,oBAAoB,QAAgE,wBAAwB;AAGrH,OAAO,SAASC,iBAAiBC,SAA4B;IAC3D,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAE,GAAGF;IACvB,OAAO;QACLC,OAAOE,KAAKC,IAAI,CAACR,YAAYK;QAC7BC,KAAKC,KAAKC,IAAI,CAACR,YAAYM;IAC7B;AACF;AAEA,OAAO,MAAMG,eAAsE,OAAOC,MAAMC;IAC9F,IAAID,KAAKE,KAAK,KAAKC,aAAaH,KAAKE,KAAK,KAAK,QAAQF,KAAKE,KAAK,KAAK,IAAI;QACxE,0EAA0E;QAC1EE,QAAQC,KAAK,CAAC;QACd,OAAO;YAAEC,cAAc,EAAE;QAAC;IAC5B;IAEA,MAAMC,yBAAkD;QACtDC,MAAMjB;IACR;IAEA,MAAMkB,4BAA4B,MAAMR,QAAQS,eAAe,CAACD,yBAAyB,CAAClB;IAC1F,MAAMoB,qBACJtB,gCAAgCW,KAAKY,UAAU,EAAEX,QAAQY,aAAa,EAAEJ,8BACxEF;IAEF,MAAMO,SAAS,MAAMb,QAAQS,eAAe,CAACK,mBAAmB,C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a;YAClCC,cAAc9C,MAAM8C,YAAY,IAAI,CAAC;QACvC,CAAA;AACF"}
1
+ {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/get-trace-data.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 { AbsoluteTimeRange, isValidTraceId, Notice, otlptracev1, TraceSearchResult } from '@perses-dev/core';\nimport { datasourceSelectValueToSelector, TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { getUnixTime } from 'date-fns';\nimport { TEMPO_DATASOURCE_KIND, TempoDatasourceSelector, TempoTraceQuerySpec } from '../../model';\nimport { DEFAULT_SEARCH_LIMIT, QueryResponse, SearchRequestParameters, SearchResponse } from '../../model/api-types';\nimport { TempoClient } from '../../model/tempo-client';\n\nexport function getUnixTimeRange(timeRange: AbsoluteTimeRange): { start: number; end: number } {\n const { start, end } = timeRange;\n return {\n start: Math.ceil(getUnixTime(start)),\n end: Math.ceil(getUnixTime(end)),\n };\n}\n\nexport const getTraceData: TraceQueryPlugin<TempoTraceQuerySpec>['getTraceData'] = async (spec, context) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n // Do not make a request to the backend, instead return an empty TraceData\n console.error('TempoTraceQuery is undefined, null, or an empty string.');\n return { searchResult: [] };\n }\n\n const defaultTempoDatasource: TempoDatasourceSelector = {\n kind: TEMPO_DATASOURCE_KIND,\n };\n\n const listDatasourceSelectItems = await context.datasourceStore.listDatasourceSelectItems(TEMPO_DATASOURCE_KIND);\n const datasourceSelector =\n datasourceSelectValueToSelector(spec.datasource, context.variableState, listDatasourceSelectItems) ??\n defaultTempoDatasource;\n\n const client = await context.datasourceStore.getDatasourceClient<TempoClient>(datasourceSelector);\n\n /**\n * determine type of query:\n * if the query is a valid traceId, fetch the trace by traceId\n * otherwise, execute a TraceQL query\n */\n if (isValidTraceId(spec.query)) {\n const response = await client.query({ traceId: spec.query });\n return {\n trace: parseTraceResponse(response),\n metadata: {\n executedQueryString: spec.query,\n },\n };\n } else {\n const params: SearchRequestParameters = {\n q: spec.query,\n };\n\n // handle time range selection from UI drop down (e.g. last 5 minutes, last 1 hour )\n if (context.absoluteTimeRange) {\n const { start, end } = getUnixTimeRange(context.absoluteTimeRange);\n params.start = start;\n params.end = end;\n }\n\n // Fetch one more trace than requested.\n // This way we can check if there are more traces available matching the search request, and show a notice to the user.\n const limit = spec.limit ?? DEFAULT_SEARCH_LIMIT;\n params.limit = limit + 1;\n\n const response = await client.searchWithFallback(params);\n const searchResult = parseSearchResponse(response);\n const hasMoreResults = searchResult.length > limit;\n\n const notices: Notice[] = [];\n if (hasMoreResults) {\n notices.push({\n type: 'info',\n message:\n 'Not all matching traces are currently displayed. Increase the result limit to view additional traces.',\n });\n\n // Remove the extra element, i.e. do not return more results than requested.\n searchResult.splice(limit);\n }\n\n return {\n searchResult,\n metadata: {\n executedQueryString: spec.query,\n hasMoreResults,\n notices,\n },\n };\n }\n};\n\nfunction parseTraceResponse(response: QueryResponse): otlptracev1.TracesData {\n const trace = {\n resourceSpans: response.batches,\n };\n\n // Tempo returns Trace ID and Span ID base64-encoded.\n // The OTLP spec defines the encoding in the hex format:\n // Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#retrieving-the-traceid-and-spanid\n // Therefore, let's convert it to hex encoding.\n for (const resourceSpan of trace.resourceSpans) {\n for (const scopeSpan of resourceSpan.scopeSpans) {\n for (const span of scopeSpan.spans) {\n if (span.traceId.length != 32) {\n span.traceId = base64ToHex(span.traceId);\n }\n if (span.spanId.length != 16) {\n span.spanId = base64ToHex(span.spanId);\n }\n if (span.parentSpanId && span.parentSpanId.length != 16) {\n span.parentSpanId = base64ToHex(span.parentSpanId);\n }\n\n for (const link of span.links ?? []) {\n if (link.traceId.length != 32) {\n link.traceId = base64ToHex(link.traceId);\n }\n if (link.spanId.length != 16) {\n link.spanId = base64ToHex(link.spanId);\n }\n }\n }\n }\n }\n\n return trace;\n}\n\nfunction base64ToHex(str: string) {\n try {\n return atob(str)\n .split('')\n .map((char) => char.charCodeAt(0).toString(16).padStart(2, '0'))\n .join('');\n } catch {\n return str;\n }\n}\n\nfunction parseSearchResponse(response: SearchResponse): TraceSearchResult[] {\n return response.traces.map((trace) => ({\n startTimeUnixMs: parseInt(trace.startTimeUnixNano) * 1e-6, // convert to millisecond for eChart time format,\n durationMs: trace.durationMs ?? 0, // Tempo API doesn't return 0 values\n traceId: trace.traceID,\n rootServiceName: trace.rootServiceName,\n rootTraceName: trace.rootTraceName,\n serviceStats: trace.serviceStats || {},\n }));\n}\n"],"names":["isValidTraceId","datasourceSelectValueToSelector","getUnixTime","TEMPO_DATASOURCE_KIND","DEFAULT_SEARCH_LIMIT","getUnixTimeRange","timeRange","start","end","Math","ceil","getTraceData","spec","context","query","undefined","console","error","searchResult","defaultTempoDatasource","kind","listDatasourceSelectItems","datasourceStore","datasourceSelector","datasource","variableState","client","getDatasourceClient","response","traceId","trace","parseTraceResponse","metadata","executedQueryString","params","q","absoluteTimeRange","limit","searchWithFallback","parseSearchResponse","hasMoreResults","length","notices","push","type","message","splice","resourceSpans","batches","resourceSpan","scopeSpan","scopeSpans","span","spans","base64ToHex","spanId","parentSpanId","link","links","str","atob","split","map","char","charCodeAt","toString","padStart","join","traces","startTimeUnixMs","parseInt","startTimeUnixNano","durationMs","traceID","rootServiceName","rootTraceName","serviceStats"],"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;AAEj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Y;gBACnD;gBAEA,KAAK,MAAMC,QAAQL,KAAKM,KAAK,IAAI,EAAE,CAAE;oBACnC,IAAID,KAAK5B,OAAO,CAACY,MAAM,IAAI,IAAI;wBAC7BgB,KAAK5B,OAAO,GAAGyB,YAAYG,KAAK5B,OAAO;oBACzC;oBACA,IAAI4B,KAAKF,MAAM,CAACd,MAAM,IAAI,IAAI;wBAC5BgB,KAAKF,MAAM,GAAGD,YAAYG,KAAKF,MAAM;oBACvC;gBACF;YACF;QACF;IACF;IAEA,OAAOzB;AACT;AAEA,SAASwB,YAAYK,GAAW;IAC9B,IAAI;QACF,OAAOC,KAAKD,KACTE,KAAK,CAAC,IACNC,GAAG,CAAC,CAACC,OAASA,KAAKC,UAAU,CAAC,GAAGC,QAAQ,CAAC,IAAIC,QAAQ,CAAC,GAAG,MAC1DC,IAAI,CAAC;IACV,EAAE,OAAM;QACN,OAAOR;IACT;AACF;AAEA,SAASpB,oBAAoBX,QAAwB;IACnD,OAAOA,SAASwC,MAAM,CAACN,GAAG,CAAC,CAAChC,QAAW,CAAA;YACrCuC,iBAAiBC,SAASxC,MAAMyC,iBAAiB,IAAI;YACrDC,YAAY1C,MAAM0C,UAAU,IAAI;YAChC3C,SAASC,MAAM2C,OAAO;YACtBC,iBAAiB5C,MAAM4C,eAAe;YACtCC,eAAe7C,MAAM6C,aAAa;YAClCC,cAAc9C,MAAM8C,YAAY,IAAI,CAAC;QACvC,CAAA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tempo-trace-query/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tempo-trace-query/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
@@ -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
  export * from './get-trace-data';
2
14
  export * from './query-editor-model';
3
15
  export * from './TempoTraceQuery';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/index.ts"],"sourcesContent":["export * from './get-trace-data';\nexport * from './query-editor-model';\nexport * from './TempoTraceQuery';\nexport * from './TempoTraceQueryEditor';\n"],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,0BAA0B"}
1
+ {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/index.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\nexport * from './get-trace-data';\nexport * from './query-editor-model';\nexport * from './TempoTraceQuery';\nexport * from './TempoTraceQueryEditor';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,0BAA0B"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/query-editor-model.ts"],"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 { useState } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { TempoTraceQuerySpec } from '../../model/trace-query-model';\n\nexport type TraceQueryEditorProps = OptionsEditorProps<TempoTraceQuerySpec>;\n\n/**\n * A hook for managing the `query` state in PrometheusTimeSeriesQuerySpec. Returns the `query` value, along with\n * `onChange` and `onBlur` event handlers to the input. Keeps a local copy of the user's input and only syncs those\n * changes with the overall spec value once the input is blurred to prevent re-running queries in the panel's preview\n * every time the user types.\n */\nexport function useQueryState(props: TraceQueryEditorProps): {\n query: string;\n handleQueryChange: (e: string) => void;\n handleQueryBlur: () => void;\n} {\n const { onChange, value } = props;\n\n // Local copy of the query's value\n const [query, setQuery] = useState(value.query);\n\n // This is basically \"getDerivedStateFromProps\" to make sure if spec's value changes external to this component,\n // we render with the latest value\n const [lastSyncedQuery, setLastSyncedQuery] = useState(value.query);\n if (value.query !== lastSyncedQuery) {\n setQuery(value.query);\n setLastSyncedQuery(value.query);\n }\n\n // Update our local state's copy as the user types\n const handleQueryChange = (e: string): void => {\n setQuery(e);\n };\n\n // Propagate changes to the query's value when the input is blurred to avoid constantly re-running queries in the\n // PanelPreview\n const handleQueryBlur = (): void => {\n setLastSyncedQuery(query);\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n return { query, handleQueryChange, handleQueryBlur };\n}\n"],"names":["useState","produce","useQueryState","props","onChange","value","query","setQuery","lastSyncedQuery","setLastSyncedQuery","handleQueryChange","e","handleQueryBlur","draft"],"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,QAAQ,QAAQ,QAAQ;AACjC,SAASC,OAAO,QAAQ,QAAQ;AAMhC;;;;;CAKC,GACD,OAAO,SAASC,cAAcC,KAA4B;IAKxD,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,kCAAkC;IAClC,MAAM,CAACG,OAAOC,SAAS,GAAGP,SAASK,MAAMC,KAAK;IAE9C,gHAAgH;IAChH,kCAAkC;IAClC,MAAM,CAACE,iBAAiBC,mBAAmB,GAAGT,SAASK,MAAMC,KAAK;IAClE,IAAID,MAAMC,KAAK,KAAKE,iBAAiB;QACnCD,SAASF,MAAMC,KAAK;QACpBG,mBAAmBJ,MAAMC,KAAK;IAChC;IAEA,kDAAkD;IAClD,MAAMI,oBAAoB,CAACC;QACzBJ,SAASI;IACX;IAEA,iHAAiH;IACjH,eAAe;IACf,MAAMC,kBAAkB;QACtBH,mBAAmBH;QACnBF,SACEH,QAAQI,OAAO,CAACQ;YACdA,MAAMP,KAAK,GAAGA;QAChB;IAEJ;IAEA,OAAO;QAAEA;QAAOI;QAAmBE;IAAgB;AACrD"}
1
+ {"version":3,"sources":["../../../../src/plugins/tempo-trace-query/query-editor-model.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 { useState } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { TempoTraceQuerySpec } from '../../model/trace-query-model';\n\nexport type TraceQueryEditorProps = OptionsEditorProps<TempoTraceQuerySpec>;\n\n/**\n * A hook for managing the `query` state in PrometheusTimeSeriesQuerySpec. Returns the `query` value, along with\n * `onChange` and `onBlur` event handlers to the input. Keeps a local copy of the user's input and only syncs those\n * changes with the overall spec value once the input is blurred to prevent re-running queries in the panel's preview\n * every time the user types.\n */\nexport function useQueryState(props: TraceQueryEditorProps): {\n query: string;\n handleQueryChange: (e: string) => void;\n handleQueryBlur: () => void;\n} {\n const { onChange, value } = props;\n\n // Local copy of the query's value\n const [query, setQuery] = useState(value.query);\n\n // This is basically \"getDerivedStateFromProps\" to make sure if spec's value changes external to this component,\n // we render with the latest value\n const [lastSyncedQuery, setLastSyncedQuery] = useState(value.query);\n if (value.query !== lastSyncedQuery) {\n setQuery(value.query);\n setLastSyncedQuery(value.query);\n }\n\n // Update our local state's copy as the user types\n const handleQueryChange = (e: string): void => {\n setQuery(e);\n };\n\n // Propagate changes to the query's value when the input is blurred to avoid constantly re-running queries in the\n // PanelPreview\n const handleQueryBlur = (): void => {\n setLastSyncedQuery(query);\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n return { query, handleQueryChange, handleQueryBlur };\n}\n"],"names":["useState","produce","useQueryState","props","onChange","value","query","setQuery","lastSyncedQuery","setLastSyncedQuery","handleQueryChange","e","handleQueryBlur","draft"],"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,QAAQ,QAAQ,QAAQ;AACjC,SAASC,OAAO,QAAQ,QAAQ;AAMhC;;;;;CAKC,GACD,OAAO,SAASC,cAAcC,KAA4B;IAKxD,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,kCAAkC;IAClC,MAAM,CAACG,OAAOC,SAAS,GAAGP,SAASK,MAAMC,KAAK;IAE9C,gHAAgH;IAChH,kCAAkC;IAClC,MAAM,CAACE,iBAAiBC,mBAAmB,GAAGT,SAASK,MAAMC,KAAK;IAClE,IAAID,MAAMC,KAAK,KAAKE,iBAAiB;QACnCD,SAASF,MAAMC,KAAK;QACpBG,mBAAmBJ,MAAMC,KAAK;IAChC;IAEA,kDAAkD;IAClD,MAAMI,oBAAoB,CAACC;QACzBJ,SAASI;IACX;IAEA,iHAAiH;IACjH,eAAe;IACf,MAAMC,kBAAkB;QACtBH,mBAAmBH;QACnBF,SACEH,QAAQI,OAAO,CAACQ;YACdA,MAAMP,KAAK,GAAGA;QAChB;IAEJ;IAEA,OAAO;QAAEA;QAAOI;QAAmBE;IAAgB;AACrD"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../src/setup-tests.ts"],"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 '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
1
+ {"version":3,"sources":["../../src/setup-tests.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 '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
package/lib/test/index.js CHANGED
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/test/index.ts"],"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\nexport * from './mock-data';\n"],"names":[],"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,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../../src/test/index.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\nexport * from './mock-data';\n"],"names":[],"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,cAAc,cAAc"}
@@ -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