@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
@@ -1,4 +1,4 @@
1
- // Copyright 2024 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
@@ -24,16 +24,13 @@ export const getTimeSeriesData = async (spec, context)=>{
24
24
  series: []
25
25
  };
26
26
  }
27
- var _spec_datasource;
28
- const datasource = await context.datasourceStore.getDatasource((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : DEFAULT_PROM);
29
- var _datasource_plugin_spec_scrapeInterval;
30
- const datasourceScrapeInterval = Math.trunc(milliseconds(parseDurationString((_datasource_plugin_spec_scrapeInterval = datasource.plugin.spec.scrapeInterval) !== null && _datasource_plugin_spec_scrapeInterval !== void 0 ? _datasource_plugin_spec_scrapeInterval : DEFAULT_SCRAPE_INTERVAL)) / 1000);
31
- var _getDurationStringSeconds;
27
+ const datasource = await context.datasourceStore.getDatasource(spec.datasource ?? DEFAULT_PROM);
28
+ const datasourceScrapeInterval = Math.trunc(milliseconds(parseDurationString(datasource.plugin.spec.scrapeInterval ?? DEFAULT_SCRAPE_INTERVAL)) / 1000);
32
29
  // Min step is the lower bound of the interval between data points
33
30
  // If no value is provided for it, it should default to the scrape interval of the datasource
34
- const minStep = (_getDurationStringSeconds = getDurationStringSeconds(// resolve any variable that may have been provided
31
+ const minStep = getDurationStringSeconds(// resolve any variable that may have been provided
35
32
  // TODO add a validation check to make sure the variable is a DurationString, to avoid the back & forth cast here
36
- replaceVariables(spec.minStep, context.variableState))) !== null && _getDurationStringSeconds !== void 0 ? _getDurationStringSeconds : datasourceScrapeInterval;
33
+ replaceVariables(spec.minStep, context.variableState)) ?? datasourceScrapeInterval;
37
34
  const timeRange = getPrometheusTimeRange(context.timeRange);
38
35
  const step = getRangeStep(timeRange, minStep, undefined, context.suggestedStepMs); // TODO: resolution
39
36
  // Align the time range so that it's a multiple of the step
@@ -53,9 +50,8 @@ export const getTimeSeriesData = async (spec, context)=>{
53
50
  if (seriesNameFormat) {
54
51
  seriesNameFormat = replaceVariables(seriesNameFormat, context.variableState);
55
52
  }
56
- var _spec_datasource1;
57
53
  // Get the datasource, using the default Prom Datasource if one isn't specified in the query
58
- const client = await context.datasourceStore.getDatasourceClient((_spec_datasource1 = spec.datasource) !== null && _spec_datasource1 !== void 0 ? _spec_datasource1 : DEFAULT_PROM);
54
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_PROM);
59
55
  // Make the request to Prom
60
56
  let response;
61
57
  switch(context.mode){
@@ -80,10 +76,8 @@ export const getTimeSeriesData = async (spec, context)=>{
80
76
  // Custom display for response header warnings, configurable error responses display coming next
81
77
  const notices = [];
82
78
  if (response.status === 'success') {
83
- var _response_warnings;
84
- const warnings = (_response_warnings = response.warnings) !== null && _response_warnings !== void 0 ? _response_warnings : [];
85
- var _warnings_;
86
- const warningMessage = (_warnings_ = warnings[0]) !== null && _warnings_ !== void 0 ? _warnings_ : '';
79
+ const warnings = response.warnings ?? [];
80
+ const warningMessage = warnings[0] ?? '';
87
81
  if (warningMessage !== '') {
88
82
  notices.push({
89
83
  type: 'warning',
@@ -99,7 +93,7 @@ export const getTimeSeriesData = async (spec, context)=>{
99
93
  end: fromUnixTime(end)
100
94
  },
101
95
  stepMs: step * 1000,
102
- series: buildTimeSeries(result, query, seriesNameFormat),
96
+ series: buildTimeSeries(query, result, seriesNameFormat),
103
97
  metadata: {
104
98
  notices,
105
99
  executedQueryString: query
@@ -107,35 +101,63 @@ export const getTimeSeriesData = async (spec, context)=>{
107
101
  };
108
102
  return chartData;
109
103
  };
110
- function buildVectorData(data, query, seriesNameFormat) {
104
+ function buildVectorData(query, data, seriesNameFormat) {
111
105
  return data.result.map((res)=>{
112
- const { metric, value } = res;
106
+ const { metric, value, histogram } = res;
113
107
  // Account for seriesNameFormat from query editor when determining name to show in legend, tooltip, etc.
114
108
  const { name, formattedName } = getFormattedPrometheusSeriesName(query, metric, seriesNameFormat);
109
+ if (histogram) {
110
+ return {
111
+ name,
112
+ formattedName,
113
+ labels: metric,
114
+ values: [
115
+ parseValueTuple([
116
+ histogram[0],
117
+ histogram[1].sum
118
+ ])
119
+ ],
120
+ histograms: [
121
+ histogram
122
+ ]
123
+ };
124
+ }
115
125
  return {
116
126
  name,
127
+ formattedName,
128
+ labels: metric,
117
129
  values: [
118
130
  parseValueTuple(value)
119
- ],
120
- formattedName,
121
- labels: metric
131
+ ]
122
132
  };
123
133
  });
124
134
  }
125
- function buildMatrixData(data, query, seriesNameFormat) {
135
+ function buildMatrixData(query, data, seriesNameFormat) {
126
136
  return data.result.map((res)=>{
127
- const { metric, values } = res;
137
+ const { metric, values, histograms } = res;
128
138
  // Account for seriesNameFormat from query editor when determining name to show in legend, tooltip, etc.
129
139
  const { name, formattedName } = getFormattedPrometheusSeriesName(query, metric, seriesNameFormat);
140
+ if (histograms) {
141
+ return {
142
+ name,
143
+ formattedName,
144
+ labels: metric,
145
+ values: histograms.map((histogram)=>parseValueTuple([
146
+ histogram[0],
147
+ histogram[1].sum
148
+ ])),
149
+ histograms: histograms.map((histogram)=>histogram)
150
+ };
151
+ }
130
152
  return {
131
153
  name,
132
- values: values.map(parseValueTuple),
133
154
  formattedName,
134
- labels: metric
155
+ labels: metric,
156
+ values: values.map(parseValueTuple)
135
157
  };
136
158
  });
137
159
  }
138
- function buildScalarData(data, query, seriesNameFormat) {
160
+ function buildScalarData(query, data, seriesNameFormat) {
139
161
  const { name, formattedName } = getFormattedPrometheusSeriesName(query, {}, seriesNameFormat);
140
162
  return [
141
163
  {
@@ -147,18 +169,18 @@ function buildScalarData(data, query, seriesNameFormat) {
147
169
  }
148
170
  ];
149
171
  }
150
- function buildTimeSeries(data, query, seriesNameFormat) {
172
+ function buildTimeSeries(query, data, seriesNameFormat) {
151
173
  if (!data) {
152
174
  return [];
153
175
  }
154
176
  const resultType = data.resultType;
155
177
  switch(resultType){
156
178
  case 'vector':
157
- return buildVectorData(data, query, seriesNameFormat);
179
+ return buildVectorData(query, data, seriesNameFormat);
158
180
  case 'matrix':
159
- return buildMatrixData(data, query, seriesNameFormat);
181
+ return buildMatrixData(query, data, seriesNameFormat);
160
182
  case 'scalar':
161
- return buildScalarData(data, query, seriesNameFormat);
183
+ return buildScalarData(query, data, seriesNameFormat);
162
184
  default:
163
185
  console.warn('Unknown result type', resultType, data);
164
186
  return [];
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/get-time-series-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 {\n DatasourceSpec,\n DurationString,\n Notice,\n parseDurationString,\n TimeSeries,\n TimeSeriesData,\n} from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { fromUnixTime, milliseconds } from 'date-fns';\nimport {\n parseValueTuple,\n PrometheusClient,\n getDurationStringSeconds,\n getPrometheusTimeRange,\n getRangeStep,\n DEFAULT_PROM,\n MatrixData,\n VectorData,\n ScalarData,\n InstantQueryResultType,\n} from '../../model';\nimport { getFormattedPrometheusSeriesName } from '../../utils';\nimport { DEFAULT_SCRAPE_INTERVAL, PrometheusDatasourceSpec } from '../types';\nimport { PrometheusTimeSeriesQuerySpec } from './time-series-query-model';\nimport { replacePromBuiltinVariables } from './replace-prom-builtin-variables';\n\nexport const getTimeSeriesData: TimeSeriesQueryPlugin<PrometheusTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n // Do not make a request to the backend, instead return an empty TimeSeriesData\n return { series: [] };\n }\n\n const datasource = (await context.datasourceStore.getDatasource(\n spec.datasource ?? DEFAULT_PROM\n )) as DatasourceSpec<PrometheusDatasourceSpec>;\n const datasourceScrapeInterval = Math.trunc(\n milliseconds(parseDurationString(datasource.plugin.spec.scrapeInterval ?? DEFAULT_SCRAPE_INTERVAL)) / 1000\n );\n\n // Min step is the lower bound of the interval between data points\n // If no value is provided for it, it should default to the scrape interval of the datasource\n const minStep =\n getDurationStringSeconds(\n // resolve any variable that may have been provided\n // TODO add a validation check to make sure the variable is a DurationString, to avoid the back & forth cast here\n replaceVariables(spec.minStep as string, context.variableState) as DurationString\n ) ?? datasourceScrapeInterval;\n const timeRange = getPrometheusTimeRange(context.timeRange);\n const step = getRangeStep(timeRange, minStep, undefined, context.suggestedStepMs); // TODO: resolution\n\n // Align the time range so that it's a multiple of the step\n let { start, end } = timeRange;\n const utcOffsetSec = new Date().getTimezoneOffset() * 60;\n\n const alignedEnd = Math.floor((end + utcOffsetSec) / step) * step - utcOffsetSec;\n const alignedStart = Math.floor((start + utcOffsetSec) / step) * step - utcOffsetSec;\n start = alignedStart;\n end = alignedEnd;\n\n // Replace variable placeholders in PromQL query\n const intervalMs = step * 1000;\n const minStepMs = minStep * 1000;\n let query = replacePromBuiltinVariables(spec.query, minStepMs, intervalMs);\n query = replaceVariables(query, context.variableState);\n\n let seriesNameFormat = spec.seriesNameFormat;\n // if series name format is defined, replace variable placeholders in series name format\n if (seriesNameFormat) {\n seriesNameFormat = replaceVariables(seriesNameFormat, context.variableState);\n }\n\n // Get the datasource, using the default Prom Datasource if one isn't specified in the query\n const client: PrometheusClient = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_PROM);\n\n // Make the request to Prom\n let response;\n switch (context.mode) {\n case 'instant':\n response = await client.instantQuery({\n query,\n time: end,\n });\n break;\n case 'range':\n default:\n response = await client.rangeQuery({\n query,\n start,\n end,\n step,\n });\n break;\n }\n\n // TODO: What about error responses from Prom that have a response body?\n const result = response.data;\n\n // Custom display for response header warnings, configurable error responses display coming next\n const notices: Notice[] = [];\n if (response.status === 'success') {\n const warnings = response.warnings ?? [];\n const warningMessage = warnings[0] ?? '';\n if (warningMessage !== '') {\n notices.push({\n type: 'warning',\n message: warningMessage,\n });\n }\n }\n\n // Transform response\n const chartData: TimeSeriesData = {\n // Return the time range and step we actually used for the query\n timeRange: { start: fromUnixTime(start), end: fromUnixTime(end) },\n stepMs: step * 1000,\n\n series: buildTimeSeries(query, result, seriesNameFormat),\n metadata: {\n notices,\n executedQueryString: query,\n },\n };\n\n return chartData;\n};\n\nfunction buildVectorData(query: string, data: VectorData, seriesNameFormat: string | undefined): TimeSeries[] {\n return data.result.map((res) => {\n const { metric, value, histogram } = res;\n\n // Account for seriesNameFormat from query editor when determining name to show in legend, tooltip, etc.\n const { name, formattedName } = getFormattedPrometheusSeriesName(query, metric, seriesNameFormat);\n\n if (histogram) {\n return {\n name,\n formattedName,\n labels: metric,\n values: [parseValueTuple([histogram[0], histogram[1].sum])],\n histograms: [histogram],\n };\n }\n\n return {\n name,\n formattedName,\n labels: metric,\n values: [parseValueTuple(value)],\n };\n });\n}\n\nfunction buildMatrixData(query: string, data: MatrixData, seriesNameFormat: string | undefined): TimeSeries[] {\n return data.result.map((res) => {\n const { metric, values, histograms } = res;\n\n // Account for seriesNameFormat from query editor when determining name to show in legend, tooltip, etc.\n const { name, formattedName } = getFormattedPrometheusSeriesName(query, metric, seriesNameFormat);\n\n if (histograms) {\n return {\n name,\n formattedName,\n labels: metric,\n values: histograms.map((histogram) => parseValueTuple([histogram[0], histogram[1].sum])),\n histograms: histograms.map((histogram) => histogram),\n };\n }\n\n return {\n name,\n formattedName,\n labels: metric,\n values: values.map(parseValueTuple),\n };\n });\n}\n\nfunction buildScalarData(query: string, data: ScalarData, seriesNameFormat: string | undefined): TimeSeries[] {\n const { name, formattedName } = getFormattedPrometheusSeriesName(query, {}, seriesNameFormat);\n return [\n {\n name,\n values: [parseValueTuple(data.result)],\n formattedName,\n },\n ];\n}\n\nfunction buildTimeSeries(query: string, data?: InstantQueryResultType, seriesNameFormat?: string): TimeSeries[] {\n if (!data) {\n return [];\n }\n\n const resultType = data.resultType;\n switch (resultType) {\n case 'vector':\n return buildVectorData(query, data, seriesNameFormat);\n case 'matrix':\n return buildMatrixData(query, data, seriesNameFormat);\n case 'scalar':\n return buildScalarData(query, data, seriesNameFormat);\n default:\n console.warn('Unknown result type', resultType, data);\n return [];\n }\n}\n"],"names":["parseDurationString","replaceVariables","fromUnixTime","milliseconds","parseValueTuple","getDurationStringSeconds","getPrometheusTimeRange","getRangeStep","DEFAULT_PROM","getFormattedPrometheusSeriesName","DEFAULT_SCRAPE_INTERVAL","replacePromBuiltinVariables","getTimeSeriesData","spec","context","query","undefined","series","datasource","datasourceStore","getDatasource","datasourceScrapeInterval","Math","trunc","plugin","scrapeInterval","minStep","variableState","timeRange","step","suggestedStepMs","start","end","utcOffsetSec","Date","getTimezoneOffset","alignedEnd","floor","alignedStart","intervalMs","minStepMs","seriesNameFormat","client","getDatasourceClient","response","mode","instantQuery","time","rangeQuery","result","data","notices","status","warnings","warningMessage","push","type","message","chartData","stepMs","buildTimeSeries","metadata","executedQueryString","buildVectorData","map","res","metric","value","histogram","name","formattedName","labels","values","sum","histograms","buildMatrixData","buildScalarData","resultType","console","warn"],"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,SAIEA,mBAAmB,QAGd,mBAAmB;AAC1B,SAAgCC,gBAAgB,QAAQ,4BAA4B;AACpF,SAASC,YAAY,EAAEC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M,EAAE4B,IAAI,EAAEC,aAAa,EAAE,GAAG7D,iCAAiCM,OAAO,CAAC,GAAG0B;IAC5E,OAAO;QACL;YACE4B;YACAG,QAAQ;gBAACpE,gBAAgB8C,KAAKD,MAAM;aAAE;YACtCqB;QACF;KACD;AACH;AAEA,SAASV,gBAAgB7C,KAAa,EAAEmC,IAA6B,EAAET,gBAAyB;IAC9F,IAAI,CAACS,MAAM;QACT,OAAO,EAAE;IACX;IAEA,MAAM2B,aAAa3B,KAAK2B,UAAU;IAClC,OAAQA;QACN,KAAK;YACH,OAAOd,gBAAgBhD,OAAOmC,MAAMT;QACtC,KAAK;YACH,OAAOkC,gBAAgB5D,OAAOmC,MAAMT;QACtC,KAAK;YACH,OAAOmC,gBAAgB7D,OAAOmC,MAAMT;QACtC;YACEqC,QAAQC,IAAI,CAAC,uBAAuBF,YAAY3B;YAChD,OAAO,EAAE;IACb;AACF"}
@@ -0,0 +1,7 @@
1
+ export * from './PrometheusTimeSeriesQuery';
2
+ export * from './PrometheusTimeSeriesQueryEditor';
3
+ export * from './get-time-series-data';
4
+ export * from './replace-prom-builtin-variables';
5
+ export * from './query-editor-model';
6
+ export * from './time-series-query-model';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/prometheus-time-series-query/index.ts"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,20 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './PrometheusTimeSeriesQuery';
14
+ export * from './PrometheusTimeSeriesQueryEditor';
15
+ export * from './get-time-series-data';
16
+ export * from './replace-prom-builtin-variables';
17
+ export * from './query-editor-model';
18
+ export * from './time-series-query-model';
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/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 './PrometheusTimeSeriesQuery';\nexport * from './PrometheusTimeSeriesQueryEditor';\nexport * from './get-time-series-data';\nexport * from './replace-prom-builtin-variables';\nexport * from './query-editor-model';\nexport * from './time-series-query-model';\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,8BAA8B;AAC5C,cAAc,oCAAoC;AAClD,cAAc,yBAAyB;AACvC,cAAc,mCAAmC;AACjD,cAAc,uBAAuB;AACrC,cAAc,4BAA4B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-editor-model.d.ts","sourceRoot":"","sources":["../../../../src/plugins/prometheus-time-series-query/query-editor-model.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE1E,MAAM,MAAM,oCAAoC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;AAErG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,oCAAoC,GAAG;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CA+BA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,oCAAoC,GAAG;IAC3E,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,kBAAkB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CA2BA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oCAAoC,GAAG;IAC5E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,mBAAmB,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IACjD,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B,CA2BA"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/query-editor-model.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\nimport { useState } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { DurationString } from '@perses-dev/core';\nimport { PrometheusTimeSeriesQuerySpec } from './time-series-query-model';\n\nexport type PrometheusTimeSeriesQueryEditorProps = OptionsEditorProps<PrometheusTimeSeriesQuerySpec>;\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: PrometheusTimeSeriesQueryEditorProps): {\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\n/**\n * Hook to manage `seriesNameFormat` state to ensure panel preview does not rerender until text input is blurred\n */\nexport function useFormatState(props: PrometheusTimeSeriesQueryEditorProps): {\n format: string | undefined;\n handleFormatChange: (e: string) => void;\n handleFormatBlur: () => void;\n} {\n const { onChange, value } = props;\n\n // TODO: reusable hook or helper util instead of duplicating from useQueryState\n const [format, setFormat] = useState(value.seriesNameFormat);\n const [lastSyncedFormat, setLastSyncedFormat] = useState(value.seriesNameFormat);\n if (value.seriesNameFormat !== lastSyncedFormat) {\n setFormat(value.seriesNameFormat);\n setLastSyncedFormat(value.seriesNameFormat);\n }\n\n // Update our local state as the user types\n const handleFormatChange = (e: string): void => {\n setFormat(e);\n };\n\n // Propagate changes to the panel preview component when seriesNameFormat TextField is blurred\n const handleFormatBlur = (): void => {\n setLastSyncedFormat(format);\n onChange(\n produce(value, (draft) => {\n draft.seriesNameFormat = format;\n })\n );\n };\n\n return { format, handleFormatChange, handleFormatBlur };\n}\n\n/**\n * Hook to manage `minStep` state to ensure panel preview does not rerender until text input is blurred\n */\nexport function useMinStepState(props: PrometheusTimeSeriesQueryEditorProps): {\n minStep: string | undefined;\n handleMinStepChange: (e: DurationString) => void;\n handleMinStepBlur: () => void;\n} {\n const { onChange, value } = props;\n\n // TODO: reusable hook or helper util instead of duplicating from useQueryState\n const [minStep, setMinStep] = useState(value.minStep);\n const [lastSyncedMinStep, setLastSyncedMinStep] = useState(value.minStep);\n if (value.minStep !== lastSyncedMinStep) {\n setMinStep(value.minStep);\n setLastSyncedMinStep(value.minStep);\n }\n\n // Update our local state as the user types\n const handleMinStepChange = (e: DurationString): void => {\n setMinStep(e);\n };\n\n // Propagate changes to the panel preview component when minStep TextField is blurred\n const handleMinStepBlur = (): void => {\n setLastSyncedMinStep(minStep);\n onChange(\n produce(value, (draft) => {\n draft.minStep = minStep;\n })\n );\n };\n\n return { minStep, handleMinStepChange, handleMinStepBlur };\n}\n"],"names":["useState","produce","useQueryState","props","onChange","value","query","setQuery","lastSyncedQuery","setLastSyncedQuery","handleQueryChange","e","handleQueryBlur","draft","useFormatState","format","setFormat","seriesNameFormat","lastSyncedFormat","setLastSyncedFormat","handleFormatChange","handleFormatBlur","useMinStepState","minStep","setMinStep","lastSyncedMinStep","setLastSyncedMinStep","handleMinStepChange","handleMinStepBlur"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE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SACEH,QAAQI,OAAO,CAACQ;YACdA,MAAMI,gBAAgB,GAAGF;QAC3B;IAEJ;IAEA,OAAO;QAAEA;QAAQK;QAAoBC;IAAiB;AACxD;AAEA;;CAEC,GACD,OAAO,SAASC,gBAAgBnB,KAA2C;IAKzE,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,+EAA+E;IAC/E,MAAM,CAACoB,SAASC,WAAW,GAAGxB,SAASK,MAAMkB,OAAO;IACpD,MAAM,CAACE,mBAAmBC,qBAAqB,GAAG1B,SAASK,MAAMkB,OAAO;IACxE,IAAIlB,MAAMkB,OAAO,KAAKE,mBAAmB;QACvCD,WAAWnB,MAAMkB,OAAO;QACxBG,qBAAqBrB,MAAMkB,OAAO;IACpC;IAEA,2CAA2C;IAC3C,MAAMI,sBAAsB,CAAChB;QAC3Ba,WAAWb;IACb;IAEA,qFAAqF;IACrF,MAAMiB,oBAAoB;QACxBF,qBAAqBH;QACrBnB,SACEH,QAAQI,OAAO,CAACQ;YACdA,MAAMU,OAAO,GAAGA;QAClB;IAEJ;IAEA,OAAO;QAAEA;QAASI;QAAqBC;IAAkB;AAC3D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-prom-builtin-variables.d.ts","sourceRoot":"","sources":["../../../../src/plugins/prometheus-time-series-query/replace-prom-builtin-variables.ts"],"names":[],"mappings":"AAyBA,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAcxG"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/replace-prom-builtin-variables.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 { replaceVariable } from '@perses-dev/plugin-system';\nimport { formatDuration, msToPrometheusDuration } from '@perses-dev/core';\n\n/*\n * Replace variable placeholders in a PromQL query\n\n * @param query The base promQL expression that contains variable placeholders\n * @param minStepMs the lower bound of the interval between data points, in milliseconds\n * @param intervalMs the actual interval between data points, in milliseconds\n * \n * @returns a PromQL expression with variable placeholders replaced by their values\n */\nexport function replacePromBuiltinVariables(query: string, minStepMs: number, intervalMs: number): string {\n let updatedQuery = replaceVariable(query, '__interval_ms', intervalMs.toString());\n updatedQuery = replaceVariable(updatedQuery, '__interval', formatDuration(msToPrometheusDuration(intervalMs)));\n\n // The $__rate_interval variable is meant to be used with the rate() promQL function.\n // It is defined as max($__interval + Min step, 4 * Min step)\n const rateIntervalMs = Math.max(intervalMs + minStepMs, 4 * minStepMs);\n updatedQuery = replaceVariable(\n updatedQuery,\n '__rate_interval',\n formatDuration(msToPrometheusDuration(rateIntervalMs))\n );\n\n return updatedQuery;\n}\n"],"names":["replaceVariable","formatDuration","msToPrometheusDuration","replacePromBuiltinVariables","query","minStepMs","intervalMs","updatedQuery","toString","rateIntervalMs","Math","max"],"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,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,mBAAmB;AAE1E;;;;;;;;CAQC,GACD,OAAO,SAASC,4BAA4BC,KAAa,EAAEC,SAAiB,EAAEC,UAAkB;IAC9F,IAAIC,eAAeP,gBAAgBI,OAAO,iBAAiBE,WAAWE,QAAQ;IAC9ED,eAAeP,gBAAgBO,cAAc,cAAcN,eAAeC,uBAAuBI;IAEjG,qFAAqF;IACrF,6DAA6D;IAC7D,MAAMG,iBAAiBC,KAAKC,GAAG,CAACL,aAAaD,WAAW,IAAIA;IAC5DE,eAAeP,gBACbO,cACA,mBACAN,eAAeC,uBAAuBO;IAGxC,OAAOF;AACT"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-series-query-model.d.ts","sourceRoot":"","sources":["../../../../src/plugins/prometheus-time-series-query/time-series-query-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/time-series-query-model.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\nimport { DurationString } from '@perses-dev/core';\nimport { PrometheusDatasourceSelector } from '../../model';\n\n/**\n * The spec/options for the PrometheusTimeSeriesQuery plugin.\n */\nexport interface PrometheusTimeSeriesQuerySpec {\n query: string;\n seriesNameFormat?: string;\n minStep?: DurationString;\n resolution?: number;\n datasource?: PrometheusDatasourceSelector;\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;AAKjC;;CAEC,GACD,WAMC"}
@@ -0,0 +1,14 @@
1
+ import { OptionsEditorProps, VariableOption } from '@perses-dev/plugin-system';
2
+ import { ReactElement } from 'react';
3
+ import { MatrixData, VectorData } from '../model';
4
+ import { PrometheusLabelNamesVariableOptions, PrometheusLabelValuesVariableOptions, PrometheusPromQLVariableOptions } from './types';
5
+ export declare function PrometheusLabelValuesVariableEditor(props: OptionsEditorProps<PrometheusLabelValuesVariableOptions>): ReactElement;
6
+ export declare function PrometheusLabelNamesVariableEditor(props: OptionsEditorProps<PrometheusLabelNamesVariableOptions>): ReactElement;
7
+ export declare function PrometheusPromQLVariableEditor(props: OptionsEditorProps<PrometheusPromQLVariableOptions>): ReactElement;
8
+ export declare function capturingMatrix(matrix: MatrixData, labelName: string): string[];
9
+ export declare function capturingVector(vector: VectorData, labelName: string): string[];
10
+ /**
11
+ * Takes a list of strings and returns a list of VariableOptions
12
+ */
13
+ export declare const stringArrayToVariableOptions: (values?: string[]) => VariableOption[];
14
+ //# sourceMappingURL=prometheus-variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prometheus-variables.d.ts","sourceRoot":"","sources":["../../../src/plugins/prometheus-variables.tsx"],"names":[],"mappings":"AAaA,OAAO,EAGL,kBAAkB,EAElB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAIL,UAAU,EAGV,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,mCAAmC,EACnC,oCAAoC,EACpC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,kBAAkB,CAAC,oCAAoC,CAAC,GAC9D,YAAY,CAoDd;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,kBAAkB,CAAC,mCAAmC,CAAC,GAC7D,YAAY,CAyCd;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,kBAAkB,CAAC,+BAA+B,CAAC,GACzD,YAAY,CAyDd;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/E;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,MAAM,EAAE,KAAG,cAAc,EAM9E,CAAC"}
@@ -11,16 +11,16 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { DatasourceSelect, useDatasourceClient, parseVariables, replaceVariables } from '@perses-dev/plugin-system';
15
14
  import { FormControl, InputLabel, Stack, TextField } from '@mui/material';
15
+ import { DatasourceSelect, useDatasourceClient } from '@perses-dev/plugin-system';
16
16
  import { produce } from 'immer';
17
- import { DEFAULT_PROM, getPrometheusTimeRange, isDefaultPromSelector, isPrometheusDatasourceSelector, PROM_DATASOURCE_KIND } from '../model';
18
17
  import { PromQLEditor } from '../components';
18
+ import { DEFAULT_PROM, isDefaultPromSelector, isPrometheusDatasourceSelector, PROM_DATASOURCE_KIND } from '../model';
19
19
  import { MatcherEditor } from './MatcherEditor';
20
- function PrometheusLabelValuesVariableEditor(props) {
20
+ export function PrometheusLabelValuesVariableEditor(props) {
21
21
  const { onChange, value } = props;
22
22
  const { datasource } = value;
23
- const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : DEFAULT_PROM;
23
+ const selectedDatasource = datasource ?? DEFAULT_PROM;
24
24
  const handleDatasourceChange = (next)=>{
25
25
  if (isPrometheusDatasourceSelector(next)) {
26
26
  onChange(produce(value, (draft)=>{
@@ -31,7 +31,6 @@ function PrometheusLabelValuesVariableEditor(props) {
31
31
  }
32
32
  throw new Error('Got unexpected non-Prometheus datasource selector');
33
33
  };
34
- var _props_value_matchers;
35
34
  return /*#__PURE__*/ _jsxs(Stack, {
36
35
  spacing: 2,
37
36
  children: [
@@ -67,7 +66,7 @@ function PrometheusLabelValuesVariableEditor(props) {
67
66
  }
68
67
  }),
69
68
  /*#__PURE__*/ _jsx(MatcherEditor, {
70
- matchers: (_props_value_matchers = props.value.matchers) !== null && _props_value_matchers !== void 0 ? _props_value_matchers : [],
69
+ matchers: props.value.matchers ?? [],
71
70
  onChange: (e)=>{
72
71
  props.onChange({
73
72
  ...props.value,
@@ -79,10 +78,10 @@ function PrometheusLabelValuesVariableEditor(props) {
79
78
  ]
80
79
  });
81
80
  }
82
- function PrometheusLabelNamesVariableEditor(props) {
81
+ export function PrometheusLabelNamesVariableEditor(props) {
83
82
  const { onChange, value } = props;
84
83
  const { datasource } = value;
85
- const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : DEFAULT_PROM;
84
+ const selectedDatasource = datasource ?? DEFAULT_PROM;
86
85
  const handleDatasourceChange = (next)=>{
87
86
  if (isPrometheusDatasourceSelector(next)) {
88
87
  onChange(produce(value, (draft)=>{
@@ -93,7 +92,6 @@ function PrometheusLabelNamesVariableEditor(props) {
93
92
  }
94
93
  throw new Error('Got unexpected non-Prometheus datasource selector');
95
94
  };
96
- var _props_value_matchers;
97
95
  return /*#__PURE__*/ _jsxs(Stack, {
98
96
  spacing: 2,
99
97
  children: [
@@ -115,7 +113,7 @@ function PrometheusLabelNamesVariableEditor(props) {
115
113
  ]
116
114
  }),
117
115
  /*#__PURE__*/ _jsx(MatcherEditor, {
118
- matchers: (_props_value_matchers = props.value.matchers) !== null && _props_value_matchers !== void 0 ? _props_value_matchers : [],
116
+ matchers: props.value.matchers ?? [],
119
117
  isReadonly: props.isReadonly,
120
118
  onChange: (e)=>{
121
119
  props.onChange({
@@ -127,12 +125,12 @@ function PrometheusLabelNamesVariableEditor(props) {
127
125
  ]
128
126
  });
129
127
  }
130
- function PrometheusPromQLVariableEditor(props) {
128
+ export function PrometheusPromQLVariableEditor(props) {
131
129
  const { onChange, value } = props;
132
130
  const { datasource } = value;
133
- const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : DEFAULT_PROM;
131
+ const selectedDatasource = datasource ?? DEFAULT_PROM;
134
132
  const { data: client } = useDatasourceClient(selectedDatasource);
135
- const promURL = client === null || client === void 0 ? void 0 : client.options.datasourceUrl;
133
+ const promURL = client?.options.datasourceUrl;
136
134
  const handleDatasourceChange = (next)=>{
137
135
  if (isPrometheusDatasourceSelector(next)) {
138
136
  onChange(produce(value, (draft)=>{
@@ -172,10 +170,9 @@ function PrometheusPromQLVariableEditor(props) {
172
170
  value: value.expr,
173
171
  datasource: selectedDatasource,
174
172
  onBlur: (event)=>{
175
- var _event_target_textContent;
176
173
  props.onChange({
177
174
  ...props.value,
178
- expr: (_event_target_textContent = event.target.textContent) !== null && _event_target_textContent !== void 0 ? _event_target_textContent : ''
175
+ expr: event.target.textContent ?? ''
179
176
  });
180
177
  },
181
178
  readOnly: props.isReadonly,
@@ -197,7 +194,7 @@ function PrometheusPromQLVariableEditor(props) {
197
194
  ]
198
195
  });
199
196
  }
200
- function capturingMatrix(matrix, labelName) {
197
+ export function capturingMatrix(matrix, labelName) {
201
198
  const captured = new Set();
202
199
  for (const sample of matrix.result){
203
200
  const value = sample.metric[labelName];
@@ -207,7 +204,7 @@ function capturingMatrix(matrix, labelName) {
207
204
  }
208
205
  return Array.from(captured.values());
209
206
  }
210
- function capturingVector(vector, labelName) {
207
+ export function capturingVector(vector, labelName) {
211
208
  const captured = new Set();
212
209
  for (const sample of vector.result){
213
210
  const value = sample.metric[labelName];
@@ -219,92 +216,12 @@ function capturingVector(vector, labelName) {
219
216
  }
220
217
  /**
221
218
  * Takes a list of strings and returns a list of VariableOptions
222
- */ const stringArrayToVariableOptions = (values)=>{
219
+ */ export const stringArrayToVariableOptions = (values)=>{
223
220
  if (!values) return [];
224
221
  return values.map((value)=>({
225
222
  value,
226
223
  label: value
227
224
  }));
228
225
  };
229
- export const PrometheusLabelNamesVariable = {
230
- getVariableOptions: async (spec, ctx)=>{
231
- var _spec_datasource;
232
- const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : DEFAULT_PROM);
233
- const match = spec.matchers ? spec.matchers.map((m)=>replaceVariables(m, ctx.variables)) : undefined;
234
- const timeRange = getPrometheusTimeRange(ctx.timeRange);
235
- const { data: options } = await client.labelNames({
236
- 'match[]': match,
237
- ...timeRange
238
- });
239
- return {
240
- data: stringArrayToVariableOptions(options)
241
- };
242
- },
243
- dependsOn: (spec)=>{
244
- var _spec_matchers;
245
- return {
246
- variables: ((_spec_matchers = spec.matchers) === null || _spec_matchers === void 0 ? void 0 : _spec_matchers.map((m)=>parseVariables(m)).flat()) || []
247
- };
248
- },
249
- OptionsEditorComponent: PrometheusLabelNamesVariableEditor,
250
- createInitialOptions: ()=>({})
251
- };
252
- export const PrometheusLabelValuesVariable = {
253
- getVariableOptions: async (spec, ctx)=>{
254
- const pluginDef = spec;
255
- var _spec_datasource;
256
- const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : DEFAULT_PROM);
257
- const match = pluginDef.matchers ? pluginDef.matchers.map((m)=>replaceVariables(m, ctx.variables)) : undefined;
258
- const timeRange = getPrometheusTimeRange(ctx.timeRange);
259
- const { data: options } = await client.labelValues({
260
- labelName: replaceVariables(pluginDef.labelName, ctx.variables),
261
- 'match[]': match,
262
- ...timeRange
263
- });
264
- return {
265
- data: stringArrayToVariableOptions(options)
266
- };
267
- },
268
- dependsOn: (spec)=>{
269
- var _spec_matchers;
270
- return {
271
- variables: ((_spec_matchers = spec.matchers) === null || _spec_matchers === void 0 ? void 0 : _spec_matchers.map((m)=>parseVariables(m)).flat().concat(parseVariables(spec.labelName))) || []
272
- };
273
- },
274
- OptionsEditorComponent: PrometheusLabelValuesVariableEditor,
275
- createInitialOptions: ()=>({
276
- labelName: ''
277
- })
278
- };
279
- export const PrometheusPromQLVariable = {
280
- getVariableOptions: async (spec, ctx)=>{
281
- var _spec_datasource;
282
- const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : DEFAULT_PROM);
283
- // TODO we may want to manage a range query as well.
284
- const { data: options } = await client.instantQuery({
285
- query: replaceVariables(spec.expr, ctx.variables)
286
- });
287
- const labelName = replaceVariables(spec.labelName, ctx.variables);
288
- let values = [];
289
- if ((options === null || options === void 0 ? void 0 : options.resultType) === 'matrix') {
290
- values = capturingMatrix(options, labelName);
291
- } else if ((options === null || options === void 0 ? void 0 : options.resultType) === 'vector') {
292
- values = capturingVector(options, labelName);
293
- }
294
- return {
295
- data: stringArrayToVariableOptions(values)
296
- };
297
- },
298
- dependsOn: (spec)=>{
299
- return {
300
- variables: parseVariables(spec.expr).concat(parseVariables(spec.labelName))
301
- };
302
- },
303
- OptionsEditorComponent: PrometheusPromQLVariableEditor,
304
- createInitialOptions: ()=>({
305
- expr: '',
306
- labelName: ''
307
- })
308
- };
309
226
 
310
227
  //# sourceMappingURL=prometheus-variables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/plugins/prometheus-variables.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.\nimport { FormControl, InputLabel, Stack, TextField } from '@mui/material';\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n OptionsEditorProps,\n useDatasourceClient,\n VariableOption,\n} from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport { ReactElement } from 'react';\nimport { PromQLEditor } from '../components';\nimport {\n DEFAULT_PROM,\n isDefaultPromSelector,\n isPrometheusDatasourceSelector,\n MatrixData,\n PROM_DATASOURCE_KIND,\n PrometheusClient,\n VectorData,\n} from '../model';\nimport { MatcherEditor } from './MatcherEditor';\nimport {\n PrometheusLabelNamesVariableOptions,\n PrometheusLabelValuesVariableOptions,\n PrometheusPromQLVariableOptions,\n} from './types';\n\nexport function PrometheusLabelValuesVariableEditor(\n props: OptionsEditorProps<PrometheusLabelValuesVariableOptions>\n): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (next) => {\n if (isPrometheusDatasourceSelector(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 draft.datasource = isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n };\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <InputLabel id=\"prom-datasource-label\">Prometheus Datasource</InputLabel>\n <DatasourceSelect\n datasourcePluginKind=\"PrometheusDatasource\"\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n readOnly={props.isReadonly}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n <TextField\n label=\"Label Name\"\n required\n value={props.value.labelName}\n onChange={(e) => {\n props.onChange({ ...props.value, labelName: e.target.value });\n }}\n InputProps={{\n readOnly: props.isReadonly,\n }}\n />\n <MatcherEditor\n matchers={props.value.matchers ?? []}\n onChange={(e) => {\n props.onChange({ ...props.value, matchers: e });\n }}\n isReadonly={props.isReadonly}\n />\n </Stack>\n );\n}\n\nexport function PrometheusLabelNamesVariableEditor(\n props: OptionsEditorProps<PrometheusLabelNamesVariableOptions>\n): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (next) => {\n if (isPrometheusDatasourceSelector(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 draft.datasource = isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n };\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <InputLabel id=\"prom-datasource-label\">Prometheus Datasource</InputLabel>\n <DatasourceSelect\n datasourcePluginKind=\"PrometheusDatasource\"\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n disabled={props.isReadonly}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n <MatcherEditor\n matchers={props.value.matchers ?? []}\n isReadonly={props.isReadonly}\n onChange={(e) => {\n props.onChange({ ...props.value, matchers: e });\n }}\n />\n </Stack>\n );\n}\n\nexport function PrometheusPromQLVariableEditor(\n props: OptionsEditorProps<PrometheusPromQLVariableOptions>\n): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n\n const { data: client } = useDatasourceClient<PrometheusClient>(selectedDatasource);\n const promURL = client?.options.datasourceUrl;\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (next) => {\n if (isPrometheusDatasourceSelector(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 draft.datasource = isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n };\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <InputLabel id=\"prom-datasource-label\">Prometheus Datasource</InputLabel>\n <DatasourceSelect\n datasourcePluginKind={PROM_DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n disabled={props.isReadonly}\n />\n </FormControl>\n <PromQLEditor\n completeConfig={{ remote: { url: promURL } }}\n value={value.expr}\n datasource={selectedDatasource}\n onBlur={(event) => {\n props.onChange({ ...props.value, expr: event.target.textContent ?? '' });\n }}\n readOnly={props.isReadonly}\n width=\"100%\"\n />\n <TextField\n label=\"Label Name\"\n value={props.value.labelName}\n InputProps={{\n readOnly: props.isReadonly,\n }}\n onChange={(e) => {\n props.onChange({ ...props.value, labelName: e.target.value });\n }}\n />\n </Stack>\n );\n}\n\nexport function capturingMatrix(matrix: MatrixData, labelName: string): string[] {\n const captured = new Set<string>();\n for (const sample of matrix.result) {\n const value = sample.metric[labelName];\n if (value !== undefined) {\n captured.add(value);\n }\n }\n return Array.from(captured.values());\n}\n\nexport function capturingVector(vector: VectorData, labelName: string): string[] {\n const captured = new Set<string>();\n for (const sample of vector.result) {\n const value = sample.metric[labelName];\n if (value !== undefined) {\n captured.add(value);\n }\n }\n return Array.from(captured.values());\n}\n\n/**\n * Takes a list of strings and returns a list of VariableOptions\n */\nexport const stringArrayToVariableOptions = (values?: string[]): VariableOption[] => {\n if (!values) return [];\n return values.map((value) => ({\n value,\n label: value,\n }));\n};\n"],"names":["FormControl","InputLabel","Stack","TextField","DatasourceSelect","useDatasourceClient","produce","PromQLEditor","DEFAULT_PROM","isDefaultPromSelector","isPrometheusDatasourceSelector","PROM_DATASOURCE_KIND","MatcherEditor","PrometheusLabelValuesVariableEditor","props","onChange","value","datasource","selectedDatasource","handleDatasourceChange","next","draft","undefined","Error","spacing","margin","id","datasourcePluginKind","readOnly","isReadonly","labelId","label","required","labelName","e","target","InputProps","matchers","PrometheusLabelNamesVariableEditor","disabled","PrometheusPromQLVariableEditor","data","client","promURL","options","datasourceUrl","completeConfig","remote","url","expr","onBlur","event","textContent","width","capturingMatrix","matrix","captured","Set","sample","result","metric","add","Array","from","values","capturingVector","vector","stringArrayToVariableOptions","map"],"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;;AACjC,SAASA,WAAW,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,QAAQ,gBAAgB;AAC1E,SACEC,gBAAgB,EAGhBC,mBAAmB,QAEd,4BAA4B;AACnC,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SACEC,YAAY,EACZC,qBAAqB,EACrBC,8BAA8B,EAE9BC,oBAAoB,QAGf,WAAW;AAClB,SAASC,aAAa,QAAQ,kBAAkB;AAOhD,OAAO,SAASC,oCACdC,KAA+D;IAE/D,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,qBAAqBD,cAAcT;IAEzC,MAAMW,yBAA4D,CAACC;QACjE,IAAIV,+BAA+BU,OAAO;YACxCL,SACET,QAAQU,OAAO,CAACK;gBACd,sFAAsF;gBACtFA,MAAMJ,UAAU,GAAGR,sBAAsBW,QAAQE,YAAYF;YAC/D;YAEF;QACF;QAEA,MAAM,IAAIG,MAAM;IAClB;IAEA,qBACE,MAACrB;QAAMsB,SAAS;;0BACd,MAACxB;gBAAYyB,QAAO;;kCAClB,KAACxB;wBAAWyB,IAAG;kCAAwB;;kCACvC,KAACtB;wBACCuB,sBAAqB;wBACrBX,OAAOE;wBACPH,UAAUI;wBACVS,UAAUd,MAAMe,UAAU;wBAC1BC,SAAQ;wBACRC,OAAM;;;;0BAGV,KAAC5B;gBACC4B,OAAM;gBACNC,QAAQ;gBACRhB,OAAOF,MAAME,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6B;IAC5C,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C;AAED,MAAM,MAAM,mCAAmC,GAAG,6BAA6B,GAAG;IAChF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,6BAA6B,GAAG;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,6BAA6B,GAAG;IAE5E,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/plugins/types.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\nimport { DurationString, HTTPProxy } from '@perses-dev/core';\nimport { PrometheusDatasourceSelector } from '../model';\n\nexport const DEFAULT_SCRAPE_INTERVAL: DurationString = '1m';\n\nexport interface PrometheusDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n scrapeInterval?: DurationString; // default to 1m\n}\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: PrometheusDatasourceSelector;\n}\n\nexport type PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase & {\n matchers?: string[];\n};\n\nexport type PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {\n labelName: string;\n matchers?: string[];\n};\n\nexport type PrometheusPromQLVariableOptions = PrometheusVariableOptionsBase & {\n // expr is the PromQL expression.\n expr: string;\n // labelName is the name of the label that will be used after the PromQL query is performed to select the label value.\n // Note: This field is not part of the Prometheus API.\n labelName: string;\n};\n"],"names":["DEFAULT_SCRAPE_INTERVAL"],"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;AAKjC,OAAO,MAAMA,0BAA0C,KAAK"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../../src/plugins/variable.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,2BAA2B,CAAC;AAI/F,KAAK,gBAAgB,GAAG,MAAM,GAAG,cAAc,CAAC;AAEhD,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAmDF,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,yBAAyB,CAiBxE,CAAC"}
@@ -59,8 +59,7 @@ function StaticListVariableOptionEditor(props) {
59
59
  }
60
60
  export const StaticListVariable = {
61
61
  getVariableOptions: async (spec)=>{
62
- var _spec_values;
63
- const values = (_spec_values = spec.values) === null || _spec_values === void 0 ? void 0 : _spec_values.map((v)=>{
62
+ const values = spec.values?.map((v)=>{
64
63
  if (typeof v === 'string') {
65
64
  return {
66
65
  label: v,
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/plugins/variable.tsx"],"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\nimport { VariablePlugin, VariableOption, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Autocomplete, TextField } from '@mui/material';\nimport { ReactElement } from 'react';\n\ntype StaticListOption = string | VariableOption;\n\ntype StaticListVariableOptions = {\n values: StaticListOption[];\n};\n\nfunction StaticListVariableOptionEditor(props: OptionsEditorProps<StaticListVariableOptions>): ReactElement {\n const value = props.value.values.map((v) => {\n if (typeof v === 'string') {\n return v;\n } else {\n return v.value;\n }\n });\n\n const onChange = (__: unknown, value: string[]): void => {\n props.onChange({\n values: value.map((v) => {\n return { value: v, label: v };\n }),\n });\n };\n\n return (\n <div>\n <Autocomplete\n onPaste={(e) => {\n // Append new values on paste\n const v = e.clipboardData.getData('text/plain');\n if (v) {\n const values = v.split(',');\n onChange(null, value.concat(values));\n e.preventDefault();\n }\n }}\n multiple\n value={value}\n onChange={onChange}\n options={[]}\n freeSolo\n clearOnBlur\n readOnly={props.isReadonly}\n renderInput={(params) => (\n <TextField\n {...params}\n label=\"Values\"\n placeholder=\"Values\"\n helperText='Type new value then press \"Enter\" to add.'\n />\n )}\n />\n </div>\n );\n}\n\nexport const StaticListVariable: VariablePlugin<StaticListVariableOptions> = {\n getVariableOptions: async (spec) => {\n const values = spec.values?.map((v) => {\n if (typeof v === 'string') {\n return { label: v, value: v };\n }\n return v;\n });\n return {\n data: values,\n };\n },\n dependsOn: () => {\n return { variables: [] };\n },\n OptionsEditorComponent: StaticListVariableOptionEditor,\n createInitialOptions: () => ({ values: [] }),\n};\n"],"names":["Autocomplete","TextField","StaticListVariableOptionEditor","props","value","values","map","v","onChange","__","label","div","onPaste","e","clipboardData","getData","split","concat","preventDefault","multiple","options","freeSolo","clearOnBlur","readOnly","isReadonly","renderInput","params","placeholder","helperText","StaticListVariable","getVariableOptions","spec","data","dependsOn","variables","OptionsEditorComponent","createInitialOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF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ACF;IACA4B,WAAW;QACT,OAAO;YAAEC,WAAW,EAAE;QAAC;IACzB;IACAC,wBAAwBjC;IACxBkC,sBAAsB,IAAO,CAAA;YAAE/B,QAAQ,EAAE;QAAC,CAAA;AAC5C,EAAE"}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=setup-tests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,17 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import '@testing-library/jest-dom';
14
+ // Always mock e-charts during tests since we don't have a proper canvas in jsdom
15
+ jest.mock('echarts/core');
16
+
17
+ //# sourceMappingURL=setup-tests.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/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 './utils';\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,UAAU"}
1
+ {"version":3,"sources":["../../src/setup-tests.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\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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../../src/test/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,yCAAyC,CAAC"}