@perses-dev/greptimedb-plugin 0.1.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 (331) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/8077.85c2cbf6.css +1 -0
  4. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  5. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  6. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  8. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  10. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  11. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  12. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  13. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  14. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  17. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  18. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  26. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  27. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  28. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  29. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  30. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  31. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  32. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  33. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  34. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  35. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  36. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  37. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  38. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  39. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  40. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  42. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  43. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  44. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  45. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  47. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  49. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  50. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  51. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  52. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  53. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  54. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  55. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  56. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  57. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  58. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  59. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  60. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  61. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  62. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  63. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  64. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  66. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  67. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  68. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  69. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  70. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  71. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  72. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  73. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  74. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  75. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  77. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  79. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  80. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  82. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  83. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  84. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  85. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  86. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  87. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  88. package/__mf/js/GreptimeDB.7a063e9e.js +7 -0
  89. package/__mf/js/async/1616.20d43f7e.js +1 -0
  90. package/__mf/js/async/2043.97b1f27f.js +2 -0
  91. package/__mf/js/async/2043.97b1f27f.js.LICENSE.txt +24 -0
  92. package/__mf/js/async/2269.f1322789.js +3 -0
  93. package/__mf/js/async/2386.b7243314.js +2 -0
  94. package/__mf/js/async/2386.b7243314.js.LICENSE.txt +9 -0
  95. package/__mf/js/async/3181.7ac30201.js +2 -0
  96. package/__mf/js/async/3181.7ac30201.js.LICENSE.txt +9 -0
  97. package/__mf/js/async/3247.65183b95.js +2 -0
  98. package/__mf/js/async/3247.65183b95.js.LICENSE.txt +37 -0
  99. package/__mf/js/async/392.91ae0e19.js +2 -0
  100. package/__mf/js/async/392.91ae0e19.js.LICENSE.txt +8 -0
  101. package/__mf/js/async/3944.12d0f358.js +10 -0
  102. package/__mf/js/async/3944.12d0f358.js.LICENSE.txt +17 -0
  103. package/__mf/js/async/4121.06b9cab6.js +2 -0
  104. package/__mf/js/async/4121.06b9cab6.js.LICENSE.txt +9 -0
  105. package/__mf/js/async/5002.0a422150.js +1 -0
  106. package/__mf/js/async/5071.e5cc2bd7.js +1 -0
  107. package/__mf/js/async/5402.eda0fb07.js +101 -0
  108. package/__mf/js/async/5440.7abefadb.js +2 -0
  109. package/__mf/js/async/5440.7abefadb.js.LICENSE.txt +32 -0
  110. package/__mf/js/async/5562.a39a5d1e.js +2 -0
  111. package/__mf/js/async/5562.a39a5d1e.js.LICENSE.txt +9 -0
  112. package/__mf/js/async/5587.a3fb718a.js +1 -0
  113. package/__mf/js/async/6045.10e9fa5a.js +1 -0
  114. package/__mf/js/async/6274.6f0093e7.js +2 -0
  115. package/__mf/js/async/6274.6f0093e7.js.LICENSE.txt +8 -0
  116. package/__mf/js/async/6753.1e42e819.js +1 -0
  117. package/__mf/js/async/7177.78bced1c.js +1 -0
  118. package/__mf/js/async/7192.e0362dae.js +1 -0
  119. package/__mf/js/async/7862.8048abcc.js +2 -0
  120. package/__mf/js/async/7862.8048abcc.js.LICENSE.txt +9 -0
  121. package/__mf/js/async/7968.7b2e2836.js +1 -0
  122. package/__mf/js/async/7978.8cd67008.js +1 -0
  123. package/__mf/js/async/8077.fe9828a3.js +7 -0
  124. package/__mf/js/async/8077.fe9828a3.js.LICENSE.txt +39 -0
  125. package/__mf/js/async/8356.ac21fc24.js +1 -0
  126. package/__mf/js/async/8470.a2e67e3a.js +2 -0
  127. package/__mf/js/async/8470.a2e67e3a.js.LICENSE.txt +19 -0
  128. package/__mf/js/async/873.863f53e4.js +1 -0
  129. package/__mf/js/async/9235.7651eaca.js +1 -0
  130. package/__mf/js/async/941.4155d3cc.js +2 -0
  131. package/__mf/js/async/941.4155d3cc.js.LICENSE.txt +9 -0
  132. package/__mf/js/async/9558.215ad80c.js +1 -0
  133. package/__mf/js/async/9588.2f544a41.js +1 -0
  134. package/__mf/js/async/9877.8766524e.js +38 -0
  135. package/__mf/js/async/9916.2a1eb7a0.js +22 -0
  136. package/__mf/js/async/9916.2a1eb7a0.js.LICENSE.txt +19 -0
  137. package/__mf/js/async/__federation_expose_GreptimeDBDatasource.bf1dec3c.js +2 -0
  138. package/__mf/js/async/__federation_expose_GreptimeDBDatasource.bf1dec3c.js.LICENSE.txt +9 -0
  139. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.d80b2965.js +21 -0
  140. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.d80b2965.js.LICENSE.txt +9 -0
  141. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.59cda507.js +21 -0
  142. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.59cda507.js.LICENSE.txt +9 -0
  143. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.00464f43.js +21 -0
  144. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.00464f43.js.LICENSE.txt +9 -0
  145. package/__mf/js/main.a4e4afce.js +7 -0
  146. package/lib/bootstrap.d.ts +2 -0
  147. package/lib/bootstrap.d.ts.map +1 -0
  148. package/lib/bootstrap.js +19 -0
  149. package/lib/bootstrap.js.map +1 -0
  150. package/lib/cjs/bootstrap.js +26 -0
  151. package/lib/cjs/components/GreptimeDBQLEditor.js +72 -0
  152. package/lib/cjs/components/constants.js +42 -0
  153. package/lib/cjs/components/index.js +31 -0
  154. package/lib/cjs/datasources/greptimedb-datasource/GreptimeDBDatasource.js +53 -0
  155. package/lib/cjs/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js +51 -0
  156. package/lib/cjs/datasources/greptimedb-datasource/greptimedb-datasource-types.js +16 -0
  157. package/lib/cjs/datasources/greptimedb-datasource/index.js +32 -0
  158. package/lib/cjs/datasources/index.js +30 -0
  159. package/lib/cjs/env.d.js +14 -0
  160. package/lib/cjs/getPluginModule.js +39 -0
  161. package/lib/cjs/index-federation.js +55 -0
  162. package/lib/cjs/index.js +38 -0
  163. package/lib/cjs/model/greptimedb-client.js +76 -0
  164. package/lib/cjs/model/greptimedb-data-types.js +16 -0
  165. package/lib/cjs/queries/constants.js +34 -0
  166. package/lib/cjs/queries/greptimedb-log-query/GreptimeDBLogQuery.js +43 -0
  167. package/lib/cjs/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js +108 -0
  168. package/lib/cjs/queries/greptimedb-log-query/get-greptimedb-log-data.js +103 -0
  169. package/lib/cjs/queries/greptimedb-log-query/greptimedb-log-query-types.js +16 -0
  170. package/lib/cjs/queries/greptimedb-log-query/index.js +33 -0
  171. package/lib/cjs/queries/greptimedb-log-query/log-query-plugin-interface.js +16 -0
  172. package/lib/cjs/queries/greptimedb-query-data-model.js +152 -0
  173. package/lib/cjs/queries/greptimedb-time-series-query/GreptimeDBQuery.js +43 -0
  174. package/lib/cjs/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js +107 -0
  175. package/lib/cjs/queries/greptimedb-time-series-query/get-greptimedb-data.js +184 -0
  176. package/lib/cjs/queries/greptimedb-time-series-query/greptimedb-query-types.js +16 -0
  177. package/lib/cjs/queries/greptimedb-time-series-query/index.js +33 -0
  178. package/lib/cjs/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js +40 -0
  179. package/lib/cjs/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js +79 -0
  180. package/lib/cjs/queries/greptimedb-trace-query/get-greptimedb-trace-data.js +518 -0
  181. package/lib/cjs/queries/greptimedb-trace-query/greptimedb-trace-query-types.js +16 -0
  182. package/lib/cjs/queries/greptimedb-trace-query/index.js +33 -0
  183. package/lib/cjs/queries/greptimedb-trace-query/trace-query-sql.js +25 -0
  184. package/lib/cjs/queries/index.js +32 -0
  185. package/lib/cjs/queries/query-editor-model.js +47 -0
  186. package/lib/cjs/setup-tests.js +19 -0
  187. package/lib/components/GreptimeDBQLEditor.d.ts +4 -0
  188. package/lib/components/GreptimeDBQLEditor.d.ts.map +1 -0
  189. package/lib/components/GreptimeDBQLEditor.js +59 -0
  190. package/lib/components/GreptimeDBQLEditor.js.map +1 -0
  191. package/lib/components/constants.d.ts +2 -0
  192. package/lib/components/constants.d.ts.map +1 -0
  193. package/lib/components/constants.js +34 -0
  194. package/lib/components/constants.js.map +1 -0
  195. package/lib/components/index.d.ts +3 -0
  196. package/lib/components/index.d.ts.map +1 -0
  197. package/lib/components/index.js +16 -0
  198. package/lib/components/index.js.map +1 -0
  199. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.d.ts +4 -0
  200. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.d.ts.map +1 -0
  201. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.js +45 -0
  202. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.js.map +1 -0
  203. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.d.ts +9 -0
  204. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.d.ts.map +1 -0
  205. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js +43 -0
  206. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js.map +1 -0
  207. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.d.ts +29 -0
  208. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.d.ts.map +1 -0
  209. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.js +15 -0
  210. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.js.map +1 -0
  211. package/lib/datasources/greptimedb-datasource/index.d.ts +4 -0
  212. package/lib/datasources/greptimedb-datasource/index.d.ts.map +1 -0
  213. package/lib/datasources/greptimedb-datasource/index.js +17 -0
  214. package/lib/datasources/greptimedb-datasource/index.js.map +1 -0
  215. package/lib/datasources/index.d.ts +2 -0
  216. package/lib/datasources/index.d.ts.map +1 -0
  217. package/lib/datasources/index.js +15 -0
  218. package/lib/datasources/index.js.map +1 -0
  219. package/lib/env.d.js +15 -0
  220. package/lib/env.d.js.map +1 -0
  221. package/lib/getPluginModule.d.ts +6 -0
  222. package/lib/getPluginModule.d.ts.map +1 -0
  223. package/lib/getPluginModule.js +28 -0
  224. package/lib/getPluginModule.js.map +1 -0
  225. package/lib/index-federation.d.ts +1 -0
  226. package/lib/index-federation.d.ts.map +1 -0
  227. package/lib/index-federation.js +15 -0
  228. package/lib/index-federation.js.map +1 -0
  229. package/lib/index.d.ts +4 -0
  230. package/lib/index.d.ts.map +1 -0
  231. package/lib/index.js +17 -0
  232. package/lib/index.js.map +1 -0
  233. package/lib/model/greptimedb-client.d.ts +17 -0
  234. package/lib/model/greptimedb-client.d.ts.map +1 -0
  235. package/lib/model/greptimedb-client.js +68 -0
  236. package/lib/model/greptimedb-client.js.map +1 -0
  237. package/lib/model/greptimedb-data-types.d.ts +21 -0
  238. package/lib/model/greptimedb-data-types.d.ts.map +1 -0
  239. package/lib/model/greptimedb-data-types.js +15 -0
  240. package/lib/model/greptimedb-data-types.js.map +1 -0
  241. package/lib/queries/constants.d.ts +5 -0
  242. package/lib/queries/constants.d.ts.map +1 -0
  243. package/lib/queries/constants.js +18 -0
  244. package/lib/queries/constants.js.map +1 -0
  245. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.d.ts +4 -0
  246. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.d.ts.map +1 -0
  247. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.js +35 -0
  248. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.js.map +1 -0
  249. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.d.ts +7 -0
  250. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.d.ts.map +1 -0
  251. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js +100 -0
  252. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js.map +1 -0
  253. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.d.ts +4 -0
  254. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.d.ts.map +1 -0
  255. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.js +95 -0
  256. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.js.map +1 -0
  257. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.d.ts +6 -0
  258. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.d.ts.map +1 -0
  259. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.js +15 -0
  260. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.js.map +1 -0
  261. package/lib/queries/greptimedb-log-query/index.d.ts +5 -0
  262. package/lib/queries/greptimedb-log-query/index.d.ts.map +1 -0
  263. package/lib/queries/greptimedb-log-query/index.js +18 -0
  264. package/lib/queries/greptimedb-log-query/index.js.map +1 -0
  265. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.d.ts +23 -0
  266. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.d.ts.map +1 -0
  267. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.js +15 -0
  268. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.js.map +1 -0
  269. package/lib/queries/greptimedb-query-data-model.d.ts +18 -0
  270. package/lib/queries/greptimedb-query-data-model.d.ts.map +1 -0
  271. package/lib/queries/greptimedb-query-data-model.js +138 -0
  272. package/lib/queries/greptimedb-query-data-model.js.map +1 -0
  273. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.d.ts +4 -0
  274. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.d.ts.map +1 -0
  275. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.js +35 -0
  276. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.js.map +1 -0
  277. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.d.ts +7 -0
  278. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.d.ts.map +1 -0
  279. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js +99 -0
  280. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js.map +1 -0
  281. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.d.ts +4 -0
  282. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.d.ts.map +1 -0
  283. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.js +176 -0
  284. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.js.map +1 -0
  285. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.d.ts +7 -0
  286. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.d.ts.map +1 -0
  287. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.js +15 -0
  288. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.js.map +1 -0
  289. package/lib/queries/greptimedb-time-series-query/index.d.ts +5 -0
  290. package/lib/queries/greptimedb-time-series-query/index.d.ts.map +1 -0
  291. package/lib/queries/greptimedb-time-series-query/index.js +18 -0
  292. package/lib/queries/greptimedb-time-series-query/index.js.map +1 -0
  293. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.d.ts +4 -0
  294. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.d.ts.map +1 -0
  295. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js +32 -0
  296. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js.map +1 -0
  297. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.d.ts +7 -0
  298. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.d.ts.map +1 -0
  299. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js +71 -0
  300. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js.map +1 -0
  301. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.d.ts +11 -0
  302. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.d.ts.map +1 -0
  303. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.js +466 -0
  304. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.js.map +1 -0
  305. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.d.ts +6 -0
  306. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.d.ts.map +1 -0
  307. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.js +15 -0
  308. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.js.map +1 -0
  309. package/lib/queries/greptimedb-trace-query/index.d.ts +5 -0
  310. package/lib/queries/greptimedb-trace-query/index.d.ts.map +1 -0
  311. package/lib/queries/greptimedb-trace-query/index.js +18 -0
  312. package/lib/queries/greptimedb-trace-query/index.js.map +1 -0
  313. package/lib/queries/greptimedb-trace-query/trace-query-sql.d.ts +2 -0
  314. package/lib/queries/greptimedb-trace-query/trace-query-sql.d.ts.map +1 -0
  315. package/lib/queries/greptimedb-trace-query/trace-query-sql.js +17 -0
  316. package/lib/queries/greptimedb-trace-query/trace-query-sql.js.map +1 -0
  317. package/lib/queries/index.d.ts +4 -0
  318. package/lib/queries/index.d.ts.map +1 -0
  319. package/lib/queries/index.js +17 -0
  320. package/lib/queries/index.js.map +1 -0
  321. package/lib/queries/query-editor-model.d.ts +19 -0
  322. package/lib/queries/query-editor-model.d.ts.map +1 -0
  323. package/lib/queries/query-editor-model.js +44 -0
  324. package/lib/queries/query-editor-model.js.map +1 -0
  325. package/lib/setup-tests.d.ts +2 -0
  326. package/lib/setup-tests.d.ts.map +1 -0
  327. package/lib/setup-tests.js +17 -0
  328. package/lib/setup-tests.js.map +1 -0
  329. package/mf-manifest.json +462 -0
  330. package/mf-stats.json +530 -0
  331. package/package.json +86 -0
@@ -0,0 +1,518 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
+ });
22
+ }
23
+ _export(exports, {
24
+ get getGreptimeDBTraceData () {
25
+ return getGreptimeDBTraceData;
26
+ },
27
+ get toNanoString () {
28
+ return toNanoString;
29
+ }
30
+ });
31
+ const _pluginsystem = require("@perses-dev/plugin-system");
32
+ const _trace = /*#__PURE__*/ _interop_require_wildcard(require("@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace"));
33
+ const _constants = require("../constants");
34
+ const _greptimedbquerydatamodel = require("../greptimedb-query-data-model");
35
+ const _tracequerysql = require("./trace-query-sql");
36
+ function _getRequireWildcardCache(nodeInterop) {
37
+ if (typeof WeakMap !== "function") return null;
38
+ var cacheBabelInterop = new WeakMap();
39
+ var cacheNodeInterop = new WeakMap();
40
+ return (_getRequireWildcardCache = function(nodeInterop) {
41
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
42
+ })(nodeInterop);
43
+ }
44
+ function _interop_require_wildcard(obj, nodeInterop) {
45
+ if (!nodeInterop && obj && obj.__esModule) {
46
+ return obj;
47
+ }
48
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
49
+ return {
50
+ default: obj
51
+ };
52
+ }
53
+ var cache = _getRequireWildcardCache(nodeInterop);
54
+ if (cache && cache.has(obj)) {
55
+ return cache.get(obj);
56
+ }
57
+ var newObj = {
58
+ __proto__: null
59
+ };
60
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
61
+ for(var key in obj){
62
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
63
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
64
+ if (desc && (desc.get || desc.set)) {
65
+ Object.defineProperty(newObj, key, desc);
66
+ } else {
67
+ newObj[key] = obj[key];
68
+ }
69
+ }
70
+ }
71
+ newObj.default = obj;
72
+ if (cache) {
73
+ cache.set(obj, newObj);
74
+ }
75
+ return newObj;
76
+ }
77
+ const getGreptimeDBTraceData = async (spec, context)=>{
78
+ const rawQuery = (0, _pluginsystem.replaceVariables)(spec.query ?? '', context.variableState).trim();
79
+ if (rawQuery.length === 0) {
80
+ return {
81
+ searchResult: []
82
+ };
83
+ }
84
+ const datasourceSelector = normalizeDatasourceSelector(spec.datasource);
85
+ const client = await context.datasourceStore.getDatasourceClient(datasourceSelector ?? _constants.DEFAULT_DATASOURCE);
86
+ const start = context.absoluteTimeRange?.start.getTime().toString() ?? '0';
87
+ const end = context.absoluteTimeRange?.end.getTime().toString() ?? '0';
88
+ const response = await client.query({
89
+ query: rawQuery,
90
+ start,
91
+ end
92
+ });
93
+ if (response.status === 'error') {
94
+ throw new Error(response.error ?? 'GreptimeDB trace query failed');
95
+ }
96
+ const records = (0, _greptimedbquerydatamodel.normalizeRecords)(response.data);
97
+ const isDetailQuery = (0, _tracequerysql.isLikelyTraceDetailSQL)(rawQuery);
98
+ if (isDetailQuery && isTraceDetailsResult(records)) {
99
+ return {
100
+ trace: convertRowsToTrace(records),
101
+ metadata: {
102
+ executedQueryString: rawQuery
103
+ }
104
+ };
105
+ }
106
+ return {
107
+ searchResult: buildSearchResult(records),
108
+ metadata: {
109
+ executedQueryString: rawQuery
110
+ }
111
+ };
112
+ };
113
+ function normalizeDatasourceSelector(datasource) {
114
+ if (!datasource) {
115
+ return undefined;
116
+ }
117
+ // Deep links may carry an empty datasource name. Treat it as "default datasource for this kind".
118
+ if (typeof datasource.name === 'string' && datasource.name.trim() === '') {
119
+ const { kind } = datasource;
120
+ return kind ? {
121
+ kind
122
+ } : undefined;
123
+ }
124
+ return datasource;
125
+ }
126
+ function buildColumnIndexMap(columns) {
127
+ const map = {};
128
+ (columns ?? []).forEach((c, index)=>{
129
+ map[c.name.toLowerCase()] = index;
130
+ });
131
+ return map;
132
+ }
133
+ /** GreptimeDB /v1/sql includes data_type on every column_schemas entry. */ function getColumnDataType(columns, index) {
134
+ const column = columns[index];
135
+ if (!column) {
136
+ throw new Error(`GreptimeDB SQL response missing column at index ${index}`);
137
+ }
138
+ const dataType = column.data_type;
139
+ if (!dataType) {
140
+ throw new Error(`GreptimeDB SQL response missing data_type for column "${column.name}"`);
141
+ }
142
+ return dataType;
143
+ }
144
+ function isTraceDetailsResult(records) {
145
+ const columns = records?.schema?.column_schemas ?? [];
146
+ if (columns.length === 0) return false;
147
+ const map = buildColumnIndexMap(columns);
148
+ // Trace detail queries should return span-level columns for gantt visualization.
149
+ return map.trace_id !== undefined && map.span_id !== undefined;
150
+ }
151
+ function getCell(row, map, names) {
152
+ for (const name of names){
153
+ const idx = map[name.toLowerCase()];
154
+ if (idx !== undefined) {
155
+ return row[idx];
156
+ }
157
+ }
158
+ return undefined;
159
+ }
160
+ function getString(value) {
161
+ if (value === null || value === undefined) return undefined;
162
+ return String(value);
163
+ }
164
+ function getNumber(value) {
165
+ if (value === null || value === undefined) return undefined;
166
+ if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
167
+ const parsed = Number(value);
168
+ return Number.isFinite(parsed) ? parsed : undefined;
169
+ }
170
+ function isErrorStatus(value) {
171
+ const normalized = String(value ?? '').trim().toUpperCase();
172
+ return normalized === 'STATUS_CODE_ERROR' || normalized === 'ERROR' || normalized === '2';
173
+ }
174
+ function getDurationMs(row, columns, map) {
175
+ const durationMs = getNumber(getCell(row, map, [
176
+ 'duration_ms'
177
+ ]));
178
+ if (durationMs !== undefined) return durationMs;
179
+ const durationNano = getNumber(getCell(row, map, [
180
+ 'duration_nano',
181
+ 'duration_ns'
182
+ ]));
183
+ if (durationNano !== undefined) return durationNano / 1_000_000;
184
+ const startIndex = map.timestamp ?? map.start_time ?? map.start_time_unix_nano;
185
+ const endIndex = map.timestamp_end ?? map.end_time ?? map.end_time_unix_nano;
186
+ if (columns && startIndex !== undefined && endIndex !== undefined) {
187
+ const startMs = (0, _greptimedbquerydatamodel.toTimestampMs)(row[startIndex], getColumnDataType(columns, startIndex));
188
+ const endMs = (0, _greptimedbquerydatamodel.toTimestampMs)(row[endIndex], getColumnDataType(columns, endIndex));
189
+ if (startMs !== null && endMs !== null) return Math.max(0, endMs - startMs);
190
+ }
191
+ return 0;
192
+ }
193
+ function getStartMs(row, columns, map) {
194
+ const candidates = [
195
+ 'timestamp',
196
+ 'start_time',
197
+ 'start_time_unix_nano',
198
+ 'start_time_unix_ns',
199
+ 'start_time_unix_ms',
200
+ 'start_time_unix'
201
+ ];
202
+ for (const c of candidates){
203
+ const idx = map[c];
204
+ if (idx === undefined) continue;
205
+ if (!columns) continue;
206
+ const ts = (0, _greptimedbquerydatamodel.toTimestampMs)(row[idx], getColumnDataType(columns, idx));
207
+ if (ts !== null) return ts;
208
+ }
209
+ return undefined;
210
+ }
211
+ function getEndMs(row, columns, map) {
212
+ const candidates = [
213
+ 'timestamp_end',
214
+ 'end_time',
215
+ 'end_time_unix_nano',
216
+ 'end_time_unix_ns',
217
+ 'end_time_unix_ms'
218
+ ];
219
+ for (const c of candidates){
220
+ const idx = map[c];
221
+ if (idx === undefined) continue;
222
+ if (!columns) continue;
223
+ const ts = (0, _greptimedbquerydatamodel.toTimestampMs)(row[idx], getColumnDataType(columns, idx));
224
+ if (ts !== null) return ts;
225
+ }
226
+ return undefined;
227
+ }
228
+ function buildSearchResult(records) {
229
+ const columns = records?.schema?.column_schemas ?? [];
230
+ const rows = records?.rows ?? [];
231
+ if (!columns.length || !rows.length) return [];
232
+ const map = buildColumnIndexMap(columns);
233
+ const traceMap = new Map();
234
+ rows.forEach((row)=>{
235
+ const traceId = getString(getCell(row, map, [
236
+ 'trace_id',
237
+ 'traceid',
238
+ 'traceId'
239
+ ]));
240
+ if (!traceId) return;
241
+ const startMs = getStartMs(row, columns, map);
242
+ const durationMs = getDurationMs(row, columns, map);
243
+ const endMs = getEndMs(row, columns, map) ?? (startMs !== undefined ? startMs + durationMs : undefined);
244
+ const serviceName = getString(getCell(row, map, [
245
+ 'service_name',
246
+ 'root_service_name'
247
+ ])) ?? 'unknown';
248
+ const spanName = getString(getCell(row, map, [
249
+ 'span_name',
250
+ 'root_trace_name',
251
+ 'operation_name',
252
+ 'name'
253
+ ])) ?? '(unknown span)';
254
+ const parentSpanId = getString(getCell(row, map, [
255
+ 'parent_span_id',
256
+ 'parentspanid',
257
+ 'parentSpanId'
258
+ ]));
259
+ const existing = traceMap.get(traceId);
260
+ if (!existing) {
261
+ traceMap.set(traceId, {
262
+ traceId,
263
+ startTimeUnixMs: startMs ?? 0,
264
+ endTimeUnixMs: endMs ?? startMs ?? 0,
265
+ rootServiceName: serviceName,
266
+ rootTraceName: spanName,
267
+ serviceStats: {
268
+ [serviceName]: {
269
+ spanCount: 1,
270
+ errorCount: isErrorStatus(getCell(row, map, [
271
+ 'span_status_code',
272
+ 'status_code'
273
+ ])) ? 1 : 0
274
+ }
275
+ }
276
+ });
277
+ return;
278
+ }
279
+ if (startMs !== undefined) {
280
+ existing.startTimeUnixMs = existing.startTimeUnixMs === 0 ? startMs : Math.min(existing.startTimeUnixMs, startMs);
281
+ }
282
+ if (endMs !== undefined) {
283
+ existing.endTimeUnixMs = Math.max(existing.endTimeUnixMs, endMs);
284
+ }
285
+ if (!parentSpanId) {
286
+ existing.rootTraceName = spanName;
287
+ existing.rootServiceName = serviceName;
288
+ }
289
+ if (!existing.serviceStats[serviceName]) {
290
+ existing.serviceStats[serviceName] = {
291
+ spanCount: 0,
292
+ errorCount: 0
293
+ };
294
+ }
295
+ existing.serviceStats[serviceName].spanCount += 1;
296
+ if (isErrorStatus(getCell(row, map, [
297
+ 'span_status_code',
298
+ 'status_code'
299
+ ]))) {
300
+ existing.serviceStats[serviceName].errorCount += 1;
301
+ }
302
+ });
303
+ return Array.from(traceMap.values()).map((entry)=>({
304
+ traceId: entry.traceId,
305
+ startTimeUnixMs: entry.startTimeUnixMs,
306
+ durationMs: Math.max(0, entry.endTimeUnixMs - entry.startTimeUnixMs),
307
+ rootServiceName: entry.rootServiceName,
308
+ rootTraceName: entry.rootTraceName,
309
+ serviceStats: entry.serviceStats
310
+ })).sort((a, b)=>b.startTimeUnixMs - a.startTimeUnixMs);
311
+ }
312
+ function isIntegerGreptimeDataType(dataType) {
313
+ const normalized = dataType.toLowerCase();
314
+ return normalized.includes('int') || normalized.includes('uint') || normalized === 'bigint';
315
+ }
316
+ /**
317
+ * span_events JSON only: OTLP timeUnixNano is already nanoseconds (not a GreptimeDB TIMESTAMP column).
318
+ * @see https://docs.greptime.com/user-guide/traces/data-model/
319
+ */ function otlpEventTimeToNanoString(value) {
320
+ if (value === undefined || value === null) return undefined;
321
+ const raw = getNumber(value);
322
+ if (raw !== undefined) return String(BigInt(Math.trunc(raw)));
323
+ const dateMs = new Date(String(value)).getTime();
324
+ if (!Number.isNaN(dateMs)) return String(BigInt(Math.trunc(dateMs)) * 1_000_000n);
325
+ return undefined;
326
+ }
327
+ function toNanoString(value, dataType) {
328
+ if (value === undefined || value === null) return undefined;
329
+ const raw = getNumber(value);
330
+ if (raw === undefined) return undefined;
331
+ const normalized = dataType.toLowerCase();
332
+ if (normalized.includes('nanosecond')) return String(BigInt(Math.trunc(raw)));
333
+ if (normalized.includes('microsecond')) return String(BigInt(Math.trunc(raw)) * 1000n);
334
+ if (normalized.includes('millisecond')) return String(BigInt(Math.trunc(raw)) * 1_000_000n);
335
+ if (normalized.includes('second')) return String(BigInt(Math.trunc(raw)) * 1_000_000_000n);
336
+ if (isIntegerGreptimeDataType(dataType)) return String(BigInt(Math.trunc(raw)));
337
+ throw new Error(`Unsupported GreptimeDB data_type: ${dataType}`);
338
+ }
339
+ function parseJsonArray(value) {
340
+ if (Array.isArray(value)) return value;
341
+ if (typeof value === 'string') {
342
+ try {
343
+ const parsed = JSON.parse(value);
344
+ return Array.isArray(parsed) ? parsed : [];
345
+ } catch {
346
+ return [];
347
+ }
348
+ }
349
+ return [];
350
+ }
351
+ function toAnyValue(value) {
352
+ return {
353
+ stringValue: typeof value === 'string' ? value : JSON.stringify(value)
354
+ };
355
+ }
356
+ function toKeyValue(key, value) {
357
+ return {
358
+ key,
359
+ value: toAnyValue(value)
360
+ };
361
+ }
362
+ function parseStatusCode(value) {
363
+ const normalized = String(value ?? '').trim().toUpperCase();
364
+ if (!normalized) return undefined;
365
+ if (normalized === 'STATUS_CODE_OK' || normalized === 'OK' || normalized === '1') {
366
+ return _trace.StatusCodeOk;
367
+ }
368
+ if (normalized === 'STATUS_CODE_ERROR' || normalized === 'ERROR' || normalized === '2') {
369
+ return _trace.StatusCodeError;
370
+ }
371
+ return _trace.StatusCodeUnset;
372
+ }
373
+ function convertRowsToTrace(records) {
374
+ const columns = records?.schema?.column_schemas ?? [];
375
+ const rows = records?.rows ?? [];
376
+ if (!columns.length || !rows.length) return {
377
+ resourceSpans: []
378
+ };
379
+ const map = buildColumnIndexMap(columns);
380
+ const spanColumns = columns.filter((col)=>col.name.startsWith('span_attributes.'));
381
+ const resourceColumns = columns.filter((col)=>col.name.startsWith('resource_attributes.'));
382
+ const byService = new Map();
383
+ rows.forEach((row)=>{
384
+ const traceId = getString(getCell(row, map, [
385
+ 'trace_id',
386
+ 'traceid',
387
+ 'traceId'
388
+ ]));
389
+ const spanId = getString(getCell(row, map, [
390
+ 'span_id',
391
+ 'spanid',
392
+ 'spanId'
393
+ ]));
394
+ if (!traceId || !spanId) return;
395
+ const parentSpanId = getString(getCell(row, map, [
396
+ 'parent_span_id',
397
+ 'parentspanid',
398
+ 'parentSpanId'
399
+ ]));
400
+ const name = getString(getCell(row, map, [
401
+ 'span_name',
402
+ 'name',
403
+ 'operation_name'
404
+ ])) ?? '(unknown span)';
405
+ const kind = getString(getCell(row, map, [
406
+ 'span_kind',
407
+ 'kind'
408
+ ])) ?? 'SPAN_KIND_UNSPECIFIED';
409
+ const serviceName = getString(getCell(row, map, [
410
+ 'service_name'
411
+ ])) ?? 'unknown';
412
+ const scopeName = getString(getCell(row, map, [
413
+ 'scope_name'
414
+ ])) ?? '';
415
+ const scopeVersion = getString(getCell(row, map, [
416
+ 'scope_version'
417
+ ])) ?? '';
418
+ const startIndex = map.timestamp ?? map.start_time ?? map.start_time_unix_nano;
419
+ const endIndex = map.timestamp_end ?? map.end_time ?? map.end_time_unix_nano;
420
+ const durationIndex = map.duration_nano ?? map.duration_ns;
421
+ const startTimeUnixNano = startIndex !== undefined ? toNanoString(row[startIndex], getColumnDataType(columns, startIndex)) ?? '0' : '0';
422
+ const endTimeUnixNano = (endIndex !== undefined ? toNanoString(row[endIndex], getColumnDataType(columns, endIndex)) ?? '0' : undefined) ?? (durationIndex !== undefined ? String(BigInt(startTimeUnixNano) + BigInt(toNanoString(row[durationIndex], getColumnDataType(columns, durationIndex)) ?? '0')) : startTimeUnixNano);
423
+ const spanAttributes = spanColumns.map((c)=>{
424
+ const idx = map[c.name.toLowerCase()];
425
+ if (idx === undefined) return undefined;
426
+ const value = row[idx];
427
+ if (value === undefined || value === null || value === '') return undefined;
428
+ return toKeyValue(c.name.replace(/^span_attributes\./, ''), value);
429
+ }).filter((v)=>v !== undefined);
430
+ // span_events / span_links: JSON columns (data_type Json). Only events need OTLP time parsing.
431
+ const spanEvents = parseJsonArray(getCell(row, map, [
432
+ 'span_events'
433
+ ])).map((event)=>{
434
+ const e = event;
435
+ const eventTime = otlpEventTimeToNanoString(e.timeUnixNano ?? e.time_unix_nano) ?? startTimeUnixNano;
436
+ const eventName = getString(e.name) ?? 'event';
437
+ const attrs = e.attributes;
438
+ const attributes = attrs ? Object.entries(attrs).map(([k, v])=>toKeyValue(k, v)) : [];
439
+ return {
440
+ timeUnixNano: eventTime,
441
+ name: eventName,
442
+ attributes
443
+ };
444
+ });
445
+ const spanLinks = parseJsonArray(getCell(row, map, [
446
+ 'span_links'
447
+ ])).map((link)=>{
448
+ const l = link;
449
+ const attrs = l.attributes;
450
+ const attributes = attrs ? Object.entries(attrs).map(([k, v])=>toKeyValue(k, v)) : [];
451
+ return {
452
+ traceId: getString(l.traceId ?? l.trace_id) ?? '',
453
+ spanId: getString(l.spanId ?? l.span_id) ?? '',
454
+ attributes
455
+ };
456
+ });
457
+ const statusMessage = getString(getCell(row, map, [
458
+ 'span_status_message'
459
+ ])) ?? '';
460
+ const statusCode = parseStatusCode(getCell(row, map, [
461
+ 'span_status_code',
462
+ 'status_code'
463
+ ]));
464
+ const span = {
465
+ traceId,
466
+ spanId,
467
+ parentSpanId,
468
+ name,
469
+ kind,
470
+ startTimeUnixNano,
471
+ endTimeUnixNano,
472
+ attributes: spanAttributes,
473
+ events: spanEvents,
474
+ links: spanLinks,
475
+ status: {
476
+ message: statusMessage,
477
+ code: statusCode
478
+ }
479
+ };
480
+ if (!byService.has(serviceName)) {
481
+ const resourceAttrs = [
482
+ toKeyValue('service.name', serviceName)
483
+ ];
484
+ resourceColumns.forEach((c)=>{
485
+ const idx = map[c.name.toLowerCase()];
486
+ if (idx === undefined) return;
487
+ const value = row[idx];
488
+ if (value === undefined || value === null || value === '') return;
489
+ resourceAttrs.push(toKeyValue(c.name.replace(/^resource_attributes\./, ''), value));
490
+ });
491
+ byService.set(serviceName, {
492
+ resourceAttrs,
493
+ scopeSpans: new Map()
494
+ });
495
+ }
496
+ const serviceGroup = byService.get(serviceName);
497
+ const scopeKey = `${scopeName}|${scopeVersion}`;
498
+ if (!serviceGroup.scopeSpans.has(scopeKey)) {
499
+ serviceGroup.scopeSpans.set(scopeKey, {
500
+ scope: {
501
+ name: scopeName,
502
+ version: scopeVersion
503
+ },
504
+ spans: []
505
+ });
506
+ }
507
+ serviceGroup.scopeSpans.get(scopeKey).spans.push(span);
508
+ });
509
+ const resourceSpans = Array.from(byService.entries()).map(([_, value])=>({
510
+ resource: {
511
+ attributes: value.resourceAttrs
512
+ },
513
+ scopeSpans: Array.from(value.scopeSpans.values())
514
+ }));
515
+ return {
516
+ resourceSpans
517
+ };
518
+ }
@@ -0,0 +1,16 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -0,0 +1,33 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _export_star(require("./GreptimeDBTraceQuery"), exports);
18
+ _export_star(require("./GreptimeDBTraceQueryEditor"), exports);
19
+ _export_star(require("./get-greptimedb-trace-data"), exports);
20
+ _export_star(require("./greptimedb-trace-query-types"), exports);
21
+ function _export_star(from, to) {
22
+ Object.keys(from).forEach(function(k) {
23
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
24
+ Object.defineProperty(to, k, {
25
+ enumerable: true,
26
+ get: function() {
27
+ return from[k];
28
+ }
29
+ });
30
+ }
31
+ });
32
+ return from;
33
+ }
@@ -0,0 +1,25 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "isLikelyTraceDetailSQL", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return isLikelyTraceDetailSQL;
21
+ }
22
+ });
23
+ function isLikelyTraceDetailSQL(query) {
24
+ return /where[\s\S]*trace_id\s*=/i.test(query);
25
+ }
@@ -0,0 +1,32 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _export_star(require("./greptimedb-time-series-query"), exports);
18
+ _export_star(require("./greptimedb-log-query"), exports);
19
+ _export_star(require("./greptimedb-trace-query"), exports);
20
+ function _export_star(from, to) {
21
+ Object.keys(from).forEach(function(k) {
22
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
23
+ Object.defineProperty(to, k, {
24
+ enumerable: true,
25
+ get: function() {
26
+ return from[k];
27
+ }
28
+ });
29
+ }
30
+ });
31
+ return from;
32
+ }
@@ -0,0 +1,47 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "useQueryState", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return useQueryState;
21
+ }
22
+ });
23
+ const _immer = require("immer");
24
+ const _react = require("react");
25
+ function useQueryState(props) {
26
+ const { onChange, value } = props;
27
+ const [query, setQuery] = (0, _react.useState)(value.query || '');
28
+ const [lastSyncedQuery, setLastSyncedQuery] = (0, _react.useState)(value.query);
29
+ if (value.query !== lastSyncedQuery) {
30
+ setQuery(value.query || '');
31
+ setLastSyncedQuery(value.query);
32
+ }
33
+ const handleQueryChange = (e)=>{
34
+ setQuery(e);
35
+ };
36
+ const handleQueryBlur = ()=>{
37
+ setLastSyncedQuery(query);
38
+ onChange((0, _immer.produce)(value, (draft)=>{
39
+ draft.query = query;
40
+ }));
41
+ };
42
+ return {
43
+ query,
44
+ handleQueryChange,
45
+ handleQueryBlur
46
+ };
47
+ }