@perses-dev/prometheus-plugin 0.50.2 → 0.51.0-beta.2

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 (434) hide show
  1. package/LICENSE +183 -183
  2. package/README.md +41 -0
  3. package/__mf/css/async/2341.dacad691.css +1 -0
  4. package/__mf/css/async/5263.dacad691.css +1 -0
  5. package/__mf/css/async/6759.dacad691.css +1 -0
  6. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  7. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  8. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  9. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  10. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  11. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  12. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  13. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  17. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  18. package/__mf/js/622.f7592106.js +5 -0
  19. package/__mf/js/Prometheus.328aad7c.js +5 -0
  20. package/__mf/js/async/1465.3b5e12d5.js +1 -0
  21. package/__mf/js/async/1495.6c8b8071.js +1 -0
  22. package/__mf/js/async/1620.6376bd14.js +2 -0
  23. package/__mf/js/async/1620.6376bd14.js.LICENSE.txt +9 -0
  24. package/__mf/js/async/1864.df7c4beb.js +1 -0
  25. package/__mf/js/async/1950.704c331e.js +1 -0
  26. package/__mf/js/async/1964.95da06f6.js +2 -0
  27. package/__mf/js/async/1964.95da06f6.js.LICENSE.txt +9 -0
  28. package/__mf/js/async/1996.01084c88.js +2 -0
  29. package/__mf/js/async/1996.01084c88.js.LICENSE.txt +24 -0
  30. package/__mf/js/async/212.bd5d617a.js +1 -0
  31. package/__mf/js/async/2316.fec4907a.js +1 -0
  32. package/__mf/js/async/232.f3523a60.js +1 -0
  33. package/__mf/js/async/2569.daf868a6.js +10 -0
  34. package/__mf/js/async/2569.daf868a6.js.LICENSE.txt +27 -0
  35. package/__mf/js/async/2675.c3b73822.js +1 -0
  36. package/__mf/js/async/3224.23f0dccf.js +1 -0
  37. package/__mf/js/async/3355.a4dbcdb0.js +1 -0
  38. package/__mf/js/async/3436.97c926a4.js +1 -0
  39. package/__mf/js/async/3818.dde21d04.js +1 -0
  40. package/__mf/js/async/3871.6915e369.js +1 -0
  41. package/__mf/js/async/3960.129d5ef5.js +2 -0
  42. package/__mf/js/async/3960.129d5ef5.js.LICENSE.txt +8 -0
  43. package/__mf/js/async/4075.b77ca1c7.js +1 -0
  44. package/__mf/js/async/4238.8e4d29d5.js +1 -0
  45. package/__mf/js/async/4323.4266fd6a.js +1 -0
  46. package/__mf/js/async/4421.1bcc1637.js +1 -0
  47. package/__mf/js/async/4489.3361e7bc.js +29 -0
  48. package/__mf/js/async/4489.3361e7bc.js.LICENSE.txt +59 -0
  49. package/__mf/js/async/5214.027c4332.js +1 -0
  50. package/__mf/js/async/5345.8c2e4b4a.js +1 -0
  51. package/__mf/js/async/537.6911ea2e.js +1 -0
  52. package/__mf/js/async/5387.fd6e16d6.js +1 -0
  53. package/__mf/js/async/5654.ecb41aea.js +38 -0
  54. package/__mf/js/async/5724.6ee6ec51.js +1 -0
  55. package/__mf/js/async/5774.9b0b6be1.js +1 -0
  56. package/__mf/js/async/5790.2273e061.js +1 -0
  57. package/__mf/js/async/5913.9d30fd07.js +73 -0
  58. package/__mf/js/async/5913.9d30fd07.js.LICENSE.txt +19 -0
  59. package/__mf/js/async/5914.bd342d22.js +74 -0
  60. package/__mf/js/async/5981.40bed0d0.js +2 -0
  61. package/__mf/js/async/5981.40bed0d0.js.LICENSE.txt +8 -0
  62. package/__mf/js/async/6292.7b8efa78.js +1 -0
  63. package/__mf/js/async/6333.865a46e0.js +2 -0
  64. package/__mf/js/async/6333.865a46e0.js.LICENSE.txt +9 -0
  65. package/__mf/js/async/6377.ca974d89.js +2 -0
  66. package/__mf/js/async/6377.ca974d89.js.LICENSE.txt +32 -0
  67. package/__mf/js/async/6770.adb1c939.js +1 -0
  68. package/__mf/js/async/684.ca510333.js +1 -0
  69. package/__mf/js/async/694.f861d67c.js +1 -0
  70. package/__mf/js/async/7272.a763aa92.js +1 -0
  71. package/__mf/js/async/738.aca54e25.js +1 -0
  72. package/__mf/js/async/7740.0c5363fd.js +1 -0
  73. package/__mf/js/async/8265.b9e2c31e.js +1 -0
  74. package/__mf/js/async/8488.5237550f.js +1 -0
  75. package/__mf/js/async/8587.4891ea90.js +1 -0
  76. package/__mf/js/async/8610.8300df79.js +1 -0
  77. package/__mf/js/async/87.fdc843ac.js +1 -0
  78. package/__mf/js/async/8930.9fbbc975.js +1 -0
  79. package/__mf/js/async/8997.18901f45.js +28 -0
  80. package/__mf/js/async/9173.e8fbead5.js +2 -0
  81. package/__mf/js/async/9173.e8fbead5.js.LICENSE.txt +19 -0
  82. package/__mf/js/async/__federation_expose_PrometheusDatasource.f6f57299.js +1 -0
  83. package/__mf/js/async/__federation_expose_PrometheusExplorer.5fcf955a.js +1 -0
  84. package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86d0ad5a.js +1 -0
  85. package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.b2893484.js +1 -0
  86. package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.cd16f6e8.js +1 -0
  87. package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.eb9eefa6.js +1 -0
  88. package/__mf/js/main.154a5b65.js +1 -0
  89. package/lib/bootstrap.d.ts +2 -0
  90. package/lib/bootstrap.d.ts.map +1 -0
  91. package/lib/bootstrap.js +19 -0
  92. package/lib/bootstrap.js.map +1 -0
  93. package/lib/cjs/bootstrap.js +26 -0
  94. package/{dist → lib}/cjs/components/PromQLEditor.js +9 -7
  95. package/lib/cjs/components/TreeNode.js +492 -0
  96. package/{dist → lib}/cjs/components/promql/ast.js +21 -21
  97. package/lib/cjs/components/promql/functionSignatures.js +651 -0
  98. package/lib/cjs/components/promql/serialize.js +88 -0
  99. package/{dist → lib}/cjs/components/promql/utils.js +12 -1
  100. package/{dist/cjs/components/parse.js → lib/cjs/components/query.js} +37 -4
  101. package/lib/cjs/env.d.js +14 -0
  102. package/lib/cjs/explore/PrometheusExplorer.js +203 -0
  103. package/lib/cjs/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +268 -0
  104. package/lib/cjs/explore/PrometheusMetricsFinder/display/MetricChip.js +61 -0
  105. package/lib/cjs/explore/PrometheusMetricsFinder/display/list/MetricList.js +179 -0
  106. package/lib/cjs/explore/PrometheusMetricsFinder/filter/FilterInputs.js +231 -0
  107. package/lib/cjs/explore/PrometheusMetricsFinder/filter/FinderFilters.js +97 -0
  108. package/{dist/cjs/plugins/prometheus-time-series-query → lib/cjs/explore/PrometheusMetricsFinder}/index.js +1 -1
  109. package/lib/cjs/explore/PrometheusMetricsFinder/overview/MetricOverview.js +235 -0
  110. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +144 -0
  111. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +423 -0
  112. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +53 -0
  113. package/lib/cjs/explore/PrometheusMetricsFinder/types.js +25 -0
  114. package/lib/cjs/explore/PrometheusMetricsFinder/utils.js +203 -0
  115. package/lib/cjs/explore/index.js +19 -0
  116. package/lib/cjs/getPluginModule.js +27 -0
  117. package/lib/cjs/index-federation.js +55 -0
  118. package/lib/cjs/index.js +28 -0
  119. package/{dist → lib}/cjs/model/api-types.js +1 -1
  120. package/{dist → lib}/cjs/model/prometheus-client.js +1 -1
  121. package/lib/cjs/plugins/PrometheusDatasourceEditor.js +109 -0
  122. package/lib/cjs/plugins/PrometheusLabelNamesVariable.js +34 -0
  123. package/lib/cjs/plugins/PrometheusLabelValuesVariable.js +38 -0
  124. package/lib/cjs/plugins/PrometheusPromQLVariable.js +42 -0
  125. package/lib/cjs/plugins/index.js +26 -0
  126. package/{dist → lib}/cjs/plugins/prometheus-datasource.js +9 -9
  127. package/{dist → lib}/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +11 -9
  128. package/{dist → lib}/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +51 -29
  129. package/lib/cjs/plugins/prometheus-time-series-query/index.js +35 -0
  130. package/{dist → lib}/cjs/plugins/prometheus-variables.js +25 -101
  131. package/{dist → lib}/cjs/plugins/variable.js +1 -2
  132. package/lib/cjs/setup-tests.js +19 -0
  133. package/{dist → lib}/cjs/utils/utils.js +1 -2
  134. package/lib/components/PromQLEditor.d.ts.map +1 -0
  135. package/{dist → lib}/components/PromQLEditor.js +9 -7
  136. package/lib/components/PromQLEditor.js.map +1 -0
  137. package/lib/components/TreeNode.d.ts +15 -0
  138. package/lib/components/TreeNode.d.ts.map +1 -0
  139. package/lib/components/TreeNode.js +479 -0
  140. package/lib/components/TreeNode.js.map +1 -0
  141. package/lib/components/index.d.ts.map +1 -0
  142. package/lib/components/index.js.map +1 -0
  143. package/lib/components/promql/ast.d.ts.map +1 -0
  144. package/{dist → lib}/components/promql/ast.js +21 -21
  145. package/lib/components/promql/ast.js.map +1 -0
  146. package/{dist → lib}/components/promql/format.d.ts +1 -1
  147. package/lib/components/promql/format.d.ts.map +1 -0
  148. package/lib/components/promql/format.js.map +1 -0
  149. package/lib/components/promql/functionSignatures.d.ts +3 -0
  150. package/lib/components/promql/functionSignatures.d.ts.map +1 -0
  151. package/lib/components/promql/functionSignatures.js +643 -0
  152. package/lib/components/promql/functionSignatures.js.map +1 -0
  153. package/lib/components/promql/serialize.d.ts +4 -0
  154. package/lib/components/promql/serialize.d.ts.map +1 -0
  155. package/lib/components/promql/serialize.js +80 -0
  156. package/lib/components/promql/serialize.js.map +1 -0
  157. package/{dist → lib}/components/promql/utils.d.ts +1 -0
  158. package/lib/components/promql/utils.d.ts.map +1 -0
  159. package/{dist → lib}/components/promql/utils.js +9 -1
  160. package/lib/components/promql/utils.js.map +1 -0
  161. package/lib/components/query.d.ts +6 -0
  162. package/lib/components/query.d.ts.map +1 -0
  163. package/{dist/components/parse.js → lib/components/query.js} +27 -2
  164. package/lib/components/query.js.map +1 -0
  165. package/lib/env.d.js +15 -0
  166. package/lib/env.d.js.map +1 -0
  167. package/lib/explore/PrometheusExplorer.d.ts +3 -0
  168. package/lib/explore/PrometheusExplorer.d.ts.map +1 -0
  169. package/lib/explore/PrometheusExplorer.js +190 -0
  170. package/lib/explore/PrometheusExplorer.js.map +1 -0
  171. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.d.ts +31 -0
  172. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.d.ts.map +1 -0
  173. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +244 -0
  174. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js.map +1 -0
  175. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.d.ts +4 -0
  176. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.d.ts.map +1 -0
  177. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js +53 -0
  178. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js.map +1 -0
  179. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.d.ts +27 -0
  180. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.d.ts.map +1 -0
  181. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js +158 -0
  182. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js.map +1 -0
  183. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.d.ts +23 -0
  184. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.d.ts.map +1 -0
  185. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js +209 -0
  186. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js.map +1 -0
  187. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.d.ts +13 -0
  188. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.d.ts.map +1 -0
  189. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js +84 -0
  190. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js.map +1 -0
  191. package/lib/explore/PrometheusMetricsFinder/index.d.ts +2 -0
  192. package/lib/explore/PrometheusMetricsFinder/index.d.ts.map +1 -0
  193. package/{dist/model/api-types.js → lib/explore/PrometheusMetricsFinder/index.js} +2 -2
  194. package/lib/explore/PrometheusMetricsFinder/index.js.map +1 -0
  195. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.d.ts +23 -0
  196. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.d.ts.map +1 -0
  197. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js +214 -0
  198. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js.map +1 -0
  199. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.d.ts +28 -0
  200. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.d.ts.map +1 -0
  201. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +125 -0
  202. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js.map +1 -0
  203. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.d.ts +25 -0
  204. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.d.ts.map +1 -0
  205. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +399 -0
  206. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js.map +1 -0
  207. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.d.ts +12 -0
  208. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.d.ts.map +1 -0
  209. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +45 -0
  210. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js.map +1 -0
  211. package/lib/explore/PrometheusMetricsFinder/types.d.ts +22 -0
  212. package/lib/explore/PrometheusMetricsFinder/types.d.ts.map +1 -0
  213. package/lib/explore/PrometheusMetricsFinder/types.js +17 -0
  214. package/lib/explore/PrometheusMetricsFinder/types.js.map +1 -0
  215. package/lib/explore/PrometheusMetricsFinder/utils.d.ts +22 -0
  216. package/lib/explore/PrometheusMetricsFinder/utils.d.ts.map +1 -0
  217. package/lib/explore/PrometheusMetricsFinder/utils.js +185 -0
  218. package/lib/explore/PrometheusMetricsFinder/utils.js.map +1 -0
  219. package/lib/explore/index.d.ts +3 -0
  220. package/lib/explore/index.d.ts.map +1 -0
  221. package/lib/explore/index.js +4 -0
  222. package/lib/explore/index.js.map +1 -0
  223. package/lib/getPluginModule.d.ts +6 -0
  224. package/lib/getPluginModule.d.ts.map +1 -0
  225. package/lib/getPluginModule.js +16 -0
  226. package/lib/getPluginModule.js.map +1 -0
  227. package/lib/index-federation.d.ts +1 -0
  228. package/lib/index-federation.d.ts.map +1 -0
  229. package/lib/index-federation.js +15 -0
  230. package/{dist/components/index.js.map → lib/index-federation.js.map} +1 -1
  231. package/lib/index.d.ts +6 -0
  232. package/lib/index.d.ts.map +1 -0
  233. package/lib/index.js +7 -0
  234. package/lib/index.js.map +1 -0
  235. package/{dist → lib}/model/api-types.d.ts +18 -1
  236. package/lib/model/api-types.d.ts.map +1 -0
  237. package/{dist/plugins/prometheus-time-series-query/index.js → lib/model/api-types.js} +3 -3
  238. package/lib/model/api-types.js.map +1 -0
  239. package/lib/model/index.d.ts.map +1 -0
  240. package/lib/model/index.js.map +1 -0
  241. package/lib/model/parse-sample-values.d.ts.map +1 -0
  242. package/lib/model/parse-sample-values.js.map +1 -0
  243. package/lib/model/prometheus-client.d.ts.map +1 -0
  244. package/{dist → lib}/model/prometheus-client.js +1 -1
  245. package/lib/model/prometheus-client.js.map +1 -0
  246. package/lib/model/prometheus-selectors.d.ts.map +1 -0
  247. package/lib/model/prometheus-selectors.js.map +1 -0
  248. package/lib/model/time.d.ts.map +1 -0
  249. package/lib/model/time.js.map +1 -0
  250. package/lib/plugins/MatcherEditor.d.ts.map +1 -0
  251. package/lib/plugins/MatcherEditor.js.map +1 -0
  252. package/lib/plugins/PrometheusDatasourceEditor.d.ts.map +1 -0
  253. package/lib/plugins/PrometheusDatasourceEditor.js +96 -0
  254. package/lib/plugins/PrometheusDatasourceEditor.js.map +1 -0
  255. package/lib/plugins/PrometheusLabelNamesVariable.d.ts +4 -0
  256. package/lib/plugins/PrometheusLabelNamesVariable.d.ts.map +1 -0
  257. package/lib/plugins/PrometheusLabelNamesVariable.js +26 -0
  258. package/lib/plugins/PrometheusLabelNamesVariable.js.map +1 -0
  259. package/lib/plugins/PrometheusLabelValuesVariable.d.ts +4 -0
  260. package/lib/plugins/PrometheusLabelValuesVariable.d.ts.map +1 -0
  261. package/lib/plugins/PrometheusLabelValuesVariable.js +30 -0
  262. package/lib/plugins/PrometheusLabelValuesVariable.js.map +1 -0
  263. package/lib/plugins/PrometheusPromQLVariable.d.ts +4 -0
  264. package/lib/plugins/PrometheusPromQLVariable.d.ts.map +1 -0
  265. package/lib/plugins/PrometheusPromQLVariable.js +34 -0
  266. package/lib/plugins/PrometheusPromQLVariable.js.map +1 -0
  267. package/lib/plugins/index.d.ts +10 -0
  268. package/lib/plugins/index.d.ts.map +1 -0
  269. package/lib/plugins/index.js +11 -0
  270. package/lib/plugins/index.js.map +1 -0
  271. package/lib/plugins/prometheus-datasource.d.ts.map +1 -0
  272. package/{dist → lib}/plugins/prometheus-datasource.js +9 -9
  273. package/lib/plugins/prometheus-datasource.js.map +1 -0
  274. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.d.ts.map +1 -0
  275. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +1 -0
  276. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
  277. package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +9 -7
  278. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -0
  279. package/lib/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -0
  280. package/{dist → lib}/plugins/prometheus-time-series-query/get-time-series-data.js +51 -29
  281. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -0
  282. package/lib/plugins/prometheus-time-series-query/index.d.ts +7 -0
  283. package/lib/plugins/prometheus-time-series-query/index.d.ts.map +1 -0
  284. package/lib/plugins/prometheus-time-series-query/index.js +20 -0
  285. package/lib/plugins/prometheus-time-series-query/index.js.map +1 -0
  286. package/lib/plugins/prometheus-time-series-query/query-editor-model.d.ts.map +1 -0
  287. package/lib/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -0
  288. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.d.ts.map +1 -0
  289. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js.map +1 -0
  290. package/lib/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +1 -0
  291. package/lib/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -0
  292. package/lib/plugins/prometheus-variables.d.ts +14 -0
  293. package/lib/plugins/prometheus-variables.d.ts.map +1 -0
  294. package/{dist → lib}/plugins/prometheus-variables.js +15 -98
  295. package/lib/plugins/prometheus-variables.js.map +1 -0
  296. package/lib/plugins/types.d.ts.map +1 -0
  297. package/lib/plugins/types.js.map +1 -0
  298. package/lib/plugins/variable.d.ts.map +1 -0
  299. package/{dist → lib}/plugins/variable.js +1 -2
  300. package/lib/plugins/variable.js.map +1 -0
  301. package/lib/setup-tests.d.ts +2 -0
  302. package/lib/setup-tests.d.ts.map +1 -0
  303. package/lib/setup-tests.js +17 -0
  304. package/{dist/utils/index.js.map → lib/setup-tests.js.map} +1 -1
  305. package/lib/test/setup-tests.d.ts.map +1 -0
  306. package/lib/test/setup-tests.js.map +1 -0
  307. package/lib/utils/index.d.ts.map +1 -0
  308. package/lib/utils/index.js.map +1 -0
  309. package/lib/utils/utils.d.ts.map +1 -0
  310. package/{dist → lib}/utils/utils.js +1 -2
  311. package/lib/utils/utils.js.map +1 -0
  312. package/mf-manifest.json +898 -0
  313. package/mf-stats.json +1004 -0
  314. package/package.json +99 -38
  315. package/dist/cjs/components/TreeNode.js +0 -147
  316. package/dist/cjs/index.js +0 -61
  317. package/dist/cjs/plugins/PrometheusDatasourceEditor.js +0 -626
  318. package/dist/components/PromQLEditor.d.ts.map +0 -1
  319. package/dist/components/PromQLEditor.js.map +0 -1
  320. package/dist/components/TreeNode.d.ts +0 -10
  321. package/dist/components/TreeNode.d.ts.map +0 -1
  322. package/dist/components/TreeNode.js +0 -139
  323. package/dist/components/TreeNode.js.map +0 -1
  324. package/dist/components/index.d.ts.map +0 -1
  325. package/dist/components/parse.d.ts +0 -5
  326. package/dist/components/parse.d.ts.map +0 -1
  327. package/dist/components/parse.js.map +0 -1
  328. package/dist/components/promql/ast.d.ts.map +0 -1
  329. package/dist/components/promql/ast.js.map +0 -1
  330. package/dist/components/promql/format.d.ts.map +0 -1
  331. package/dist/components/promql/format.js.map +0 -1
  332. package/dist/components/promql/utils.d.ts.map +0 -1
  333. package/dist/components/promql/utils.js.map +0 -1
  334. package/dist/index.d.ts +0 -8
  335. package/dist/index.d.ts.map +0 -1
  336. package/dist/index.js +0 -24
  337. package/dist/index.js.map +0 -1
  338. package/dist/model/api-types.d.ts.map +0 -1
  339. package/dist/model/api-types.js.map +0 -1
  340. package/dist/model/index.d.ts.map +0 -1
  341. package/dist/model/index.js.map +0 -1
  342. package/dist/model/parse-sample-values.d.ts.map +0 -1
  343. package/dist/model/parse-sample-values.js.map +0 -1
  344. package/dist/model/prometheus-client.d.ts.map +0 -1
  345. package/dist/model/prometheus-client.js.map +0 -1
  346. package/dist/model/prometheus-selectors.d.ts.map +0 -1
  347. package/dist/model/prometheus-selectors.js.map +0 -1
  348. package/dist/model/time.d.ts.map +0 -1
  349. package/dist/model/time.js.map +0 -1
  350. package/dist/plugins/MatcherEditor.d.ts.map +0 -1
  351. package/dist/plugins/MatcherEditor.js.map +0 -1
  352. package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +0 -1
  353. package/dist/plugins/PrometheusDatasourceEditor.js +0 -572
  354. package/dist/plugins/PrometheusDatasourceEditor.js.map +0 -1
  355. package/dist/plugins/prometheus-datasource.d.ts.map +0 -1
  356. package/dist/plugins/prometheus-datasource.js.map +0 -1
  357. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.d.ts.map +0 -1
  358. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +0 -1
  359. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +0 -1
  360. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +0 -1
  361. package/dist/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +0 -1
  362. package/dist/plugins/prometheus-time-series-query/get-time-series-data.js.map +0 -1
  363. package/dist/plugins/prometheus-time-series-query/index.d.ts +0 -2
  364. package/dist/plugins/prometheus-time-series-query/index.d.ts.map +0 -1
  365. package/dist/plugins/prometheus-time-series-query/index.js.map +0 -1
  366. package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts.map +0 -1
  367. package/dist/plugins/prometheus-time-series-query/query-editor-model.js.map +0 -1
  368. package/dist/plugins/prometheus-time-series-query/replace-prom-builtin-variables.d.ts.map +0 -1
  369. package/dist/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js.map +0 -1
  370. package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +0 -1
  371. package/dist/plugins/prometheus-time-series-query/time-series-query-model.js.map +0 -1
  372. package/dist/plugins/prometheus-variables.d.ts +0 -6
  373. package/dist/plugins/prometheus-variables.d.ts.map +0 -1
  374. package/dist/plugins/prometheus-variables.js.map +0 -1
  375. package/dist/plugins/types.d.ts.map +0 -1
  376. package/dist/plugins/types.js.map +0 -1
  377. package/dist/plugins/variable.d.ts.map +0 -1
  378. package/dist/plugins/variable.js.map +0 -1
  379. package/dist/test/setup-tests.d.ts.map +0 -1
  380. package/dist/test/setup-tests.js.map +0 -1
  381. package/dist/utils/index.d.ts.map +0 -1
  382. package/dist/utils/utils.d.ts.map +0 -1
  383. package/dist/utils/utils.js.map +0 -1
  384. package/plugin.json +0 -58
  385. /package/{dist → lib}/cjs/components/index.js +0 -0
  386. /package/{dist → lib}/cjs/components/promql/format.js +0 -0
  387. /package/{dist → lib}/cjs/model/index.js +0 -0
  388. /package/{dist → lib}/cjs/model/parse-sample-values.js +0 -0
  389. /package/{dist → lib}/cjs/model/prometheus-selectors.js +0 -0
  390. /package/{dist → lib}/cjs/model/time.js +0 -0
  391. /package/{dist → lib}/cjs/plugins/MatcherEditor.js +0 -0
  392. /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +0 -0
  393. /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/query-editor-model.js +0 -0
  394. /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +0 -0
  395. /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/time-series-query-model.js +0 -0
  396. /package/{dist → lib}/cjs/plugins/types.js +0 -0
  397. /package/{dist → lib}/cjs/test/setup-tests.js +0 -0
  398. /package/{dist → lib}/cjs/utils/index.js +0 -0
  399. /package/{dist → lib}/components/PromQLEditor.d.ts +0 -0
  400. /package/{dist → lib}/components/index.d.ts +0 -0
  401. /package/{dist → lib}/components/index.js +0 -0
  402. /package/{dist → lib}/components/promql/ast.d.ts +0 -0
  403. /package/{dist → lib}/components/promql/format.js +0 -0
  404. /package/{dist → lib}/model/index.d.ts +0 -0
  405. /package/{dist → lib}/model/index.js +0 -0
  406. /package/{dist → lib}/model/parse-sample-values.d.ts +0 -0
  407. /package/{dist → lib}/model/parse-sample-values.js +0 -0
  408. /package/{dist → lib}/model/prometheus-client.d.ts +0 -0
  409. /package/{dist → lib}/model/prometheus-selectors.d.ts +0 -0
  410. /package/{dist → lib}/model/prometheus-selectors.js +0 -0
  411. /package/{dist → lib}/model/time.d.ts +0 -0
  412. /package/{dist → lib}/model/time.js +0 -0
  413. /package/{dist → lib}/plugins/MatcherEditor.d.ts +0 -0
  414. /package/{dist → lib}/plugins/MatcherEditor.js +0 -0
  415. /package/{dist → lib}/plugins/PrometheusDatasourceEditor.d.ts +0 -0
  416. /package/{dist → lib}/plugins/prometheus-datasource.d.ts +0 -0
  417. /package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.d.ts +0 -0
  418. /package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +0 -0
  419. /package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts +0 -0
  420. /package/{dist → lib}/plugins/prometheus-time-series-query/get-time-series-data.d.ts +0 -0
  421. /package/{dist → lib}/plugins/prometheus-time-series-query/query-editor-model.d.ts +0 -0
  422. /package/{dist → lib}/plugins/prometheus-time-series-query/query-editor-model.js +0 -0
  423. /package/{dist → lib}/plugins/prometheus-time-series-query/replace-prom-builtin-variables.d.ts +0 -0
  424. /package/{dist → lib}/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +0 -0
  425. /package/{dist → lib}/plugins/prometheus-time-series-query/time-series-query-model.d.ts +0 -0
  426. /package/{dist → lib}/plugins/prometheus-time-series-query/time-series-query-model.js +0 -0
  427. /package/{dist → lib}/plugins/types.d.ts +0 -0
  428. /package/{dist → lib}/plugins/types.js +0 -0
  429. /package/{dist → lib}/plugins/variable.d.ts +0 -0
  430. /package/{dist → lib}/test/setup-tests.d.ts +0 -0
  431. /package/{dist → lib}/test/setup-tests.js +0 -0
  432. /package/{dist → lib}/utils/index.d.ts +0 -0
  433. /package/{dist → lib}/utils/index.js +0 -0
  434. /package/{dist → lib}/utils/utils.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/core';\nimport { ReactElement, useMemo, useState } from 'react';\nimport {\n Autocomplete,\n Button,\n Chip,\n CircularProgress,\n Divider,\n IconButton,\n MenuItem,\n Select,\n SelectChangeEvent,\n Skeleton,\n Stack,\n StackProps,\n TextField,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport CheckIcon from 'mdi-material-ui/Check';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { ErrorAlert } from '@perses-dev/components';\nimport { LabelFilter, LabelValueCounter, Operator } from '../../types';\nimport { ListboxComponent } from '../../filter/FilterInputs';\nimport { useMetricMetadata, useSeriesStates } from '../../utils';\nimport { MetricChip } from '../../display/MetricChip';\n\nexport interface LabelValuesRowProps extends StackProps {\n label: string;\n valueCounters: LabelValueCounter[];\n onFilterAdd: (filter: LabelFilter) => void;\n orderBy?: 'asc' | 'amount';\n}\n\nexport function LabelValuesRow({ label, valueCounters, onFilterAdd, ...props }: LabelValuesRowProps): ReactElement {\n const [isAddingFilter, setIsAddingFilter] = useState(false);\n const [operator, setOperator] = useState<Operator>('=');\n const [value, setValue] = useState('');\n const [showAllValues, setShowAllValues] = useState(false);\n const isMobileSize = useMediaQuery(useTheme().breakpoints.down('md'));\n\n const displayedValueCounters = useMemo(() => {\n if (showAllValues) {\n return valueCounters;\n }\n return valueCounters.slice(0, 5);\n }, [showAllValues, valueCounters]);\n\n return (\n <Stack\n key={label}\n sx={{ width: '100%' }}\n direction={isMobileSize ? 'column' : 'row'}\n alignItems=\"center\"\n gap={2}\n {...props}\n >\n <Stack\n sx={{ width: '100%', height: '100%' }}\n justifyContent=\"space-between\"\n alignContent=\"center\"\n direction={isMobileSize ? 'column' : 'row'}\n >\n <Typography sx={{ fontFamily: 'monospace' }} pl={isMobileSize ? 0 : 1}>\n {label}\n </Typography>\n <Stack direction=\"row\" gap={1} alignItems=\"center\">\n {isAddingFilter ? (\n <>\n <Select\n size=\"small\"\n value={operator}\n variant=\"outlined\"\n onChange={(event: SelectChangeEvent) => {\n setOperator(event.target.value as Operator);\n }}\n >\n <MenuItem value=\"=\">=</MenuItem>\n <MenuItem value=\"!=\">!=</MenuItem>\n <MenuItem value=\"=~\">=~</MenuItem>\n <MenuItem value=\"!~\">!~</MenuItem>\n </Select>\n <Autocomplete\n freeSolo\n limitTags={1}\n disableClearable\n options={valueCounters.map((counters) => counters.labelValue)}\n value={value}\n ListboxComponent={ListboxComponent}\n sx={{ width: 250 }}\n renderInput={(params) => {\n return <TextField {...params} label=\"Value\" variant=\"outlined\" fullWidth size=\"small\" />;\n }}\n onInputChange={(_, newValue) => {\n setValue(newValue);\n }}\n />\n <IconButton\n aria-label=\"confirm\"\n onClick={() => {\n onFilterAdd({ label, labelValues: [value], operator });\n setIsAddingFilter(false);\n }}\n >\n <CheckIcon />\n </IconButton>\n <IconButton\n aria-label=\"cancel\"\n onClick={() => {\n setIsAddingFilter(false);\n }}\n >\n <CloseIcon />\n </IconButton>\n </>\n ) : (\n <Button startIcon={<PlusIcon />} aria-label=\"add filter\" onClick={() => setIsAddingFilter(true)}>\n Add filter\n </Button>\n )}\n </Stack>\n </Stack>\n\n <Stack sx={{ width: '100%' }} gap={0.5}>\n <Stack direction=\"row\" gap={2}>\n <Typography variant=\"subtitle1\">{valueCounters.length} values</Typography>\n </Stack>\n\n <Stack sx={{ overflow: isMobileSize ? 'auto' : 'unset' }}>\n {displayedValueCounters.map((labelValueCounter) => (\n <Stack key={`${label}-${labelValueCounter.labelValue}`} direction=\"row\" gap={2}>\n <Typography\n sx={{\n color: (theme) => theme.palette.success.main,\n fontFamily: 'monospace',\n ':hover': { backgroundColor: 'rgba(127,127,127,0.35)', cursor: 'pointer' },\n textWrap: isMobileSize ? 'nowrap' : 'unset',\n }}\n onClick={() => onFilterAdd({ label, labelValues: [labelValueCounter.labelValue], operator: '=' })}\n >\n {labelValueCounter.labelValue}\n </Typography>\n <Typography sx={{ textWrap: 'nowrap' }}>({labelValueCounter.counter} series)</Typography>\n </Stack>\n ))}\n </Stack>\n <Stack width=\"100%\" textAlign={isMobileSize ? 'center' : 'unset'}>\n {showAllValues ? (\n <Button variant=\"text\" sx={{ width: 'fit-content' }} onClick={() => setShowAllValues(false)}>\n Hide full values\n </Button>\n ) : (\n <>\n {valueCounters.length > 5 && (\n <Button variant=\"text\" sx={{ width: 'fit-content' }} onClick={() => setShowAllValues(true)}>\n Show {valueCounters.length - 5} more values\n </Button>\n )}\n </>\n )}\n </Stack>\n </Stack>\n </Stack>\n );\n}\n\nexport interface LabelValuesTableProps extends StackProps {\n labelValueCounters: Map<string, LabelValueCounter[]>;\n isLoading?: boolean;\n onFilterAdd: (filter: LabelFilter) => void;\n}\n\nexport function LabelValuesTable({\n labelValueCounters,\n isLoading,\n onFilterAdd,\n ...props\n}: LabelValuesTableProps): ReactElement {\n const labels: string[] = useMemo(() => {\n return [...labelValueCounters.keys()].sort();\n }, [labelValueCounters]);\n\n if (isLoading) {\n return (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress />\n </Stack>\n );\n }\n\n return (\n <Stack sx={{ width: '100%' }} divider={<Divider flexItem orientation=\"horizontal\" />} gap={2} {...props}>\n <Stack gap={2} direction=\"row\" sx={{ width: '100%' }}>\n <Stack sx={{ width: '100%' }}>\n <Typography variant=\"h3\">Label</Typography>\n </Stack>\n <Stack sx={{ width: '100%' }}>\n <Typography variant=\"h3\">Values</Typography>\n </Stack>\n </Stack>\n {labels.map((label) => (\n <LabelValuesRow\n key={label}\n label={label}\n valueCounters={labelValueCounters.get(label) ?? []}\n onFilterAdd={onFilterAdd}\n />\n ))}\n </Stack>\n );\n}\n\nexport interface OverviewTabProps extends StackProps {\n metricName: string;\n datasource: DatasourceSelector;\n filters: LabelFilter[];\n onFilterAdd: (filter: LabelFilter) => void;\n}\n\nexport function OverviewTab({\n metricName,\n datasource,\n filters,\n onFilterAdd,\n ...props\n}: OverviewTabProps): ReactElement {\n const { metadata, isLoading: isMetadataLoading, error: metadataError } = useMetricMetadata(metricName, datasource);\n const { series, labelValueCounters, isLoading, error } = useSeriesStates(metricName, filters, datasource);\n\n return (\n <Stack gap={2} {...props}>\n <Stack direction=\"row\" gap={3} mt={1} justifyContent=\"space-between\">\n <Stack gap={1}>\n <Typography variant=\"h1\" sx={{ fontFamily: 'monospace' }}>\n {metricName}\n </Typography>\n <Typography>Description:</Typography>\n {isMetadataLoading ? (\n <Skeleton variant=\"text\" width={180} />\n ) : (\n <Typography style={{ fontStyle: metadata?.help ? 'initial' : 'italic' }}>\n {metadataError ? 'Failed to fetch metadata' : (metadata?.help ?? 'unknown')}\n </Typography>\n )}\n </Stack>\n <Stack gap={1} justifyContent=\"center\">\n {isMetadataLoading ? (\n <Skeleton variant=\"rounded\" width={75} />\n ) : metadataError ? (\n <Chip label=\"failed to fetch\" color=\"error\" sx={{ fontStyle: 'italic' }} />\n ) : (\n <MetricChip label={metadata?.type ?? 'unknown'} />\n )}\n <Typography>\n Result:{' '}\n {isLoading ? (\n <Skeleton variant=\"text\" width={20} sx={{ display: 'inline-block' }} />\n ) : error ? (\n <strong>failed to fetch series</strong>\n ) : (\n <strong>{series?.length ?? 'unknown'} series</strong>\n )}\n </Typography>\n </Stack>\n </Stack>\n\n {error ? (\n <ErrorAlert\n error={{\n name: `Failed to fetch series ${error?.status && `(${error.status})`}`,\n message: error?.message ?? 'Failed to fetch series',\n }}\n />\n ) : series?.length === 0 ? (\n <Stack {...props}>\n <Typography sx={{ color: (theme) => theme.palette.warning.main }}>\n No series found with current filters.\n </Typography>\n </Stack>\n ) : (\n <LabelValuesTable labelValueCounters={labelValueCounters} onFilterAdd={onFilterAdd} isLoading={isLoading} />\n )}\n </Stack>\n );\n}\n"],"names":["useMemo","useState","Autocomplete","Button","Chip","CircularProgress","Divider","IconButton","MenuItem","Select","Skeleton","Stack","TextField","Typography","useMediaQuery","useTheme","PlusIcon","CheckIcon","CloseIcon","ErrorAlert","ListboxComponent","useMetricMetadata","useSeriesStates","MetricChip","LabelValuesRow","label","valueCounters","onFilterAdd","props","isAddingFilter","setIsAddingFilter","operator","setOperator","value","setValue","showAllValues","setShowAllValues","isMobileSize","breakpoints","down","displayedValueCounters","slice","sx","width","direction","alignItems","gap","height","justifyContent","alignContent","fontFamily","pl","size","variant","onChange","event","target","freeSolo","limitTags","disableClearable","options","map","counters","labelValue","renderInput","params","fullWidth","onInputChange","_","newValue","aria-label","onClick","labelValues","startIcon","length","overflow","labelValueCounter","color","theme","palette","success","main","backgroundColor","cursor","textWrap","counter","textAlign","LabelValuesTable","labelValueCounters","isLoading","labels","keys","sort","divider","flexItem","orientation","get","OverviewTab","metricName","datasource","filters","metadata","isMetadataLoading","error","metadataError","series","mt","style","fontStyle","help","type","display","strong","name","status","message","warning"],"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,SAAuBA,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACxD,SAC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
3
+ import { ReactElement } from 'react';
4
+ import { LabelFilter } from '../../types';
5
+ export interface SimilarTabProps extends StackProps {
6
+ filters: LabelFilter[];
7
+ datasource: DatasourceSelector;
8
+ isMetadataEnabled?: boolean;
9
+ onExplore: (metricName: string) => void;
10
+ }
11
+ export declare function SimilarTab({ filters, datasource, isMetadataEnabled, onExplore, ...props }: SimilarTabProps): ReactElement;
12
+ //# sourceMappingURL=SimilarTab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimilarTab.d.ts","sourceRoot":"","sources":["../../../../../../src/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAA2B,UAAU,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,YAAY,CAwBhC"}
@@ -0,0 +1,45 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { CircularProgress, Stack } from '@mui/material';
15
+ import { useMemo } from 'react';
16
+ import { MetricList } from '../../display/list/MetricList';
17
+ import { useLabelValues } from '../../utils';
18
+ export function SimilarTab({ filters, datasource, isMetadataEnabled, onExplore, ...props }) {
19
+ const filtersWithoutName = useMemo(()=>{
20
+ return filters.filter((filter)=>filter.label !== '__name__');
21
+ }, [
22
+ filters
23
+ ]);
24
+ const { data, isLoading } = useLabelValues('__name__', filtersWithoutName, datasource);
25
+ if (isLoading) {
26
+ return /*#__PURE__*/ _jsx(Stack, {
27
+ width: "100%",
28
+ sx: {
29
+ alignItems: 'center',
30
+ justifyContent: 'center'
31
+ },
32
+ children: /*#__PURE__*/ _jsx(CircularProgress, {})
33
+ });
34
+ }
35
+ return /*#__PURE__*/ _jsx(MetricList, {
36
+ metricNames: data?.data ?? [],
37
+ datasource: datasource,
38
+ filters: filtersWithoutName,
39
+ isMetadataEnabled: isMetadataEnabled,
40
+ onExplore: onExplore,
41
+ ...props
42
+ });
43
+ }
44
+
45
+ //# sourceMappingURL=SimilarTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/core';\nimport { CircularProgress, Stack, StackProps } from '@mui/material';\nimport { ReactElement, useMemo } from 'react';\nimport { MetricList } from '../../display/list/MetricList';\nimport { LabelFilter } from '../../types';\nimport { useLabelValues } from '../../utils';\n\nexport interface SimilarTabProps extends StackProps {\n filters: LabelFilter[];\n datasource: DatasourceSelector;\n isMetadataEnabled?: boolean;\n onExplore: (metricName: string) => void;\n}\n\nexport function SimilarTab({\n filters,\n datasource,\n isMetadataEnabled,\n onExplore,\n ...props\n}: SimilarTabProps): ReactElement {\n const filtersWithoutName: LabelFilter[] = useMemo(() => {\n return filters.filter((filter) => filter.label !== '__name__');\n }, [filters]);\n const { data, isLoading } = useLabelValues('__name__', filtersWithoutName, datasource);\n\n if (isLoading) {\n return (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress />\n </Stack>\n );\n }\n\n return (\n <MetricList\n metricNames={data?.data ?? []}\n datasource={datasource}\n filters={filtersWithoutName}\n isMetadataEnabled={isMetadataEnabled}\n onExplore={onExplore}\n {...props}\n />\n );\n}\n"],"names":["CircularProgress","Stack","useMemo","MetricList","useLabelValues","SimilarTab","filters","datasource","isMetadataEnabled","onExplore","props","filtersWithoutName","filter","label","data","isLoading","width","sx","alignItems","justifyContent","metricNames"],"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,SAASA,gBAAgB,EAAEC,KAAK,QAAoB,gBAAgB;AACpE,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SAASC,UAAU,QAAQ,gCAAgC;AAE3D,SAASC,cAAc,QAAQ,cAAc;AAS7C,OAAO,SAASC,WAAW,EACzBC,OAAO,EACPC,UAAU,EACVC,iBAAiB,EACjBC,SAAS,EACT,GAAGC,OACa;IAChB,MAAMC,qBAAoCT,QAAQ;QAChD,OAAOI,QAAQM,MAAM,CAAC,CAACA,SAAWA,OAAOC,KAAK,KAAK;IACrD,GAAG;QAACP;KAAQ;IACZ,MAAM,EAAEQ,IAAI,EAAEC,SAAS,EAAE,GAAGX,eAAe,YAAYO,oBAAoBJ;IAE3E,IAAIQ,WAAW;QACb,qBACE,KAACd;YAAMe,OAAM;YAAOC,IAAI;gBAAEC,YAAY;gBAAUC,gBAAgB;YAAS;sBACvE,cAAA,KAACnB;;IAGP;IAEA,qBACE,KAACG;QACCiB,aAAaN,MAAMA,QAAQ,EAAE;QAC7BP,YAAYA;QACZD,SAASK;QACTH,mBAAmBA;QACnBC,WAAWA;QACV,GAAGC,KAAK;;AAGf"}
@@ -0,0 +1,22 @@
1
+ import { DatasourceSelector } from '@perses-dev/core';
2
+ export type Operator = '=' | '!=' | '=~' | '!~';
3
+ export interface Settings {
4
+ isMetadataEnabled: boolean;
5
+ isPanelEnabled: boolean;
6
+ }
7
+ export interface FinderQueryParams {
8
+ datasource?: DatasourceSelector;
9
+ filters?: LabelFilter[];
10
+ exploredMetric?: string;
11
+ }
12
+ export interface LabelFilter {
13
+ label: string;
14
+ labelValues: string[];
15
+ operator: Operator;
16
+ }
17
+ export declare function computeFilterExpr(filters: LabelFilter[]): string;
18
+ export interface LabelValueCounter {
19
+ labelValue: string;
20
+ counter: number;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/explore/PrometheusMetricsFinder/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,MAAM,QAAQ,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,MAAM,WAAW,QAAQ;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAEhE;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,17 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export function computeFilterExpr(filters) {
14
+ return `${filters.map((filter)=>`${filter.label}${filter.operator}"${filter.labelValues.join('|')}"`).join(',')}`;
15
+ }
16
+
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/explore/PrometheusMetricsFinder/types.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/core';\n\nexport type Operator = '=' | '!=' | '=~' | '!~';\n\nexport interface Settings {\n isMetadataEnabled: boolean;\n isPanelEnabled: boolean;\n}\n\nexport interface FinderQueryParams {\n datasource?: DatasourceSelector;\n filters?: LabelFilter[];\n exploredMetric?: string;\n}\n\nexport interface LabelFilter {\n label: string;\n labelValues: string[];\n operator: Operator;\n}\n\nexport function computeFilterExpr(filters: LabelFilter[]): string {\n return `${filters.map((filter) => `${filter.label}${filter.operator}\"${filter.labelValues.join('|')}\"`).join(',')}`;\n}\n\nexport interface LabelValueCounter {\n labelValue: string;\n counter: number;\n}\n"],"names":["computeFilterExpr","filters","map","filter","label","operator","labelValues","join"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuBjC,OAAO,SAASA,kBAAkBC,OAAsB;IACtD,OAAO,GAAGA,QAAQC,GAAG,CAAC,CAACC,SAAW,GAAGA,OAAOC,KAAK,GAAGD,OAAOE,QAAQ,CAAC,CAAC,EAAEF,OAAOG,WAAW,CAACC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAEA,IAAI,CAAC,MAAM;AACrH"}
@@ -0,0 +1,22 @@
1
+ import { DatasourceSelector, StatusError } from '@perses-dev/core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import { LabelValuesResponse, Metric, MetricMetadata } from '../../model';
4
+ import { LabelFilter } from './types';
5
+ export declare function useMetricMetadata(metricName: string, datasource: DatasourceSelector, enabled?: boolean): {
6
+ isLoading: false | true;
7
+ metadata: MetricMetadata | undefined;
8
+ error: StatusError | null;
9
+ };
10
+ export declare function useLabels(filters: LabelFilter[], datasource: DatasourceSelector): UseQueryResult<LabelValuesResponse, StatusError>;
11
+ export declare function useLabelValues(labelName: string, filters: LabelFilter[], datasource: DatasourceSelector): UseQueryResult<LabelValuesResponse, StatusError>;
12
+ export declare function useSeriesStates(metricName: string, filters: LabelFilter[], datasource: DatasourceSelector): {
13
+ series: Metric[] | undefined;
14
+ labelValueCounters: Map<string, Array<{
15
+ labelValue: string;
16
+ counter: number;
17
+ }>>;
18
+ isLoading: boolean;
19
+ isError: boolean;
20
+ error: StatusError | null;
21
+ };
22
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/explore/PrometheusMetricsFinder/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAGL,mBAAmB,EACnB,MAAM,EACN,cAAc,EAMf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAqB,WAAW,EAAqB,MAAM,SAAS,CAAC;AAG5E,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE,OAAO,GAChB;IACD,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IACrC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B,CA2BA;AAED,wBAAgB,SAAS,CACvB,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,EAAE,kBAAkB,GAC7B,cAAc,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAqBlD;AAGD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,EAAE,kBAAkB,GAC7B,cAAc,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAsBlD;AAID,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,EAAE,kBAAkB,GAC7B;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAChF,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B,CAoDA"}
@@ -0,0 +1,185 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { useDatasourceClient, useTimeRange } from '@perses-dev/plugin-system';
14
+ import { useQuery } from '@tanstack/react-query';
15
+ import { useMemo } from 'react';
16
+ import { computeFilterExpr } from './types';
17
+ // Retrieve metric metadata from the Prometheus API
18
+ export function useMetricMetadata(metricName, datasource, enabled) {
19
+ const { data: client } = useDatasourceClient(datasource);
20
+ // histograms and summaries timeseries desc are not always added to prefixed timeseries
21
+ const name = metricName.replace(/(_count|_sum|_bucket)$/, '');
22
+ const { data, isLoading, error } = useQuery({
23
+ enabled: !!client && enabled,
24
+ queryKey: [
25
+ 'metricMetadata',
26
+ name
27
+ ],
28
+ queryFn: async ()=>{
29
+ const params = {
30
+ metric: name
31
+ };
32
+ return await client.metricMetadata(params);
33
+ }
34
+ });
35
+ // Find the first result with help text
36
+ const metadata = useMemo(()=>{
37
+ for (const metric of data?.data?.[name] ?? []){
38
+ if (metric.help.length > 0) {
39
+ return metric;
40
+ }
41
+ }
42
+ return undefined;
43
+ }, [
44
+ data,
45
+ name
46
+ ]);
47
+ return {
48
+ metadata,
49
+ isLoading,
50
+ error
51
+ };
52
+ }
53
+ export function useLabels(filters, datasource) {
54
+ const { absoluteTimeRange: { start, end } } = useTimeRange();
55
+ const { data: client } = useDatasourceClient(datasource);
56
+ return useQuery({
57
+ enabled: !!client,
58
+ queryKey: [
59
+ 'labels',
60
+ 'datasource',
61
+ datasource.name,
62
+ 'start',
63
+ start,
64
+ 'end',
65
+ end,
66
+ 'filters',
67
+ ...filters
68
+ ],
69
+ queryFn: async ()=>{
70
+ const params = {
71
+ start: start.valueOf() / 1000,
72
+ end: end.valueOf() / 1000
73
+ };
74
+ if (filters.length) {
75
+ params['match[]'] = [
76
+ `{${computeFilterExpr(filters)}}`
77
+ ];
78
+ }
79
+ return await client.labelNames(params);
80
+ }
81
+ });
82
+ }
83
+ // Retrieve label values from the Prometheus API for a given label name and filters
84
+ export function useLabelValues(labelName, filters, datasource) {
85
+ const { absoluteTimeRange: { start, end } } = useTimeRange();
86
+ const { data: client } = useDatasourceClient(datasource);
87
+ return useQuery({
88
+ enabled: !!client,
89
+ queryKey: [
90
+ 'labelValues',
91
+ labelName,
92
+ 'datasource',
93
+ datasource.name,
94
+ 'start',
95
+ start,
96
+ 'end',
97
+ 'filters',
98
+ ...filters
99
+ ],
100
+ queryFn: async ()=>{
101
+ const params = {
102
+ labelName: labelName,
103
+ start: start.valueOf() / 1000,
104
+ end: end.valueOf() / 1000
105
+ };
106
+ if (filters.length) {
107
+ params['match[]'] = [
108
+ `{${computeFilterExpr(filters)}}`
109
+ ];
110
+ }
111
+ return await client.labelValues(params);
112
+ }
113
+ });
114
+ }
115
+ // Retrieve series from the Prometheus API for a given metric name and filters
116
+ // Also computes the number of times a label value appears for the given metric name and filters
117
+ export function useSeriesStates(metricName, filters, datasource) {
118
+ const { absoluteTimeRange: { start, end } } = useTimeRange();
119
+ const { data: client } = useDatasourceClient(datasource);
120
+ const { data: seriesData, isLoading, isError, error } = useQuery({
121
+ enabled: !!client,
122
+ queryKey: [
123
+ 'series',
124
+ metricName,
125
+ 'datasource',
126
+ datasource,
127
+ 'start',
128
+ start,
129
+ 'end',
130
+ 'filters',
131
+ ...filters
132
+ ],
133
+ queryFn: async ()=>{
134
+ const params = {
135
+ 'match[]': [
136
+ `{${computeFilterExpr(filters)}}`
137
+ ],
138
+ start: start.valueOf() / 1000,
139
+ end: end.valueOf() / 1000
140
+ };
141
+ return await client.series(params);
142
+ }
143
+ });
144
+ const labelValueCounters = useMemo(()=>{
145
+ const result = new Map();
146
+ if (seriesData?.data === undefined) {
147
+ return result;
148
+ }
149
+ for (const series of seriesData.data){
150
+ for (const [label, value] of Object.entries(series)){
151
+ const labelCounters = result.get(label);
152
+ if (labelCounters === undefined) {
153
+ result.set(label, [
154
+ {
155
+ labelValue: value,
156
+ counter: 1
157
+ }
158
+ ]);
159
+ continue;
160
+ }
161
+ const labelValueCounter = labelCounters.find((counter)=>counter.labelValue === value);
162
+ if (labelValueCounter === undefined) {
163
+ labelCounters.push({
164
+ labelValue: value,
165
+ counter: 1
166
+ });
167
+ } else {
168
+ labelValueCounter.counter += 1;
169
+ }
170
+ }
171
+ }
172
+ return result;
173
+ }, [
174
+ seriesData
175
+ ]);
176
+ return {
177
+ series: seriesData?.data,
178
+ labelValueCounters,
179
+ isLoading,
180
+ isError,
181
+ error
182
+ };
183
+ }
184
+
185
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/explore/PrometheusMetricsFinder/utils.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector, StatusError } from '@perses-dev/core';\nimport { useDatasourceClient, useTimeRange } from '@perses-dev/plugin-system';\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport {\n LabelNamesRequestParameters,\n LabelValuesRequestParameters,\n LabelValuesResponse,\n Metric,\n MetricMetadata,\n MetricMetadataRequestParameters,\n MetricMetadataResponse,\n PrometheusClient,\n SeriesRequestParameters,\n SeriesResponse,\n} from '../../model';\nimport { computeFilterExpr, LabelFilter, LabelValueCounter } from './types';\n\n// Retrieve metric metadata from the Prometheus API\nexport function useMetricMetadata(\n metricName: string,\n datasource: DatasourceSelector,\n enabled?: boolean\n): {\n isLoading: false | true;\n metadata: MetricMetadata | undefined;\n error: StatusError | null;\n} {\n const { data: client } = useDatasourceClient<PrometheusClient>(datasource);\n\n // histograms and summaries timeseries desc are not always added to prefixed timeseries\n const name = metricName.replace(/(_count|_sum|_bucket)$/, '');\n\n const { data, isLoading, error } = useQuery<MetricMetadataResponse, StatusError>({\n enabled: !!client && enabled,\n queryKey: ['metricMetadata', name], // Not indexed on datasource, assuming a metric metadata should be similar across datasources\n queryFn: async () => {\n const params: MetricMetadataRequestParameters = { metric: name };\n\n return await client!.metricMetadata(params);\n },\n });\n\n // Find the first result with help text\n const metadata: MetricMetadata | undefined = useMemo(() => {\n for (const metric of data?.data?.[name] ?? []) {\n if (metric.help.length > 0) {\n return metric;\n }\n }\n return undefined;\n }, [data, name]);\n\n return { metadata, isLoading, error };\n}\n\nexport function useLabels(\n filters: LabelFilter[],\n datasource: DatasourceSelector\n): UseQueryResult<LabelValuesResponse, StatusError> {\n const {\n absoluteTimeRange: { start, end },\n } = useTimeRange();\n const { data: client } = useDatasourceClient<PrometheusClient>(datasource);\n\n return useQuery<LabelValuesResponse, StatusError>({\n enabled: !!client,\n queryKey: ['labels', 'datasource', datasource.name, 'start', start, 'end', end, 'filters', ...filters],\n queryFn: async () => {\n const params: LabelNamesRequestParameters = {\n start: start.valueOf() / 1000,\n end: end.valueOf() / 1000,\n };\n if (filters.length) {\n params['match[]'] = [`{${computeFilterExpr(filters)}}`];\n }\n\n return await client!.labelNames(params);\n },\n });\n}\n\n// Retrieve label values from the Prometheus API for a given label name and filters\nexport function useLabelValues(\n labelName: string,\n filters: LabelFilter[],\n datasource: DatasourceSelector\n): UseQueryResult<LabelValuesResponse, StatusError> {\n const {\n absoluteTimeRange: { start, end },\n } = useTimeRange();\n const { data: client } = useDatasourceClient<PrometheusClient>(datasource);\n\n return useQuery<LabelValuesResponse, StatusError>({\n enabled: !!client,\n queryKey: ['labelValues', labelName, 'datasource', datasource.name, 'start', start, 'end', 'filters', ...filters],\n queryFn: async () => {\n const params: LabelValuesRequestParameters = {\n labelName: labelName,\n start: start.valueOf() / 1000,\n end: end.valueOf() / 1000,\n };\n if (filters.length) {\n params['match[]'] = [`{${computeFilterExpr(filters)}}`];\n }\n\n return await client!.labelValues(params);\n },\n });\n}\n\n// Retrieve series from the Prometheus API for a given metric name and filters\n// Also computes the number of times a label value appears for the given metric name and filters\nexport function useSeriesStates(\n metricName: string,\n filters: LabelFilter[],\n datasource: DatasourceSelector\n): {\n series: Metric[] | undefined;\n labelValueCounters: Map<string, Array<{ labelValue: string; counter: number }>>;\n isLoading: boolean;\n isError: boolean;\n error: StatusError | null;\n} {\n const {\n absoluteTimeRange: { start, end },\n } = useTimeRange();\n const { data: client } = useDatasourceClient<PrometheusClient>(datasource);\n\n const {\n data: seriesData,\n isLoading,\n isError,\n error,\n } = useQuery<SeriesResponse, StatusError>({\n enabled: !!client,\n queryKey: ['series', metricName, 'datasource', datasource, 'start', start, 'end', 'filters', ...filters],\n queryFn: async () => {\n const params: SeriesRequestParameters = {\n 'match[]': [`{${computeFilterExpr(filters)}}`],\n start: start.valueOf() / 1000,\n end: end.valueOf() / 1000,\n };\n\n return await client!.series(params);\n },\n });\n\n const labelValueCounters: Map<string, Array<{ labelValue: string; counter: number }>> = useMemo(() => {\n const result = new Map<string, LabelValueCounter[]>();\n if (seriesData?.data === undefined) {\n return result;\n }\n\n for (const series of seriesData.data) {\n for (const [label, value] of Object.entries(series)) {\n const labelCounters = result.get(label);\n if (labelCounters === undefined) {\n result.set(label, [{ labelValue: value, counter: 1 }]);\n continue;\n }\n\n const labelValueCounter = labelCounters.find((counter) => counter.labelValue === value);\n if (labelValueCounter === undefined) {\n labelCounters.push({ labelValue: value, counter: 1 });\n } else {\n labelValueCounter.counter += 1;\n }\n }\n }\n\n return result;\n }, [seriesData]);\n\n return { series: seriesData?.data, labelValueCounters, isLoading, isError, error };\n}\n"],"names":["useDatasourceClient","useTimeRange","useQuery","useMemo","computeFilterExpr","useMetricMetadata","metricName","datasource","enabled","data","client","name","replace","isLoading","error","queryKey","queryFn","params","metric","metricMetadata","metadata","help","length","undefined","useLabels","filters","absoluteTimeRange","start","end","valueOf","labelNames","useLabelValues","labelName","labelValues","useSeriesStates","seriesData","isError","series","labelValueCounters","result","Map","label","value","Object","entries","labelCounters","get","set","labelValue","counter","labelValueCounter","find","push"],"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,SAASA,mBAAmB,EAAEC,YAAY,QAAQ,4BAA4B;AAC9E,SAASC,QAAQ,QAAwB,wBAAwB;AACjE,SAASC,OAAO,QAAQ,QAAQ;AAahC,SAASC,iBAAiB,QAAwC,UAAU;AAE5E,mDAAmD;AACnD,OAAO,SAASC,kBACdC,UAAkB,EAClBC,UAA8B,EAC9BC,OAAiB;IAMjB,MAAM,EAAEC,MAAMC,MAAM,EAAE,GAAGV,oBAAsCO;IAE/D,uFAAuF;IACvF,MAAMI,OAAOL,WAAWM,OAAO,CAAC,0BAA0B;IAE1D,MAAM,EAAEH,IAAI,EAAEI,SAAS,EAAEC,KAAK,EAAE,GAAGZ,SAA8C;QAC/EM,SAAS,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SAASc,WAAW;YAClC,OAAOgB;QACT;QAEA,KAAK,MAAMF,UAAUF,WAAW1B,IAAI,CAAE;YACpC,KAAK,MAAM,CAACgC,OAAOC,MAAM,IAAIC,OAAOC,OAAO,CAACP,QAAS;gBACnD,MAAMQ,gBAAgBN,OAAOO,GAAG,CAACL;gBACjC,IAAII,kBAAkBtB,WAAW;oBAC/BgB,OAAOQ,GAAG,CAACN,OAAO;wBAAC;4BAAEO,YAAYN;4BAAOO,SAAS;wBAAE;qBAAE;oBACrD;gBACF;gBAEA,MAAMC,oBAAoBL,cAAcM,IAAI,CAAC,CAACF,UAAYA,QAAQD,UAAU,KAAKN;gBACjF,IAAIQ,sBAAsB3B,WAAW;oBACnCsB,cAAcO,IAAI,CAAC;wBAAEJ,YAAYN;wBAAOO,SAAS;oBAAE;gBACrD,OAAO;oBACLC,kBAAkBD,OAAO,IAAI;gBAC/B;YACF;QACF;QAEA,OAAOV;IACT,GAAG;QAACJ;KAAW;IAEf,OAAO;QAAEE,QAAQF,YAAY1B;QAAM6B;QAAoBzB;QAAWuB;QAAStB;IAAM;AACnF"}
@@ -0,0 +1,3 @@
1
+ export * from './PrometheusMetricsFinder';
2
+ export * from './PrometheusExplorer';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/explore/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './PrometheusMetricsFinder';
2
+ export * from './PrometheusExplorer';
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/explore/index.ts"],"sourcesContent":["export * from './PrometheusMetricsFinder';\nexport * from './PrometheusExplorer';\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB"}
@@ -0,0 +1,6 @@
1
+ import { PluginModuleResource } from '@perses-dev/plugin-system';
2
+ /**
3
+ * Returns the plugin module information from package.json
4
+ */
5
+ export declare function getPluginModule(): PluginModuleResource;
6
+ //# sourceMappingURL=getPluginModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
@@ -0,0 +1,16 @@
1
+ import packageJson from '../package.json';
2
+ /**
3
+ * Returns the plugin module information from package.json
4
+ */ export function getPluginModule() {
5
+ const { name, version, perses } = packageJson;
6
+ return {
7
+ kind: 'PluginModule',
8
+ metadata: {
9
+ name,
10
+ version
11
+ },
12
+ spec: perses
13
+ };
14
+ }
15
+
16
+ //# sourceMappingURL=getPluginModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getPluginModule.ts"],"sourcesContent":["import { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\nimport packageJson from '../package.json';\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","getPluginModule","name","version","perses","kind","metadata","spec"],"mappings":"AACA,OAAOA,iBAAiB,kBAAkB;AAE1C;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAClC,OAAO;QACLK,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index-federation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-federation.d.ts","sourceRoot":"","sources":["../../src/index-federation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import('./bootstrap');
14
+
15
+ //# sourceMappingURL=index-federation.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 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 './PromQLEditor';\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"}
1
+ {"version":3,"sources":["../../src/index-federation.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport('./bootstrap');\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,MAAM,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from './components';
2
+ export * from './explore';
3
+ export { getPluginModule } from './getPluginModule';
4
+ export * from './model';
5
+ export * from './plugins';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from './components';
2
+ export * from './explore';
3
+ export { getPluginModule } from './getPluginModule';
4
+ export * from './model';
5
+ export * from './plugins';
6
+
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './components';\nexport * from './explore';\nexport { getPluginModule } from './getPluginModule';\nexport * from './model';\nexport * from './plugins';\n"],"names":["getPluginModule"],"mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,UAAU;AACxB,cAAc,YAAY"}
@@ -17,12 +17,20 @@ export type ApiResponse<T> = SuccessResponse<T> | ErrorResponse<T>;
17
17
  export type DurationSeconds = number;
18
18
  export type UnixTimestampSeconds = number;
19
19
  export type ValueTuple = [unixTimeSeconds: UnixTimestampSeconds, sampleValue: string];
20
+ export type BucketTuple = [bucket: number, upperBound: string, lowerBound: string, count: string];
21
+ export type HistogramValue = {
22
+ count: number;
23
+ sum: string;
24
+ buckets?: BucketTuple[];
25
+ };
26
+ export type HistogramTuple = [unixTimeSeconds: UnixTimestampSeconds, value: HistogramValue];
20
27
  export type Metric = Record<string, string>;
21
28
  export interface VectorData {
22
29
  resultType: 'vector';
23
30
  result: Array<{
24
31
  metric: Metric;
25
32
  value: ValueTuple;
33
+ histogram?: HistogramTuple;
26
34
  }>;
27
35
  }
28
36
  export interface MatrixData {
@@ -30,18 +38,27 @@ export interface MatrixData {
30
38
  result: Array<{
31
39
  metric: Metric;
32
40
  values: ValueTuple[];
41
+ histograms?: HistogramTuple[];
33
42
  }>;
34
43
  }
35
44
  export interface ScalarData {
36
45
  resultType: 'scalar';
37
46
  result: ValueTuple;
38
47
  }
48
+ export interface StringData {
49
+ resultType: 'string';
50
+ result: ValueTuple;
51
+ }
39
52
  export interface InstantQueryRequestParameters {
40
53
  query: string;
41
54
  time?: UnixTimestampSeconds;
42
55
  timeout?: DurationString;
43
56
  }
44
- export type InstantQueryResponse = ApiResponse<MatrixData | VectorData | ScalarData>;
57
+ export type InstantQueryResultType = MatrixData | VectorData | ScalarData | StringData;
58
+ export type InstantQueryResponse = ApiResponse<InstantQueryResultType>;
59
+ export type MonitoredInstantQueryResponse = InstantQueryResponse & {
60
+ responseTime: number;
61
+ };
45
62
  export interface RangeQueryRequestParameters {
46
63
  query: string;
47
64
  start: UnixTimestampSeconds;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../../src/model/api-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAG/C,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,CAAC,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,CAAC,CAAC;AAEnD,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,GAAG,CAAC,EAAE,oBAAoB,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;AAEvD,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,GAAG,CAAC,EAAE,oBAAoB,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,+BAA+B;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;AAGnF,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 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
@@ -10,6 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './PrometheusTimeSeriesQuery';
13
+ export { };
14
14
 
15
- //# sourceMappingURL=index.js.map
15
+ //# sourceMappingURL=api-types.js.map
@@ -0,0 +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 { DurationString } from '@perses-dev/core';\nimport ASTNode from '../components/promql/ast';\n\n// Just reuse dashboard model's type and re-export\nexport type { DurationString };\n\nexport interface SuccessResponse<T> {\n status: 'success';\n data: T;\n rawResponse?: Response;\n warnings?: string[];\n}\n\nexport interface ErrorResponse<T> {\n status: 'error';\n data?: T;\n errorType: string;\n error: string;\n}\n\nexport type ApiResponse<T> = SuccessResponse<T> | ErrorResponse<T>;\n\nexport type DurationSeconds = number;\n\nexport type UnixTimestampSeconds = number;\n\nexport type ValueTuple = [unixTimeSeconds: UnixTimestampSeconds, sampleValue: string];\n\nexport type BucketTuple = [bucket: number, upperBound: string, lowerBound: string, count: string];\n\nexport type HistogramValue = { count: number; sum: string; buckets?: BucketTuple[] };\n\nexport type HistogramTuple = [unixTimeSeconds: UnixTimestampSeconds, value: HistogramValue];\n\nexport type Metric = Record<string, string>;\n\nexport interface VectorData {\n resultType: 'vector';\n result: Array<{\n metric: Metric;\n value: ValueTuple;\n histogram?: HistogramTuple;\n }>;\n}\n\nexport interface MatrixData {\n resultType: 'matrix';\n result: Array<{\n metric: Metric;\n values: ValueTuple[];\n histograms?: HistogramTuple[];\n }>;\n}\n\nexport interface ScalarData {\n resultType: 'scalar';\n result: ValueTuple;\n}\n\nexport interface StringData {\n resultType: 'string';\n result: ValueTuple;\n}\n\nexport interface InstantQueryRequestParameters {\n query: string;\n time?: UnixTimestampSeconds;\n timeout?: DurationString;\n}\n\nexport type InstantQueryResultType = MatrixData | VectorData | ScalarData | StringData;\n\n// Ref https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries\nexport type InstantQueryResponse = ApiResponse<InstantQueryResultType>;\n\nexport type MonitoredInstantQueryResponse = InstantQueryResponse & {\n responseTime: number;\n};\n\nexport interface RangeQueryRequestParameters {\n query: string;\n start: UnixTimestampSeconds;\n end: UnixTimestampSeconds;\n step: DurationSeconds;\n timeout?: DurationString;\n}\n\nexport type RangeQueryResponse = ApiResponse<MatrixData>;\n\nexport interface SeriesRequestParameters {\n 'match[]': string[];\n start?: UnixTimestampSeconds;\n end?: UnixTimestampSeconds;\n limit?: number;\n}\n\nexport type SeriesResponse = ApiResponse<Metric[]>;\n\nexport interface LabelNamesRequestParameters {\n start?: UnixTimestampSeconds;\n end?: UnixTimestampSeconds;\n 'match[]'?: string[];\n limit?: number;\n}\n\nexport type LabelNamesResponse = ApiResponse<string[]>;\n\nexport interface LabelValuesRequestParameters {\n labelName: string;\n start?: UnixTimestampSeconds;\n end?: UnixTimestampSeconds;\n 'match[]'?: string[];\n limit?: number;\n}\n\nexport type LabelValuesResponse = ApiResponse<string[]>;\n\nexport interface MetricMetadata {\n type: string;\n help: string;\n unit?: string;\n}\n\nexport interface MetricMetadataRequestParameters {\n limit?: number;\n metric?: string;\n}\n\nexport type MetricMetadataResponse = ApiResponse<Record<string, MetricMetadata[]>>;\n\n// ref: https://prometheus.io/docs/prometheus/3.0/querying/api/#parsing-a-promql-expressions-into-a-abstract-syntax-tree-ast\nexport interface ParseQueryRequestParameters {\n query: string;\n}\n\nexport type ParseQueryResponse = ApiResponse<ASTNode>;\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;AAyIjC,WAAsD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 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 './api-types';\nexport * from './parse-sample-values';\nexport * from './prometheus-client';\nexport * from './prometheus-selectors';\nexport * from './time';\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;AAC5B,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,yBAAyB;AACvC,cAAc,SAAS"}