@perses-dev/victorialogs-plugin 0.3.0 → 0.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/__mf/css/async/7354.85c2cbf6.css +1 -0
  2. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  3. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  4. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  5. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  6. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  8. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  10. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  11. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  12. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  13. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  14. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  17. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  18. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  26. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  27. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  28. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  29. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  30. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  31. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  32. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  33. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  34. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  35. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  36. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  37. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  38. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  39. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  40. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  42. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  43. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  44. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  45. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  47. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  49. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  50. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  51. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  52. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  53. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  54. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  55. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  56. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  57. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  58. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  59. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  60. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  61. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  62. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  63. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  64. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  66. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  67. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  68. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  69. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  70. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  71. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  72. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  73. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  74. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  75. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  77. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  79. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  80. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  82. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  83. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  84. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  85. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  86. package/__mf/js/VictoriaLogs.393edf03.js +7 -0
  87. package/__mf/js/async/11.3c4453d5.js +2 -0
  88. package/__mf/js/async/{7576.4a8d8b90.js.LICENSE.txt → 11.3c4453d5.js.LICENSE.txt} +17 -1
  89. package/__mf/js/async/1170.77c6039d.js +101 -0
  90. package/__mf/js/async/1616.49796cfc.js +1 -0
  91. package/__mf/js/async/1728.04dc9c2d.js +1 -0
  92. package/__mf/js/async/1969.a450043d.js +1 -0
  93. package/__mf/js/async/198.31ae9b92.js +2 -0
  94. package/__mf/js/async/2043.5498e06e.js +2 -0
  95. package/__mf/js/async/2377.925bfe8b.js +1 -0
  96. package/__mf/js/async/2502.2608617e.js +1 -0
  97. package/__mf/js/async/2728.66342db6.js +1 -0
  98. package/__mf/js/async/2749.8fbf14eb.js +2 -0
  99. package/__mf/js/async/3059.56d0ffdb.js +1 -0
  100. package/__mf/js/async/392.7124395e.js +2 -0
  101. package/__mf/js/async/3998.70245d7e.js +2 -0
  102. package/__mf/js/async/4121.be1dbdb1.js +2 -0
  103. package/__mf/js/async/4225.e25a77bc.js +10 -0
  104. package/__mf/js/async/{4225.43367877.js.LICENSE.txt → 4225.e25a77bc.js.LICENSE.txt} +1 -1
  105. package/__mf/js/async/4248.7a9801a3.js +1 -0
  106. package/__mf/js/async/5019.967daa26.js +1 -0
  107. package/__mf/js/async/5071.bbebebcf.js +1 -0
  108. package/__mf/js/async/5440.6b23d19a.js +2 -0
  109. package/__mf/js/async/5587.dc1161fb.js +1 -0
  110. package/__mf/js/async/5706.f345ce44.js +1 -0
  111. package/__mf/js/async/6274.71a9e84c.js +2 -0
  112. package/__mf/js/async/6410.724cafc0.js +1 -0
  113. package/__mf/js/async/6592.58ed2383.js +1 -0
  114. package/__mf/js/async/6854.42957bdc.js +1 -0
  115. package/__mf/js/async/6864.4ac20a8a.js +2 -0
  116. package/__mf/js/async/7177.0f9e40f7.js +1 -0
  117. package/__mf/js/async/7192.26ac2da2.js +1 -0
  118. package/__mf/js/async/7354.7794d324.js +7 -0
  119. package/__mf/js/async/{7958.bd561cbd.js.LICENSE.txt → 7354.7794d324.js.LICENSE.txt} +19 -1
  120. package/__mf/js/async/7413.1076eb0d.js +1 -0
  121. package/__mf/js/async/7793.247ca16e.js +1 -0
  122. package/__mf/js/async/7817.2817c62c.js +2 -0
  123. package/__mf/js/async/7862.09a88a3c.js +2 -0
  124. package/__mf/js/async/7968.1b3441d5.js +1 -0
  125. package/__mf/js/async/7978.6efd6947.js +1 -0
  126. package/__mf/js/async/8356.59a415be.js +1 -0
  127. package/__mf/js/async/8470.f650462e.js +2 -0
  128. package/__mf/js/async/873.19771b21.js +1 -0
  129. package/__mf/js/async/8750.a9c05111.js +3 -0
  130. package/__mf/js/async/8787.0312661f.js +2 -0
  131. package/__mf/js/async/9235.c949f6ff.js +1 -0
  132. package/__mf/js/async/941.a7581a2c.js +2 -0
  133. package/__mf/js/async/9588.7f035e9c.js +1 -0
  134. package/__mf/js/async/9836.a90bfe3c.js +1 -0
  135. package/__mf/js/async/9877.6135f2be.js +38 -0
  136. package/__mf/js/async/9916.c4dd765e.js +22 -0
  137. package/__mf/js/async/9944.a006f9ca.js +1 -0
  138. package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.94f80aa6.js +2 -0
  139. package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.bc79069d.js +1 -0
  140. package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.66036e23.js +1 -0
  141. package/__mf/js/async/__federation_expose_VictoriaLogsLogQuery.1c08408c.js +1 -0
  142. package/__mf/js/async/__federation_expose_VictoriaLogsTimeSeriesQuery.363a0da2.js +1 -0
  143. package/__mf/js/main.5cb26b17.js +7 -0
  144. package/lib/cjs/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +2 -6
  145. package/lib/cjs/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +2 -6
  146. package/lib/cjs/queries/victorialogs-time-series-query/query.js +2 -2
  147. package/lib/datasources/victorialogs-datasource/types.d.ts +1 -1
  148. package/lib/datasources/victorialogs-datasource/types.js.map +1 -1
  149. package/lib/model/selectors.d.ts +1 -1
  150. package/lib/model/selectors.d.ts.map +1 -1
  151. package/lib/model/selectors.js.map +1 -1
  152. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.d.ts.map +1 -1
  153. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +2 -6
  154. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js.map +1 -1
  155. package/lib/queries/victorialogs-log-query/interface.d.ts +1 -1
  156. package/lib/queries/victorialogs-log-query/interface.d.ts.map +1 -1
  157. package/lib/queries/victorialogs-log-query/interface.js.map +1 -1
  158. package/lib/queries/victorialogs-log-query/query.js.map +1 -1
  159. package/lib/queries/victorialogs-log-query/types.d.ts +1 -1
  160. package/lib/queries/victorialogs-log-query/types.js.map +1 -1
  161. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.d.ts.map +1 -1
  162. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +2 -6
  163. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js.map +1 -1
  164. package/lib/queries/victorialogs-time-series-query/query.d.ts.map +1 -1
  165. package/lib/queries/victorialogs-time-series-query/query.js +1 -1
  166. package/lib/queries/victorialogs-time-series-query/query.js.map +1 -1
  167. package/lib/queries/victorialogs-time-series-query/types.d.ts +1 -1
  168. package/lib/queries/victorialogs-time-series-query/types.js.map +1 -1
  169. package/lib/variables/utils.d.ts +2 -1
  170. package/lib/variables/utils.d.ts.map +1 -1
  171. package/lib/variables/utils.js.map +1 -1
  172. package/mf-manifest.json +221 -183
  173. package/mf-stats.json +237 -183
  174. package/package.json +6 -6
  175. package/__mf/css/async/3061.d3010b86.css +0 -1
  176. package/__mf/css/async/7370.d3010b86.css +0 -1
  177. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  178. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  179. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  180. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  181. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  182. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  183. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  184. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  185. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  186. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  187. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  188. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  189. package/__mf/js/VictoriaLogs.796e2488.js +0 -6
  190. package/__mf/js/async/1170.1ace5903.js +0 -101
  191. package/__mf/js/async/1430.bac7994c.js +0 -1
  192. package/__mf/js/async/1616.44d9fc39.js +0 -1
  193. package/__mf/js/async/1728.4186adbe.js +0 -1
  194. package/__mf/js/async/1969.4f0fc9ef.js +0 -1
  195. package/__mf/js/async/2043.a03fc64f.js +0 -2
  196. package/__mf/js/async/2377.443a1b22.js +0 -1
  197. package/__mf/js/async/2386.21b9bb32.js +0 -2
  198. package/__mf/js/async/2749.edab3f5e.js +0 -2
  199. package/__mf/js/async/3059.bd425bfb.js +0 -1
  200. package/__mf/js/async/3181.0e31aa90.js +0 -2
  201. package/__mf/js/async/392.8da1804a.js +0 -2
  202. package/__mf/js/async/3954.dbc4d4c5.js +0 -1
  203. package/__mf/js/async/4121.db798067.js +0 -2
  204. package/__mf/js/async/4225.43367877.js +0 -10
  205. package/__mf/js/async/4248.ce5ffe03.js +0 -1
  206. package/__mf/js/async/5071.b48bd1f7.js +0 -1
  207. package/__mf/js/async/54.4c016d3d.js +0 -22
  208. package/__mf/js/async/5440.9338b9ea.js +0 -2
  209. package/__mf/js/async/5587.dfbc3ebc.js +0 -1
  210. package/__mf/js/async/5706.a7fb5c1b.js +0 -1
  211. package/__mf/js/async/6274.f6456c87.js +0 -2
  212. package/__mf/js/async/6283.5edb374e.js +0 -2
  213. package/__mf/js/async/6854.efd1a0a6.js +0 -1
  214. package/__mf/js/async/7177.0fe1dff0.js +0 -1
  215. package/__mf/js/async/7192.cb6ffe0e.js +0 -1
  216. package/__mf/js/async/7370.ef522250.js +0 -2
  217. package/__mf/js/async/7576.4a8d8b90.js +0 -2
  218. package/__mf/js/async/7793.06fe240f.js +0 -1
  219. package/__mf/js/async/7958.bd561cbd.js +0 -7
  220. package/__mf/js/async/7968.5fed5183.js +0 -1
  221. package/__mf/js/async/7978.c5b22459.js +0 -1
  222. package/__mf/js/async/8356.2b39af38.js +0 -1
  223. package/__mf/js/async/8470.32cf23b6.js +0 -2
  224. package/__mf/js/async/8482.6c4d64de.js +0 -1
  225. package/__mf/js/async/873.f5cf5a02.js +0 -1
  226. package/__mf/js/async/9010.85600fc4.js +0 -2
  227. package/__mf/js/async/9010.85600fc4.js.LICENSE.txt +0 -15
  228. package/__mf/js/async/9071.720986e2.js +0 -2
  229. package/__mf/js/async/9235.543bd352.js +0 -1
  230. package/__mf/js/async/941.6f8e368d.js +0 -2
  231. package/__mf/js/async/9588.b67d84aa.js +0 -1
  232. package/__mf/js/async/9836.bbf150b2.js +0 -1
  233. package/__mf/js/async/9877.73cfc5dd.js +0 -38
  234. package/__mf/js/async/9944.34a79f7c.js +0 -1
  235. package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.9d56f698.js +0 -2
  236. package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.5bf33a62.js +0 -2
  237. package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.7e86dee8.js +0 -2
  238. package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.7e86dee8.js.LICENSE.txt +0 -9
  239. package/__mf/js/async/__federation_expose_VictoriaLogsLogQuery.8a11f931.js +0 -1
  240. package/__mf/js/async/__federation_expose_VictoriaLogsTimeSeriesQuery.34b8c330.js +0 -1
  241. package/__mf/js/main.21f57521.js +0 -6
  242. /package/__mf/js/async/{2386.21b9bb32.js.LICENSE.txt → 198.31ae9b92.js.LICENSE.txt} +0 -0
  243. /package/__mf/js/async/{2043.a03fc64f.js.LICENSE.txt → 2043.5498e06e.js.LICENSE.txt} +0 -0
  244. /package/__mf/js/async/{2749.edab3f5e.js.LICENSE.txt → 2749.8fbf14eb.js.LICENSE.txt} +0 -0
  245. /package/__mf/js/async/{392.8da1804a.js.LICENSE.txt → 392.7124395e.js.LICENSE.txt} +0 -0
  246. /package/__mf/js/async/{3181.0e31aa90.js.LICENSE.txt → 3998.70245d7e.js.LICENSE.txt} +0 -0
  247. /package/__mf/js/async/{4121.db798067.js.LICENSE.txt → 4121.be1dbdb1.js.LICENSE.txt} +0 -0
  248. /package/__mf/js/async/{5440.9338b9ea.js.LICENSE.txt → 5440.6b23d19a.js.LICENSE.txt} +0 -0
  249. /package/__mf/js/async/{6274.f6456c87.js.LICENSE.txt → 6274.71a9e84c.js.LICENSE.txt} +0 -0
  250. /package/__mf/js/async/{7370.ef522250.js.LICENSE.txt → 6864.4ac20a8a.js.LICENSE.txt} +0 -0
  251. /package/__mf/js/async/{9071.720986e2.js.LICENSE.txt → 7817.2817c62c.js.LICENSE.txt} +0 -0
  252. /package/__mf/js/async/{6283.5edb374e.js.LICENSE.txt → 7862.09a88a3c.js.LICENSE.txt} +0 -0
  253. /package/__mf/js/async/{8470.32cf23b6.js.LICENSE.txt → 8470.f650462e.js.LICENSE.txt} +0 -0
  254. /package/__mf/js/async/{941.6f8e368d.js.LICENSE.txt → 8787.0312661f.js.LICENSE.txt} +0 -0
  255. /package/__mf/js/async/{__federation_expose_VictoriaLogsDatasource.9d56f698.js.LICENSE.txt → 941.a7581a2c.js.LICENSE.txt} +0 -0
  256. /package/__mf/js/async/{54.4c016d3d.js.LICENSE.txt → 9916.c4dd765e.js.LICENSE.txt} +0 -0
  257. /package/__mf/js/async/{__federation_expose_VictoriaLogsFieldNamesVariable.5bf33a62.js.LICENSE.txt → __federation_expose_VictoriaLogsDatasource.94f80aa6.js.LICENSE.txt} +0 -0
@@ -20,9 +20,9 @@ Object.defineProperty(exports, "getVictoriaLogsTimeSeriesData", {
20
20
  return getVictoriaLogsTimeSeriesData;
21
21
  }
22
22
  });
23
- const _core = require("@perses-dev/core");
24
23
  const _pluginsystem = require("@perses-dev/plugin-system");
25
24
  const _datefns = require("date-fns");
25
+ const _spec = require("@perses-dev/spec");
26
26
  const _constants = require("../constants");
27
27
  // Constants for VictoriaLogs step calculation
28
28
  const MAX_VICTORIALOGS_DATA_POINTS = 10000; // Similar to Prometheus
@@ -31,7 +31,7 @@ const DEFAULT_MIN_STEP_SECONDS = 15; // 15 seconds default minimum
31
31
  * Converts a duration string (like "15s", "1m") to seconds
32
32
  */ function getDurationStringSeconds(durationString) {
33
33
  if (!durationString) return undefined;
34
- const duration = (0, _core.parseDurationString)(durationString);
34
+ const duration = (0, _spec.parseDurationString)(durationString);
35
35
  const ms = (0, _datefns.milliseconds)(duration);
36
36
  return Math.floor(ms / 1000);
37
37
  }
@@ -1,4 +1,4 @@
1
- import { HTTPProxy } from '@perses-dev/core';
1
+ import { HTTPProxy } from '@perses-dev/spec';
2
2
  export interface VictoriaLogsDatasourceSpec {
3
3
  directUrl?: string;
4
4
  proxy?: HTTPProxy;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/datasources/victorialogs-datasource/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { HTTPProxy } from '@perses-dev/core';\n\nexport interface VictoriaLogsDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
1
+ {"version":3,"sources":["../../../../src/datasources/victorialogs-datasource/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { HTTPProxy } from '@perses-dev/spec';\n\nexport interface VictoriaLogsDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
@@ -1,5 +1,5 @@
1
- import { DatasourceSelector } from '@perses-dev/core';
2
1
  import { DatasourceSelectValue } from '@perses-dev/plugin-system';
2
+ import { DatasourceSelector } from '@perses-dev/spec';
3
3
  export declare const VICTORIALOGS_DATASOURCE_KIND: "VictoriaLogsDatasource";
4
4
  export interface VictoriaLogsDatasourceSelector extends DatasourceSelector {
5
5
  kind: typeof VICTORIALOGS_DATASOURCE_KIND;
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/model/selectors.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,2BAA2B,CAAC;AAExF,eAAO,MAAM,4BAA4B,EAAG,wBAAiC,CAAC;AAE9E,MAAM,WAAW,8BAA+B,SAAQ,kBAAkB;IACxE,IAAI,EAAE,OAAO,4BAA4B,CAAC;CAC3C;AAED,eAAO,MAAM,oBAAoB,EAAE,8BAAuE,CAAC;AAE3G,wBAAgB,6BAA6B,CAC3C,qBAAqB,EAAE,qBAAqB,CAAC,8BAA8B,CAAC,GAC3E,OAAO,CAET;AAED,wBAAgB,gCAAgC,CAC9C,qBAAqB,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,GAC/D,qBAAqB,IAAI,8BAA8B,CAEzD"}
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/model/selectors.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAwB,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,4BAA4B,EAAG,wBAAiC,CAAC;AAE9E,MAAM,WAAW,8BAA+B,SAAQ,kBAAkB;IACxE,IAAI,EAAE,OAAO,4BAA4B,CAAC;CAC3C;AAED,eAAO,MAAM,oBAAoB,EAAE,8BAAuE,CAAC;AAE3G,wBAAgB,6BAA6B,CAC3C,qBAAqB,EAAE,qBAAqB,CAAC,8BAA8B,CAAC,GAC3E,OAAO,CAET;AAED,wBAAgB,gCAAgC,CAC9C,qBAAqB,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,GAC/D,qBAAqB,IAAI,8BAA8B,CAEzD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/selectors.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/core';\nimport { DatasourceSelectValue, isVariableDatasource } from '@perses-dev/plugin-system';\n\nexport const VICTORIALOGS_DATASOURCE_KIND = 'VictoriaLogsDatasource' as const;\n\nexport interface VictoriaLogsDatasourceSelector extends DatasourceSelector {\n kind: typeof VICTORIALOGS_DATASOURCE_KIND;\n}\n\nexport const DEFAULT_VICTORIALOGS: VictoriaLogsDatasourceSelector = { kind: VICTORIALOGS_DATASOURCE_KIND };\n\nexport function isDefaultVictoriaLogsSelector(\n datasourceSelectValue: DatasourceSelectValue<VictoriaLogsDatasourceSelector>\n): boolean {\n return !isVariableDatasource(datasourceSelectValue) && datasourceSelectValue.name === undefined;\n}\n\nexport function isVictoriaLogsDatasourceSelector(\n datasourceSelectValue: DatasourceSelectValue<DatasourceSelector>\n): datasourceSelectValue is VictoriaLogsDatasourceSelector {\n return isVariableDatasource(datasourceSelectValue) || datasourceSelectValue.kind === VICTORIALOGS_DATASOURCE_KIND;\n}\n"],"names":["isVariableDatasource","VICTORIALOGS_DATASOURCE_KIND","DEFAULT_VICTORIALOGS","kind","isDefaultVictoriaLogsSelector","datasourceSelectValue","name","undefined","isVictoriaLogsDatasourceSelector"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAgCA,oBAAoB,QAAQ,4BAA4B;AAExF,OAAO,MAAMC,+BAA+B,yBAAkC;AAM9E,OAAO,MAAMC,uBAAuD;IAAEC,MAAMF;AAA6B,EAAE;AAE3G,OAAO,SAASG,8BACdC,qBAA4E;IAE5E,OAAO,CAACL,qBAAqBK,0BAA0BA,sBAAsBC,IAAI,KAAKC;AACxF;AAEA,OAAO,SAASC,iCACdH,qBAAgE;IAEhE,OAAOL,qBAAqBK,0BAA0BA,sBAAsBF,IAAI,KAAKF;AACvF"}
1
+ {"version":3,"sources":["../../../src/model/selectors.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelectValue, isVariableDatasource } from '@perses-dev/plugin-system';\nimport { DatasourceSelector } from '@perses-dev/spec';\n\nexport const VICTORIALOGS_DATASOURCE_KIND = 'VictoriaLogsDatasource' as const;\n\nexport interface VictoriaLogsDatasourceSelector extends DatasourceSelector {\n kind: typeof VICTORIALOGS_DATASOURCE_KIND;\n}\n\nexport const DEFAULT_VICTORIALOGS: VictoriaLogsDatasourceSelector = { kind: VICTORIALOGS_DATASOURCE_KIND };\n\nexport function isDefaultVictoriaLogsSelector(\n datasourceSelectValue: DatasourceSelectValue<VictoriaLogsDatasourceSelector>\n): boolean {\n return !isVariableDatasource(datasourceSelectValue) && datasourceSelectValue.name === undefined;\n}\n\nexport function isVictoriaLogsDatasourceSelector(\n datasourceSelectValue: DatasourceSelectValue<DatasourceSelector>\n): datasourceSelectValue is VictoriaLogsDatasourceSelector {\n return isVariableDatasource(datasourceSelectValue) || datasourceSelectValue.kind === VICTORIALOGS_DATASOURCE_KIND;\n}\n"],"names":["isVariableDatasource","VICTORIALOGS_DATASOURCE_KIND","DEFAULT_VICTORIALOGS","kind","isDefaultVictoriaLogsSelector","datasourceSelectValue","name","undefined","isVictoriaLogsDatasourceSelector"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAgCA,oBAAoB,QAAQ,4BAA4B;AAGxF,OAAO,MAAMC,+BAA+B,yBAAkC;AAM9E,OAAO,MAAMC,uBAAuD;IAAEC,MAAMF;AAA6B,EAAE;AAE3G,OAAO,SAASG,8BACdC,qBAA4E;IAE5E,OAAO,CAACL,qBAAqBK,0BAA0BA,sBAAsBC,IAAI,KAAKC;AACxF;AAEA,OAAO,SAASC,iCACdH,qBAAgE;IAEhE,OAAOL,qBAAqBK,0BAA0BA,sBAAsBF,IAAI,KAAKF;AACvF"}
@@ -1 +1 @@
1
- {"version":3,"file":"VictoriaLogsLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAoC,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,KAAK,4BAA4B,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;AAEjF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,4BAA4B,GAAG,YAAY,CAyF5F"}
1
+ {"version":3,"file":"VictoriaLogsLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAoC,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,KAAK,4BAA4B,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;AAEjF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,4BAA4B,GAAG,YAAY,CAoF5F"}
@@ -14,6 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { DatasourceSelect, isVariableDatasource, useDatasourceSelectValueToSelector } from '@perses-dev/plugin-system';
15
15
  import { InputLabel, Stack } from '@mui/material';
16
16
  import { useCallback, useState, useEffect } from 'react';
17
+ import { createModEnterHandler } from '@perses-dev/dashboards';
17
18
  import { LogsQLEditor } from '../../components/logsql-editor';
18
19
  import { VICTORIALOGS_DATASOURCE_KIND } from '../../model';
19
20
  import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';
@@ -93,12 +94,7 @@ export function VictoriaLogsLogQueryEditor(props) {
93
94
  value: localQuery,
94
95
  onChange: handleQueryChange,
95
96
  onBlur: ()=>handleQueryExecute(localQuery),
96
- onKeyDown: (event)=>{
97
- if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
98
- event.preventDefault();
99
- handleQueryExecute(localQuery);
100
- }
101
- },
97
+ onKeyDown: createModEnterHandler(()=>handleQueryExecute(localQuery)),
102
98
  placeholder: 'Enter LogsQL query (e.g. {job="mysql"} |= "error")'
103
99
  })
104
100
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack } from '@mui/material';\nimport { ReactElement, useCallback, useState, useEffect } from 'react';\nimport { LogsQLEditor } from '../../components/logsql-editor';\nimport { VICTORIALOGS_DATASOURCE_KIND, VictoriaLogsDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsLogQuerySpec } from './types';\n\ntype VictoriaLogsQueryEditorProps = OptionsEditorProps<VictoriaLogsLogQuerySpec>;\n\nexport function VictoriaLogsLogQueryEditor(props: VictoriaLogsQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n VICTORIALOGS_DATASOURCE_KIND\n ) as VictoriaLogsDatasourceSelector;\n\n // const { data: client } = useDatasourceClient<VictoriaLogsClient>(selectedDatasource);\n // const victorialogsURL = client?.options.datasourceUrl;\n\n // Local state for editor value to prevent query_range calls on every keystroke\n const [localQuery, setLocalQuery] = useState(value.query);\n\n // Update local state when prop changes\n useEffect(() => {\n setLocalQuery(value.query);\n }, [value.query]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange({ ...value, datasource: newDatasourceSelection });\n return;\n }\n\n throw new Error('Got unexpected non VictoriaLogsQuery datasource selection');\n };\n\n // Debounced query change handler to prevent excessive query_range calls\n const handleQueryChange = useCallback((newQuery: string) => {\n setLocalQuery(newQuery);\n }, []);\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = useCallback(\n (query: string) => {\n onChange({ ...value, query });\n },\n [onChange, value]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"VictoriaLogs Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogsQL Query\n </InputLabel>\n <LogsQLEditor\n value={localQuery}\n onChange={handleQueryChange}\n onBlur={() => handleQueryExecute(localQuery)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(localQuery);\n }\n }}\n placeholder='Enter LogsQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","useState","useEffect","LogsQLEditor","VICTORIALOGS_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","VictoriaLogsLogQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","localQuery","setLocalQuery","query","handleDatasourceChange","newDatasourceSelection","kind","Error","handleQueryChange","newQuery","handleQueryExecute","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,QAAQ,gBAAgB;AAClD,SAAuBC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,QAAQ;AACvE,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,4BAA4B,QAAwC,cAAc;AAC3F,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AAKnE,OAAO,SAASC,2BAA2BC,KAAmC;IAC5E,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,wBAAwBD,cAAcL;IAC5C,MAAMO,qBAAqBhB,mCACzBe,uBACAR;IAGF,wFAAwF;IACxF,yDAAyD;IAEzD,+EAA+E;IAC/E,MAAM,CAACU,YAAYC,cAAc,GAAGd,SAASS,MAAMM,KAAK;IAExD,uCAAuC;IACvCd,UAAU;QACRa,cAAcL,MAAMM,KAAK;IAC3B,GAAG;QAACN,MAAMM,KAAK;KAAC;IAEhB,MAAMC,yBAA4D,CAACC;QACjE,IAAI,CAACtB,qBAAqBsB,2BAA2BA,uBAAuBC,IAAI,KAAKd,iBAAiB;YACpGI,SAAS;gBAAE,GAAGC,KAAK;gBAAEC,YAAYO;YAAuB;YACxD;QACF;QAEA,MAAM,IAAIE,MAAM;IAClB;IAEA,wEAAwE;IACxE,MAAMC,oBAAoBrB,YAAY,CAACsB;QACrCP,cAAcO;IAChB,GAAG,EAAE;IAEL,6CAA6C;IAC7C,MAAMC,qBAAqBvB,YACzB,CAACgB;QACCP,SAAS;YAAE,GAAGC,KAAK;YAAEM;QAAM;IAC7B,GACA;QAACP;QAAUC;KAAM;IAGnB,qBACE,MAACX;QAAMyB,SAAS;QAAKC,eAAe;;0BAClC,MAACC;;kCACC,KAAC5B;wBACC6B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACnC;wBACCoC,sBAAsB1B;wBACtBK,OAAOG;wBACPJ,UAAUQ;wBACVe,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC5B;wBACC6B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC3B;wBACCO,OAAOI;wBACPL,UAAUY;wBACVa,QAAQ,IAAMX,mBAAmBT;wBACjCqB,WAAW,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBjB,mBAAmBT;4BACrB;wBACF;wBACA2B,aAAY;;;;;;AAMtB"}
1
+ {"version":3,"sources":["../../../../src/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack } from '@mui/material';\nimport { ReactElement, useCallback, useState, useEffect } from 'react';\nimport { createModEnterHandler } from '@perses-dev/dashboards';\nimport { LogsQLEditor } from '../../components/logsql-editor';\nimport { VICTORIALOGS_DATASOURCE_KIND, VictoriaLogsDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsLogQuerySpec } from './types';\n\ntype VictoriaLogsQueryEditorProps = OptionsEditorProps<VictoriaLogsLogQuerySpec>;\n\nexport function VictoriaLogsLogQueryEditor(props: VictoriaLogsQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n VICTORIALOGS_DATASOURCE_KIND\n ) as VictoriaLogsDatasourceSelector;\n\n // const { data: client } = useDatasourceClient<VictoriaLogsClient>(selectedDatasource);\n // const victorialogsURL = client?.options.datasourceUrl;\n\n // Local state for editor value to prevent query_range calls on every keystroke\n const [localQuery, setLocalQuery] = useState(value.query);\n\n // Update local state when prop changes\n useEffect(() => {\n setLocalQuery(value.query);\n }, [value.query]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange({ ...value, datasource: newDatasourceSelection });\n return;\n }\n\n throw new Error('Got unexpected non VictoriaLogsQuery datasource selection');\n };\n\n // Debounced query change handler to prevent excessive query_range calls\n const handleQueryChange = useCallback((newQuery: string) => {\n setLocalQuery(newQuery);\n }, []);\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = useCallback(\n (query: string) => {\n onChange({ ...value, query });\n },\n [onChange, value]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"VictoriaLogs Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogsQL Query\n </InputLabel>\n <LogsQLEditor\n value={localQuery}\n onChange={handleQueryChange}\n onBlur={() => handleQueryExecute(localQuery)}\n onKeyDown={createModEnterHandler(() => handleQueryExecute(localQuery))}\n placeholder='Enter LogsQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","useState","useEffect","createModEnterHandler","LogsQLEditor","VICTORIALOGS_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","VictoriaLogsLogQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","localQuery","setLocalQuery","query","handleDatasourceChange","newDatasourceSelection","kind","Error","handleQueryChange","newQuery","handleQueryExecute","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","placeholder"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,QAA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wBACPJ,UAAUQ;wBACVe,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC3B;wBACCO,OAAOI;wBACPL,UAAUY;wBACVa,QAAQ,IAAMX,mBAAmBT;wBACjCqB,WAAWjC,sBAAsB,IAAMqB,mBAAmBT;wBAC1DsB,aAAY;;;;;;AAMtB"}
@@ -1,5 +1,5 @@
1
- import { LogData, AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';
2
1
  import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
2
+ import { AbsoluteTimeRange, LogData, UnknownSpec } from '@perses-dev/spec';
3
3
  export interface LogQueryResult {
4
4
  logs: LogData;
5
5
  timeRange: AbsoluteTimeRange;
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-log-query/interface.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,0BAA0B,CAAC;CAC9E"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-log-query/interface.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,0BAA0B,CAAC;CAC9E"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/victorialogs-log-query/interface.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LogData, AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuBjC,WAGC"}
1
+ {"version":3,"sources":["../../../../src/queries/victorialogs-log-query/interface.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\nimport { AbsoluteTimeRange, LogData, UnknownSpec } from '@perses-dev/spec';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuBjC,WAGC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/victorialogs-log-query/query.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport { LogEntry, LogData } from '@perses-dev/core';\nimport { VictoriaLogsStreamQueryRangeResponse } from '../../model/types';\nimport { VictoriaLogsClient } from '../../model/client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsLogQuerySpec } from './types';\nimport { LogQueryPlugin, LogQueryContext } from './interface';\n\nfunction convertStreamToLogs(data: VictoriaLogsStreamQueryRangeResponse, defaultTime: string): LogData {\n const entries: LogEntry[] = [];\n\n data.forEach((entry) => {\n const { _msg, _time, ...labels } = entry;\n const time = !_time && !_msg ? defaultTime : Date.parse(_time);\n entries.push({\n timestamp: Number(time) / 1000,\n line: _msg || '',\n labels: labels,\n });\n });\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getVictoriaLogsLogData: LogQueryPlugin<VictoriaLogsLogQuerySpec>['getLogData'] = async (\n spec: VictoriaLogsLogQuerySpec,\n context: LogQueryContext\n) => {\n if (!spec.query) {\n return {\n logs: { entries: [], totalCount: 0 },\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n const client = (await context.datasourceStore.getDatasourceClient<VictoriaLogsClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as VictoriaLogsClient;\n\n const { start, end } = context.timeRange;\n\n const response: VictoriaLogsStreamQueryRangeResponse = await client.streamQueryRange({\n query,\n start: start.toISOString(),\n end: end.toISOString(),\n });\n\n const logs = convertStreamToLogs(response, end.getTime().toString());\n\n return {\n logs,\n timeRange: { start, end },\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","convertStreamToLogs","data","defaultTime","entries","forEach","entry","_msg","_time","labels","time","Date","parse","push","timestamp","Number","line","totalCount","length","getVictoriaLogsLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","response","streamQueryRange","toISOString","getTime","toString","metadata","executedQueryString"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,4BAA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../../../../src/queries/victorialogs-log-query/query.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport { LogData, LogEntry } from '@perses-dev/spec';\nimport { VictoriaLogsStreamQueryRangeResponse } from '../../model/types';\nimport { VictoriaLogsClient } from '../../model/client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsLogQuerySpec } from './types';\nimport { LogQueryPlugin, LogQueryContext } from './interface';\n\nfunction convertStreamToLogs(data: VictoriaLogsStreamQueryRangeResponse, defaultTime: string): LogData {\n const entries: LogEntry[] = [];\n\n data.forEach((entry) => {\n const { _msg, _time, ...labels } = entry;\n const time = !_time && !_msg ? defaultTime : Date.parse(_time);\n entries.push({\n timestamp: Number(time) / 1000,\n line: _msg || '',\n labels: labels,\n });\n });\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getVictoriaLogsLogData: LogQueryPlugin<VictoriaLogsLogQuerySpec>['getLogData'] = async (\n spec: VictoriaLogsLogQuerySpec,\n context: LogQueryContext\n) => {\n if (!spec.query) {\n return {\n logs: { entries: [], totalCount: 0 },\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n const client = (await context.datasourceStore.getDatasourceClient<VictoriaLogsClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as VictoriaLogsClient;\n\n const { start, end } = context.timeRange;\n\n const response: VictoriaLogsStreamQueryRangeResponse = await client.streamQueryRange({\n query,\n start: start.toISOString(),\n end: end.toISOString(),\n });\n\n const logs = convertStreamToLogs(response, end.getTime().toString());\n\n return {\n logs,\n timeRange: { start, end },\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","convertStreamToLogs","data","defaultTime","entries","forEach","entry","_msg","_time","labels","time","Date","parse","push","timestamp","Number","line","totalCount","length","getVictoriaLogsLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","response","streamQueryRange","toISOString","getTime","toString","metadata","executedQueryString"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,4BAA4B;AAI7D,SAASC,kBAAkB,QAAQ,eAAe;AAIlD,SAASC,oBAAoBC,IAA0C,EAAEC,WAAmB;IAC1F,MAAMC,UAAsB,EAAE;IAE9BF,KAAKG,OAAO,CAAC,CAACC;QACZ,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGC,QAAQ,GAAGH;QACnC,MAAMI,OAAO,CAACF,SAAS,CAACD,OAAOJ,cAAcQ,KAAKC,KAAK,CAACJ;QACxDJ,QAAQS,IAAI,CAAC;YACXC,WAAWC,OAAOL,QAAQ;YAC1BM,MAAMT,QAAQ;YACdE,QAAQA;QACV;IACF;IAEA,OAAO;QACLL;QACAa,YAAYb,QAAQc,MAAM;IAC5B;AACF;AAEA,OAAO,MAAMC,yBAAiF,OAC5FC,MACAC;IAEA,IAAI,CAACD,KAAKE,KAAK,EAAE;QACf,OAAO;YACLC,MAAM;gBAAEnB,SAAS,EAAE;gBAAEa,YAAY;YAAE;YACnCO,WAAW;gBAAEC,OAAOJ,QAAQG,SAAS,CAACC,KAAK;gBAAEC,KAAKL,QAAQG,SAAS,CAACE,GAAG;YAAC;QAC1E;IACF;IAEA,MAAMJ,QAAQvB,iBAAiBqB,KAAKE,KAAK,EAAED,QAAQM,aAAa;IAChE,MAAMC,SAAU,MAAMP,QAAQQ,eAAe,CAACC,mBAAmB,CAC/DV,KAAKW,UAAU,IAAI/B;IAGrB,MAAM,EAAEyB,KAAK,EAAEC,GAAG,EAAE,GAAGL,QAAQG,SAAS;IAExC,MAAMQ,WAAiD,MAAMJ,OAAOK,gBAAgB,CAAC;QACnFX;QACAG,OAAOA,MAAMS,WAAW;QACxBR,KAAKA,IAAIQ,WAAW;IACtB;IAEA,MAAMX,OAAOtB,oBAAoB+B,UAAUN,IAAIS,OAAO,GAAGC,QAAQ;IAEjE,OAAO;QACLb;QACAC,WAAW;YAAEC;YAAOC;QAAI;QACxBW,UAAU;YACRC,qBAAqBhB;QACvB;IACF;AACF,EAAE"}
@@ -1,4 +1,4 @@
1
- import { DatasourceSelector } from '@perses-dev/core';
1
+ import { DatasourceSelector } from '@perses-dev/spec';
2
2
  export interface VictoriaLogsLogQuerySpec {
3
3
  query: string;
4
4
  datasource?: DatasourceSelector;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/victorialogs-log-query/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/core';\n\nexport interface VictoriaLogsLogQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
1
+ {"version":3,"sources":["../../../../src/queries/victorialogs-log-query/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/spec';\n\nexport interface VictoriaLogsLogQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
@@ -1 +1 @@
1
- {"version":3,"file":"VictoriaLogsTimeSeriesQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAoC,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,KAAK,4BAA4B,GAAG,kBAAkB,CAAC,+BAA+B,CAAC,CAAC;AAExF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,YAAY,CAsFzF"}
1
+ {"version":3,"file":"VictoriaLogsTimeSeriesQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAoC,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,KAAK,4BAA4B,GAAG,kBAAkB,CAAC,+BAA+B,CAAC,CAAC;AAExF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,YAAY,CAiFzF"}
@@ -14,6 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { DatasourceSelect, isVariableDatasource, useDatasourceSelectValueToSelector } from '@perses-dev/plugin-system';
15
15
  import { InputLabel, Stack } from '@mui/material';
16
16
  import { useCallback, useState, useEffect } from 'react';
17
+ import { createModEnterHandler } from '@perses-dev/dashboards';
17
18
  import { LogsQLEditor } from '../../components/logsql-editor';
18
19
  import { VICTORIALOGS_DATASOURCE_KIND } from '../../model';
19
20
  import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';
@@ -91,12 +92,7 @@ export function VictoriaLogsQueryEditor(props) {
91
92
  value: localQuery,
92
93
  onChange: handleQueryChange,
93
94
  onBlur: ()=>handleQueryExecute(localQuery),
94
- onKeyDown: (event)=>{
95
- if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
96
- event.preventDefault();
97
- handleQueryExecute(localQuery);
98
- }
99
- },
95
+ onKeyDown: createModEnterHandler(()=>handleQueryExecute(localQuery)),
100
96
  placeholder: 'Enter LogsQL query (e.g. {job="mysql"} |= "error")'
101
97
  })
102
98
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack } from '@mui/material';\nimport { ReactElement, useCallback, useState, useEffect } from 'react';\nimport { LogsQLEditor } from '../../components/logsql-editor';\nimport { VICTORIALOGS_DATASOURCE_KIND, VictoriaLogsDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsTimeSeriesQuerySpec } from './types';\n\ntype VictoriaLogsQueryEditorProps = OptionsEditorProps<VictoriaLogsTimeSeriesQuerySpec>;\n\nexport function VictoriaLogsQueryEditor(props: VictoriaLogsQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n VICTORIALOGS_DATASOURCE_KIND\n ) as VictoriaLogsDatasourceSelector;\n\n // Local state for editor value to prevent query_range calls on every keystroke\n const [localQuery, setLocalQuery] = useState(value.query);\n\n // Update local state when prop changes\n useEffect(() => {\n setLocalQuery(value.query);\n }, [value.query]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange({ ...value, datasource: newDatasourceSelection });\n return;\n }\n\n throw new Error('Got unexpected non VictoriaLogsQuery datasource selection');\n };\n\n // Debounced query change handler to prevent excessive query_range calls\n const handleQueryChange = useCallback((newQuery: string) => {\n setLocalQuery(newQuery);\n }, []);\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = useCallback(\n (query: string) => {\n onChange({ ...value, query });\n },\n [onChange, value]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"VictoriaLogs Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogsQL Query\n </InputLabel>\n <LogsQLEditor\n value={localQuery}\n onChange={handleQueryChange}\n onBlur={() => handleQueryExecute(localQuery)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(localQuery);\n }\n }}\n placeholder='Enter LogsQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","useState","useEffect","LogsQLEditor","VICTORIALOGS_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","VictoriaLogsQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","localQuery","setLocalQuery","query","handleDatasourceChange","newDatasourceSelection","kind","Error","handleQueryChange","newQuery","handleQueryExecute","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,S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sBAAsB1B;wBACtBK,OAAOG;wBACPJ,UAAUQ;wBACVe,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC5B;wBACC6B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC3B;wBACCO,OAAOI;wBACPL,UAAUY;wBACVa,QAAQ,IAAMX,mBAAmBT;wBACjCqB,WAAW,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBjB,mBAAmBT;4BACrB;wBACF;wBACA2B,aAAY;;;;;;AAMtB"}
1
+ {"version":3,"sources":["../../../../src/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack } from '@mui/material';\nimport { ReactElement, useCallback, useState, useEffect } from 'react';\nimport { createModEnterHandler } from '@perses-dev/dashboards';\nimport { LogsQLEditor } from '../../components/logsql-editor';\nimport { VICTORIALOGS_DATASOURCE_KIND, VictoriaLogsDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsTimeSeriesQuerySpec } from './types';\n\ntype VictoriaLogsQueryEditorProps = OptionsEditorProps<VictoriaLogsTimeSeriesQuerySpec>;\n\nexport function VictoriaLogsQueryEditor(props: VictoriaLogsQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n VICTORIALOGS_DATASOURCE_KIND\n ) as VictoriaLogsDatasourceSelector;\n\n // Local state for editor value to prevent query_range calls on every keystroke\n const [localQuery, setLocalQuery] = useState(value.query);\n\n // Update local state when prop changes\n useEffect(() => {\n setLocalQuery(value.query);\n }, [value.query]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange({ ...value, datasource: newDatasourceSelection });\n return;\n }\n\n throw new Error('Got unexpected non VictoriaLogsQuery datasource selection');\n };\n\n // Debounced query change handler to prevent excessive query_range calls\n const handleQueryChange = useCallback((newQuery: string) => {\n setLocalQuery(newQuery);\n }, []);\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = useCallback(\n (query: string) => {\n onChange({ ...value, query });\n },\n [onChange, value]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"VictoriaLogs Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogsQL Query\n </InputLabel>\n <LogsQLEditor\n value={localQuery}\n onChange={handleQueryChange}\n onBlur={() => handleQueryExecute(localQuery)}\n onKeyDown={createModEnterHandler(() => handleQueryExecute(localQuery))}\n placeholder='Enter LogsQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","useState","useEffect","createModEnterHandler","LogsQLEditor","VICTORIALOGS_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","VictoriaLogsQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","localQuery","setLocalQuery","query","handleDatasourceChange","newDatasourceSelection","kind","Error","handleQueryChange","newQuery","handleQueryExecute","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","placeholder"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,QAAQ,gBAAgB;AAClD,SAAuBC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,QAAQ;AACvE,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,4BAA4B,QAAwC,cAAc;AAC3F,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AAKnE,OAAO,SAASC,wBAAwBC,KAAmC;IACzE,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,wBAAwBD,cAAcL;IAC5C,MAAMO,qBAAqBjB,mCACzBgB,uBACAR;IAGF,+EAA+E;IAC/E,MAAM,CAACU,YAAYC,cAAc,GAAGf,SAASU,MAAMM,KAAK;IAExD,uCAAuC;IACvCf,UAAU;QACRc,cAAcL,MAAMM,KAAK;IAC3B,GAAG;QAACN,MAAMM,KAAK;KAAC;IAEhB,MAAMC,yBAA4D,CAACC;QACjE,IAAI,CAACvB,qBAAqBuB,2BAA2BA,uBAAuBC,IAAI,KAAKd,iBAAiB;YACpGI,SAAS;gBAAE,GAAGC,KAAK;gBAAEC,YAAYO;YAAuB;YACxD;QACF;QAEA,MAAM,IAAIE,MAAM;IAClB;IAEA,wEAAwE;IACxE,MAAMC,oBAAoBtB,YAAY,CAACuB;QACrCP,cAAcO;IAChB,GAAG,EAAE;IAEL,6CAA6C;IAC7C,MAAMC,qBAAqBxB,YACzB,CAACiB;QACCP,SAAS;YAAE,GAAGC,KAAK;YAAEM;QAAM;IAC7B,GACA;QAACP;QAAUC;KAAM;IAGnB,qBACE,MAACZ;QAAM0B,SAAS;QAAKC,eAAe;;0BAClC,MAACC;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACpC;wBACCqC,sBAAsB1B;wBACtBK,OAAOG;wBACPJ,UAAUQ;wBACVe,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC3B;wBACCO,OAAOI;wBACPL,UAAUY;wBACVa,QAAQ,IAAMX,mBAAmBT;wBACjCqB,WAAWjC,sBAAsB,IAAMqB,mBAAmBT;wBAC1DsB,aAAY;;;;;;AAMtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-time-series-query/query.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,2BAA2B,CAAC;AAKpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,QAAQ,CAAC;IACrB,MAAM,EAAE,wBAAwB,EAAE,CAAC;CACpC,CAAC;AA4EF,eAAO,MAAM,6BAA6B,EAAE,qBAAqB,CAAC,+BAA+B,CAAC,CAAC,mBAAmB,CAkDnH,CAAC"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/queries/victorialogs-time-series-query/query.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,2BAA2B,CAAC;AAMpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,QAAQ,CAAC;IACrB,MAAM,EAAE,wBAAwB,EAAE,CAAC;CACpC,CAAC;AA4EF,eAAO,MAAM,6BAA6B,EAAE,qBAAqB,CAAC,+BAA+B,CAAC,CAAC,mBAAmB,CAkDnH,CAAC"}
@@ -10,9 +10,9 @@
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
- import { parseDurationString } from '@perses-dev/core';
14
13
  import { replaceVariables } from '@perses-dev/plugin-system';
15
14
  import { milliseconds } from 'date-fns';
15
+ import { parseDurationString } from '@perses-dev/spec';
16
16
  import { DEFAULT_DATASOURCE } from '../constants';
17
17
  // Constants for VictoriaLogs step calculation
18
18
  const MAX_VICTORIALOGS_DATA_POINTS = 10000; // Similar to Prometheus
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/victorialogs-time-series-query/query.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeries, DurationString, parseDurationString } from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { milliseconds } from 'date-fns';\nimport { VictoriaLogsClient } from '../../model/client';\nimport { VictoriaLogsStatsQueryRangeResponse } from '../../model/types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsTimeSeriesQuerySpec } from './types';\n\nexport type VictoriaLogsMatrixResult = {\n metric: Record<string, string>;\n values: Array<[number, string]>;\n};\n\nexport type VictoriaLogsMatrixResponse = {\n resultType: 'matrix';\n result: VictoriaLogsMatrixResult[];\n};\n\n// Constants for VictoriaLogs step calculation\nconst MAX_VICTORIALOGS_DATA_POINTS = 10000; // Similar to Prometheus\nconst DEFAULT_MIN_STEP_SECONDS = 15; // 15 seconds default minimum\n\n/**\n * Converts a duration string (like \"15s\", \"1m\") to seconds\n */\nfunction getDurationStringSeconds(durationString?: DurationString): number | undefined {\n if (!durationString) return undefined;\n\n const duration = parseDurationString(durationString);\n const ms = milliseconds(duration);\n return Math.floor(ms / 1000);\n}\n\n/**\n * Calculates appropriate step for VictoriaLogs range queries\n */\nfunction getVictoriaLogsRangeStep(\n startMs: number,\n endMs: number,\n minStepSeconds = DEFAULT_MIN_STEP_SECONDS,\n suggestedStepMs = 0\n): number {\n const suggestedStepSeconds = suggestedStepMs / 1000;\n const querySeconds = (endMs - startMs) / 1000;\n\n let safeStep = querySeconds / MAX_VICTORIALOGS_DATA_POINTS;\n if (safeStep > 1) {\n safeStep = Math.ceil(safeStep);\n }\n\n return Math.max(suggestedStepSeconds, minStepSeconds, safeStep);\n}\n\n/**\n * Formats step in seconds as a duration string for VictoriaLogs API\n */\nfunction formatStepForVictoriaLogs(stepSeconds: number): string {\n if (stepSeconds < 60) {\n return `${Math.round(stepSeconds)}s`;\n } else if (stepSeconds < 3600) {\n return `${Math.round(stepSeconds / 60)}m`;\n } else {\n return `${Math.round(stepSeconds / 3600)}h`;\n }\n}\n\nfunction convertMatrixToTimeSeries(matrix: VictoriaLogsMatrixResult[]): TimeSeries[] {\n return matrix.map((series) => {\n const { _stream, ...labels } = series.metric;\n if (_stream) {\n const match = _stream.match(/{([^}]+)}/);\n if (match && match[1]) {\n match[1].split(',').forEach((labelPair) => {\n const [key, val] = labelPair.split('=').map((s) => s.trim().replace(/^\"|\"$/g, ''));\n if (key && val) labels[key] = val;\n });\n }\n }\n const name = Object.entries(labels)\n .map(([k, v]) => `${k}=${v}`)\n .join(', ');\n return {\n name: name,\n values: series.values.map(([timestamp, value]) => [\n Number(timestamp) * 1000, // Convert seconds to milliseconds\n Number(value),\n ]),\n labels,\n };\n });\n}\n\nexport const getVictoriaLogsTimeSeriesData: TimeSeriesQueryPlugin<VictoriaLogsTimeSeriesQuerySpec>['getTimeSeriesData'] =\n async (spec, context) => {\n if (!spec.query) {\n return {\n series: [],\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n stepMs: DEFAULT_MIN_STEP_SECONDS * 1000,\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n const client = (await context.datasourceStore.getDatasourceClient<VictoriaLogsClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as VictoriaLogsClient;\n\n const { start, end } = context.timeRange;\n\n const minStepSeconds = spec.step\n ? (getDurationStringSeconds(spec.step as DurationString) ?? DEFAULT_MIN_STEP_SECONDS)\n : DEFAULT_MIN_STEP_SECONDS;\n const stepSeconds = getVictoriaLogsRangeStep(\n start.getTime(),\n end.getTime(),\n minStepSeconds,\n context.suggestedStepMs\n );\n const stepString = formatStepForVictoriaLogs(stepSeconds);\n const stepMs = stepSeconds * 1000;\n\n const response: VictoriaLogsStatsQueryRangeResponse = await client.statsQueryRange({\n query,\n step: stepString,\n start: start.toISOString(),\n end: end.toISOString(),\n });\n\n if (response.status === 'error') {\n throw new Error(response.error);\n }\n\n const series = convertMatrixToTimeSeries(response.data.result as VictoriaLogsMatrixResult[]);\n\n return {\n series: series,\n timeRange: { start, end },\n stepMs,\n metadata: {\n executedQueryString: query,\n },\n };\n };\n"],"names":["parseDurationString","replaceVariables","milliseconds","DEFAULT_DATASOURCE","MAX_VICTORIALOGS_DATA_POINTS","DEFAULT_MIN_STEP_SECONDS","getDurationStringSeconds","durationString","undefined","duration","ms","Math","floor","getVictoriaLogsRangeStep","startMs","endMs","minStepSeconds","suggestedStepMs","suggestedStepSeconds","querySeconds","safeStep","ceil","max","formatStepForVictoriaLogs","stepSeconds","round","convertMatrixToTimeSeries","matrix","map","series","_stream","labels","metric","match","split","forEach","labelPair","key","val","s","trim","replace","name","Object","entries","k","v","join","values","timestamp","value","Number","getVictoriaLogsTimeSeriesData","spec","context","query","timeRange","start","end","stepMs","variableState","client","datasourceStore","getDatasourceClient","datasource","step","getTime","stepString","response","statsQueryRange","toISOString","status","Error","error","data","result","metadata","executedQueryString"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAqCA,mBAAmB,QAAQ,mBAAmB;AACnF,SAAgCC,gBAAgB,QAAQ,4BAA4B;AACpF,SAASC,YAAY,QAAQ,WAAW;AAGxC,SAASC,kBAAkB,QAAQ,eAAe;AAalD,8CAA8C;AAC9C,MAAMC,+BAA+B,OAAO,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,MAAME;QACNV,OAAOA,MAAMa,WAAW;QACxBZ,KAAKA,IAAIY,WAAW;IACtB;IAEA,IAAIF,SAASG,MAAM,KAAK,SAAS;QAC/B,MAAM,IAAIC,MAAMJ,SAASK,KAAK;IAChC;IAEA,MAAM5C,SAASH,0BAA0B0C,SAASM,IAAI,CAACC,MAAM;IAE7D,OAAO;QACL9C,QAAQA;QACR2B,WAAW;YAAEC;YAAOC;QAAI;QACxBC;QACAiB,UAAU;YACRC,qBAAqBtB;QACvB;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/queries/victorialogs-time-series-query/query.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { milliseconds } from 'date-fns';\nimport { DurationString, parseDurationString, TimeSeries } from '@perses-dev/spec';\nimport { VictoriaLogsClient } from '../../model/client';\nimport { VictoriaLogsStatsQueryRangeResponse } from '../../model/types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { VictoriaLogsTimeSeriesQuerySpec } from './types';\n\nexport type VictoriaLogsMatrixResult = {\n metric: Record<string, string>;\n values: Array<[number, string]>;\n};\n\nexport type VictoriaLogsMatrixResponse = {\n resultType: 'matrix';\n result: VictoriaLogsMatrixResult[];\n};\n\n// Constants for VictoriaLogs step calculation\nconst MAX_VICTORIALOGS_DATA_POINTS = 10000; // Similar to Prometheus\nconst DEFAULT_MIN_STEP_SECONDS = 15; // 15 seconds default minimum\n\n/**\n * Converts a duration string (like \"15s\", \"1m\") to seconds\n */\nfunction getDurationStringSeconds(durationString?: DurationString): number | undefined {\n if (!durationString) return undefined;\n\n const duration = parseDurationString(durationString);\n const ms = milliseconds(duration);\n return Math.floor(ms / 1000);\n}\n\n/**\n * Calculates appropriate step for VictoriaLogs range queries\n */\nfunction getVictoriaLogsRangeStep(\n startMs: number,\n endMs: number,\n minStepSeconds = DEFAULT_MIN_STEP_SECONDS,\n suggestedStepMs = 0\n): number {\n const suggestedStepSeconds = suggestedStepMs / 1000;\n const querySeconds = (endMs - startMs) / 1000;\n\n let safeStep = querySeconds / MAX_VICTORIALOGS_DATA_POINTS;\n if (safeStep > 1) {\n safeStep = Math.ceil(safeStep);\n }\n\n return Math.max(suggestedStepSeconds, minStepSeconds, safeStep);\n}\n\n/**\n * Formats step in seconds as a duration string for VictoriaLogs API\n */\nfunction formatStepForVictoriaLogs(stepSeconds: number): string {\n if (stepSeconds < 60) {\n return `${Math.round(stepSeconds)}s`;\n } else if (stepSeconds < 3600) {\n return `${Math.round(stepSeconds / 60)}m`;\n } else {\n return `${Math.round(stepSeconds / 3600)}h`;\n }\n}\n\nfunction convertMatrixToTimeSeries(matrix: VictoriaLogsMatrixResult[]): TimeSeries[] {\n return matrix.map((series) => {\n const { _stream, ...labels } = series.metric;\n if (_stream) {\n const match = _stream.match(/{([^}]+)}/);\n if (match && match[1]) {\n match[1].split(',').forEach((labelPair) => {\n const [key, val] = labelPair.split('=').map((s) => s.trim().replace(/^\"|\"$/g, ''));\n if (key && val) labels[key] = val;\n });\n }\n }\n const name = Object.entries(labels)\n .map(([k, v]) => `${k}=${v}`)\n .join(', ');\n return {\n name: name,\n values: series.values.map(([timestamp, value]) => [\n Number(timestamp) * 1000, // Convert seconds to milliseconds\n Number(value),\n ]),\n labels,\n };\n });\n}\n\nexport const getVictoriaLogsTimeSeriesData: TimeSeriesQueryPlugin<VictoriaLogsTimeSeriesQuerySpec>['getTimeSeriesData'] =\n async (spec, context) => {\n if (!spec.query) {\n return {\n series: [],\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n stepMs: DEFAULT_MIN_STEP_SECONDS * 1000,\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n const client = (await context.datasourceStore.getDatasourceClient<VictoriaLogsClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as VictoriaLogsClient;\n\n const { start, end } = context.timeRange;\n\n const minStepSeconds = spec.step\n ? (getDurationStringSeconds(spec.step as DurationString) ?? DEFAULT_MIN_STEP_SECONDS)\n : DEFAULT_MIN_STEP_SECONDS;\n const stepSeconds = getVictoriaLogsRangeStep(\n start.getTime(),\n end.getTime(),\n minStepSeconds,\n context.suggestedStepMs\n );\n const stepString = formatStepForVictoriaLogs(stepSeconds);\n const stepMs = stepSeconds * 1000;\n\n const response: VictoriaLogsStatsQueryRangeResponse = await client.statsQueryRange({\n query,\n step: stepString,\n start: start.toISOString(),\n end: end.toISOString(),\n });\n\n if (response.status === 'error') {\n throw new Error(response.error);\n }\n\n const series = convertMatrixToTimeSeries(response.data.result as VictoriaLogsMatrixResult[]);\n\n return {\n series: series,\n timeRange: { start, end },\n stepMs,\n metadata: {\n executedQueryString: query,\n },\n };\n };\n"],"names":["replaceVariables","milliseconds","parseDurationString","DEFAULT_DATASOURCE","MAX_VICTORIALOGS_DATA_POINTS","DEFAULT_MIN_STEP_SECONDS","getDurationStringSeconds","durationString","undefined","duration","ms","Math","floor","getVictoriaLogsRangeStep","startMs","endMs","minStepSeconds","suggestedStepMs","suggestedStepSeconds","querySeconds","safeStep","ceil","max","formatStepForVictoriaLogs","stepSeconds","round","convertMatrixToTimeSeries","matrix","map","series","_stream","labels","metric","match","split","forEach","labelPair","key","val","s","trim","replace","name","Object","entries","k","v","join","values","timestamp","value","Number","getVictoriaLogsTimeSeriesData","spec","context","query","timeRange","start","end","stepMs","variableState","client","datasourceStore","getDatasourceClient","datasource","step","getTime","stepString","response","statsQueryRange","toISOString","status","Error","error","data","result","metadata","executedQueryString"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAm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SAAS;IAExC,MAAMxC,iBAAiBqC,KAAKY,IAAI,GAC3B3D,yBAAyB+C,KAAKY,IAAI,KAAuB5D,2BAC1DA;IACJ,MAAMmB,cAAcX,yBAClB4C,MAAMS,OAAO,IACbR,IAAIQ,OAAO,IACXlD,gBACAsC,QAAQrC,eAAe;IAEzB,MAAMkD,aAAa5C,0BAA0BC;IAC7C,MAAMmC,SAASnC,cAAc;IAE7B,MAAM4C,WAAgD,MAAMP,OAAOQ,eAAe,CAAC;QACjFd;QACAU,MAAME;QACNV,OAAOA,MAAMa,WAAW;QACxBZ,KAAKA,IAAIY,WAAW;IACtB;IAEA,IAAIF,SAASG,MAAM,KAAK,SAAS;QAC/B,MAAM,IAAIC,MAAMJ,SAASK,KAAK;IAChC;IAEA,MAAM5C,SAASH,0BAA0B0C,SAASM,IAAI,CAACC,MAAM;IAE7D,OAAO;QACL9C,QAAQA;QACR2B,WAAW;YAAEC;YAAOC;QAAI;QACxBC;QACAiB,UAAU;YACRC,qBAAqBtB;QACvB;IACF;AACF,EAAE"}
@@ -1,4 +1,4 @@
1
- import { DatasourceSelector } from '@perses-dev/core';
1
+ import { DatasourceSelector } from '@perses-dev/spec';
2
2
  export interface VictoriaLogsTimeSeriesQuerySpec {
3
3
  query: string;
4
4
  datasource?: DatasourceSelector;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/victorialogs-time-series-query/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/core';\n\nexport interface VictoriaLogsTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n step?: string;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAIC"}
1
+ {"version":3,"sources":["../../../../src/queries/victorialogs-time-series-query/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/spec';\n\nexport interface VictoriaLogsTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n step?: string;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAIC"}
@@ -1,6 +1,7 @@
1
1
  import { VariableOption } from '@perses-dev/plugin-system';
2
- import { AbsoluteTimeRange, DatasourceSelector, StatusError } from '@perses-dev/core';
3
2
  import { UseQueryResult } from '@tanstack/react-query';
3
+ import { AbsoluteTimeRange, DatasourceSelector } from '@perses-dev/spec';
4
+ import { StatusError } from '@perses-dev/client';
4
5
  import { VictoriaLogsFieldItem, VictoriaLogsFieldNamesResponse, VictoriaLogsFieldValuesResponse } from '../model';
5
6
  export declare const fieldItemsToVariableOptions: (values?: VictoriaLogsFieldItem[]) => VariableOption[];
6
7
  export declare function getVictoriaLogsTimeRange(timeRange: AbsoluteTimeRange): {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/variables/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAqC,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAEL,qBAAqB,EACrB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,2BAA2B,GAAI,SAAS,qBAAqB,EAAE,KAAG,cAAc,EAM5F,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAMrG;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,kBAAkB,GAC7B,cAAc,CAAC,8BAA8B,EAAE,WAAW,CAAC,CAkB7D;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,kBAAkB,GAC7B,cAAc,CAAC,+BAA+B,EAAE,WAAW,CAAC,CAmB9D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/variables/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAqC,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAEL,qBAAqB,EACrB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,2BAA2B,GAAI,SAAS,qBAAqB,EAAE,KAAG,cAAc,EAM5F,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAMrG;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,kBAAkB,GAC7B,cAAc,CAAC,8BAA8B,EAAE,WAAW,CAAC,CAkB7D;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,kBAAkB,GAC7B,cAAc,CAAC,+BAA+B,EAAE,WAAW,CAAC,CAmB9D"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/variables/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariableOption, useDatasourceClient, useTimeRange } from '@perses-dev/plugin-system';\nimport { AbsoluteTimeRange, DatasourceSelector, StatusError } from '@perses-dev/core';\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport {\n VictoriaLogsClient,\n VictoriaLogsFieldItem,\n VictoriaLogsFieldNamesResponse,\n VictoriaLogsFieldValuesResponse,\n} from '../model';\n\nexport const fieldItemsToVariableOptions = (values?: VictoriaLogsFieldItem[]): VariableOption[] => {\n if (!values) return [];\n return values.map((value) => ({\n value: value.value,\n label: value.value,\n }));\n};\n\nexport function getVictoriaLogsTimeRange(timeRange: AbsoluteTimeRange): { start: string; end: string } {\n const { start, end } = timeRange;\n return {\n start: start.toISOString(),\n end: end.toISOString(),\n };\n}\n\nexport function useFieldNames(\n query: string,\n datasource: DatasourceSelector\n): UseQueryResult<VictoriaLogsFieldNamesResponse, StatusError> {\n const {\n absoluteTimeRange: { start, end },\n } = useTimeRange();\n const { data: client } = useDatasourceClient<VictoriaLogsClient>(datasource);\n const enabled = !!client && !!query;\n\n return useQuery<VictoriaLogsFieldNamesResponse, StatusError>({\n enabled: enabled,\n queryKey: ['datasource', datasource.name, 'query', query],\n queryFn: async () => {\n return await client!.fieldNames({\n start: start.toISOString(),\n end: end.toISOString(),\n query: query,\n });\n },\n });\n}\n\nexport function useFieldValues(\n field: string,\n query: string,\n datasource: DatasourceSelector\n): UseQueryResult<VictoriaLogsFieldValuesResponse, StatusError> {\n const {\n absoluteTimeRange: { start, end },\n } = useTimeRange();\n const { data: client } = useDatasourceClient<VictoriaLogsClient>(datasource);\n const enabled = !!client && !!query;\n\n return useQuery<VictoriaLogsFieldValuesResponse, StatusError>({\n enabled: enabled,\n queryKey: ['field', field, 'datasource', datasource.name, 'query', query],\n queryFn: async () => {\n return await client!.fieldValues({\n query: query,\n field: field,\n start: start.toISOString(),\n end: end.toISOString(),\n });\n },\n });\n}\n"],"names":["useDatasourceClient","useTimeRange","useQuery","fieldItemsToVariableOptions","values","map","value","label","getVictoriaLogsTimeRange","timeRange","start","end","toISOString","useFieldNames","query","datasource","absoluteTimeRange","data","client","enabled","queryKey","name","queryFn","fieldNames","useFieldValues","field","fieldValues"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAyBA,mBAAmB,EAAEC,YAAY,QAAQ,4BAA4B;AAE9F,SAASC,QAAQ,QAAwB,wBAAwB;AAQjE,OAAO,MAA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gBACPW,OAAOA;gBACPf,OAAOA,MAAME,WAAW;gBACxBD,KAAKA,IAAIC,WAAW;YACtB;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/variables/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariableOption, useDatasourceClient, useTimeRange } from '@perses-dev/plugin-system';\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, DatasourceSelector } from '@perses-dev/spec';\nimport { StatusError } from '@perses-dev/client';\nimport {\n VictoriaLogsClient,\n VictoriaLogsFieldItem,\n VictoriaLogsFieldNamesResponse,\n VictoriaLogsFieldValuesResponse,\n} from '../model';\n\nexport const fieldItemsToVariableOptions = (values?: VictoriaLogsFieldItem[]): VariableOption[] => {\n if (!values) return [];\n return values.map((value) => ({\n value: value.value,\n label: value.value,\n }));\n};\n\nexport function getVictoriaLogsTimeRange(timeRange: AbsoluteTimeRange): { start: string; end: string } {\n const { start, end } = timeRange;\n return {\n start: start.toISOString(),\n end: end.toISOString(),\n };\n}\n\nexport function useFieldNames(\n query: string,\n datasource: DatasourceSelector\n): UseQueryResult<VictoriaLogsFieldNamesResponse, StatusError> {\n const {\n absoluteTimeRange: { start, end },\n } = useTimeRange();\n const { data: client } = useDatasourceClient<VictoriaLogsClient>(datasource);\n const enabled = !!client && !!query;\n\n return useQuery<VictoriaLogsFieldNamesResponse, StatusError>({\n enabled: enabled,\n queryKey: ['datasource', datasource.name, 'query', query],\n queryFn: async () => {\n return await client!.fieldNames({\n start: start.toISOString(),\n end: end.toISOString(),\n query: query,\n });\n },\n });\n}\n\nexport function useFieldValues(\n field: string,\n query: string,\n datasource: DatasourceSelector\n): UseQueryResult<VictoriaLogsFieldValuesResponse, StatusError> {\n const {\n absoluteTimeRange: { start, end },\n } = useTimeRange();\n const { data: client } = useDatasourceClient<VictoriaLogsClient>(datasource);\n const enabled = !!client && !!query;\n\n return useQuery<VictoriaLogsFieldValuesResponse, StatusError>({\n enabled: enabled,\n queryKey: ['field', field, 'datasource', datasource.name, 'query', query],\n queryFn: async () => {\n return await client!.fieldValues({\n query: query,\n field: field,\n start: start.toISOString(),\n end: end.toISOString(),\n });\n },\n });\n}\n"],"names":["useDatasourceClient","useTimeRange","useQuery","fieldItemsToVariableOptions","values","map","value","label","getVictoriaLogsTimeRange","timeRange","start","end","toISOString","useFieldNames","query","datasource","absoluteTimeRange","data","client","enabled","queryKey","name","queryFn","fieldNames","useFieldValues","field","fieldValues"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAyBA,mBAAmB,EAAEC,YAAY,QAAQ,4BAA4B;AAC9F,SAASC,QAAQ,QAAwB,wBAAwB;AAUjE,OAAO,MAAMC,8BAA8B,CAACC;IAC1C,IAAI,CAACA,QAAQ,OAAO,EAAE;IACtB,OAAOA,OAAOC,GAAG,CAAC,CAACC,QAAW,CAAA;YAC5BA,OAAOA,MAAMA,KAAK;YAClBC,OAAOD,MAAMA,KAAK;QACpB,CAAA;AACF,EAAE;AAEF,OAAO,SAASE,yBAAyBC,SAA4B;IACnE,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAE,GAAGF;IACvB,OAAO;QACLC,OAAOA,MAAME,WAAW;QACxBD,KAAKA,IAAIC,WAAW;IACtB;AACF;AAEA,OAAO,SAASC,cACdC,KAAa,EACbC,UAA8B;I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