@perses-dev/loki-plugin 0.5.1 → 0.6.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.
- package/__mf/css/async/7354.85c2cbf6.css +1 -0
- package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
- package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
- package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
- package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
- package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
- package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
- package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
- package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
- package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
- package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
- package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
- package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
- package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
- package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
- package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
- package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
- package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
- package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
- package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
- package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
- package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
- package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
- package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
- package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
- package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
- package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
- package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
- package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
- package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
- package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
- package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
- package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
- package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
- package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
- package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
- package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
- package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
- package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
- package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
- package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
- package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
- package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
- package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
- package/__mf/js/Loki.b7bb557c.js +7 -0
- package/__mf/js/async/1099.b49be119.js +1 -0
- package/__mf/js/async/155.fff99fe4.js +1 -0
- package/__mf/js/async/1616.9255be19.js +1 -0
- package/__mf/js/async/1728.c02a720c.js +1 -0
- package/__mf/js/async/1825.f02ff871.js +1 -0
- package/__mf/js/async/1969.f83e62d6.js +1 -0
- package/__mf/js/async/2043.79caea8b.js +2 -0
- package/__mf/js/async/2386.cebea91a.js +2 -0
- package/__mf/js/async/2502.943ec1cf.js +1 -0
- package/__mf/js/async/2657.5f9f9807.js +1 -0
- package/__mf/js/async/3181.b238b7b9.js +2 -0
- package/__mf/js/async/392.22b48ffa.js +2 -0
- package/__mf/js/async/4121.e547e3d4.js +2 -0
- package/__mf/js/async/4466.293eb237.js +74 -0
- package/__mf/js/async/5002.a483400c.js +1 -0
- package/__mf/js/async/5038.c6e1ac5e.js +2 -0
- package/__mf/js/async/5071.fd1136c7.js +1 -0
- package/__mf/js/async/5440.ff741d36.js +2 -0
- package/__mf/js/async/5587.e582af3f.js +1 -0
- package/__mf/js/async/6100.7d5962ad.js +1 -0
- package/__mf/js/async/6274.7255b4e9.js +2 -0
- package/__mf/js/async/6688.ad8a65bc.js +2 -0
- package/__mf/js/async/6823.7efa6882.js +2 -0
- package/__mf/js/async/{6710.a94fd362.js.LICENSE.txt → 6823.7efa6882.js.LICENSE.txt} +17 -1
- package/__mf/js/async/6898.11c8bae6.js +1 -0
- package/__mf/js/async/7095.0a8daf30.js +1 -0
- package/__mf/js/async/7177.7b6606d3.js +1 -0
- package/__mf/js/async/7192.b5444c91.js +1 -0
- package/__mf/js/async/7354.789ddba3.js +7 -0
- package/__mf/js/async/{9811.422fb6ad.js.LICENSE.txt → 7354.789ddba3.js.LICENSE.txt} +19 -1
- package/__mf/js/async/7413.972aa60d.js +1 -0
- package/__mf/js/async/7862.679d0bd3.js +2 -0
- package/__mf/js/async/7968.952aec3b.js +1 -0
- package/__mf/js/async/7978.5f20023d.js +1 -0
- package/__mf/js/async/8199.98434cf3.js +28 -0
- package/__mf/js/async/8356.6bbe764b.js +1 -0
- package/__mf/js/async/8470.6f15ddf5.js +2 -0
- package/__mf/js/async/873.f59ec7c0.js +1 -0
- package/__mf/js/async/8750.fe623c5f.js +3 -0
- package/__mf/js/async/8988.cb10cfd3.js +1 -0
- package/__mf/js/async/9235.8532a487.js +1 -0
- package/__mf/js/async/9389.a063f523.js +2 -0
- package/__mf/js/async/941.49e5f628.js +2 -0
- package/__mf/js/async/9588.688593c0.js +1 -0
- package/__mf/js/async/9754.0c807c53.js +10 -0
- package/__mf/js/async/{9754.5d7b21c2.js.LICENSE.txt → 9754.0c807c53.js.LICENSE.txt} +1 -1
- package/__mf/js/async/9836.5401a9ec.js +1 -0
- package/__mf/js/async/9877.874a39f4.js +38 -0
- package/__mf/js/async/9916.d88af7d4.js +22 -0
- package/__mf/js/async/__federation_expose_LokiDatasource.6b14cd90.js +2 -0
- package/__mf/js/async/__federation_expose_LokiLabelNamesVariable.59592351.js +1 -0
- package/__mf/js/async/__federation_expose_LokiLabelValuesVariable.6bdc7a31.js +1 -0
- package/__mf/js/async/__federation_expose_LokiLogQLVariable.914390c4.js +1 -0
- package/__mf/js/async/__federation_expose_LokiLogQuery.18f1e6d4.js +1 -0
- package/__mf/js/async/__federation_expose_LokiTimeSeriesQuery.48d9f8d9.js +1 -0
- package/__mf/js/main.c96737bf.js +7 -0
- package/lib/cjs/components/complete.js +11 -4
- package/lib/cjs/datasources/loki-datasource/LokiDatasource.js +2 -2
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/model/loki-client.js +51 -7
- package/lib/cjs/queries/loki-log-query/LokiLogQueryEditor.js +2 -6
- package/lib/cjs/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js +2 -6
- package/lib/cjs/queries/loki-time-series-query/get-loki-time-series-data.js +2 -2
- package/lib/cjs/variables/LokiLabelNamesVariable.js +53 -0
- package/lib/cjs/variables/LokiLabelValuesVariable.js +58 -0
- package/lib/cjs/variables/LokiLogQLVariable.js +64 -0
- package/lib/cjs/variables/MatcherEditor.js +84 -0
- package/lib/cjs/variables/index.js +35 -0
- package/lib/cjs/variables/loki-variables.js +239 -0
- package/lib/cjs/variables/types.js +16 -0
- package/lib/components/complete.js +11 -4
- package/lib/components/complete.js.map +1 -1
- package/lib/components/logql-extension.d.ts +1 -1
- package/lib/components/logql-extension.js.map +1 -1
- package/lib/datasources/loki-datasource/LokiDatasource.d.ts.map +1 -1
- package/lib/datasources/loki-datasource/LokiDatasource.js +2 -2
- package/lib/datasources/loki-datasource/LokiDatasource.js.map +1 -1
- package/lib/datasources/loki-datasource/loki-datasource-types.d.ts +1 -1
- package/lib/datasources/loki-datasource/loki-datasource-types.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/model/loki-client-types.d.ts +1 -1
- package/lib/model/loki-client-types.js.map +1 -1
- package/lib/model/loki-client.d.ts +20 -4
- package/lib/model/loki-client.d.ts.map +1 -1
- package/lib/model/loki-client.js +48 -7
- package/lib/model/loki-client.js.map +1 -1
- package/lib/model/loki-data-types.d.ts +1 -1
- package/lib/model/loki-data-types.d.ts.map +1 -1
- package/lib/model/loki-data-types.js.map +1 -1
- package/lib/model/loki-selectors.d.ts +1 -1
- package/lib/model/loki-selectors.d.ts.map +1 -1
- package/lib/model/loki-selectors.js.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQueryEditor.d.ts.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQueryEditor.js +2 -6
- package/lib/queries/loki-log-query/LokiLogQueryEditor.js.map +1 -1
- package/lib/queries/loki-log-query/get-loki-log-data.d.ts.map +1 -1
- package/lib/queries/loki-log-query/get-loki-log-data.js.map +1 -1
- package/lib/queries/loki-log-query/log-query-plugin-interface.d.ts +1 -1
- package/lib/queries/loki-log-query/log-query-plugin-interface.d.ts.map +1 -1
- package/lib/queries/loki-log-query/log-query-plugin-interface.js.map +1 -1
- package/lib/queries/loki-log-query/loki-log-query-types.d.ts +1 -1
- package/lib/queries/loki-log-query/loki-log-query-types.js.map +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.d.ts.map +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js +2 -6
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js.map +1 -1
- package/lib/queries/loki-time-series-query/get-loki-time-series-data.d.ts.map +1 -1
- package/lib/queries/loki-time-series-query/get-loki-time-series-data.js +1 -1
- package/lib/queries/loki-time-series-query/get-loki-time-series-data.js.map +1 -1
- package/lib/queries/loki-time-series-query/loki-time-series-query-types.d.ts +1 -1
- package/lib/queries/loki-time-series-query/loki-time-series-query-types.js.map +1 -1
- package/lib/variables/LokiLabelNamesVariable.d.ts +4 -0
- package/lib/variables/LokiLabelNamesVariable.d.ts.map +1 -0
- package/lib/variables/LokiLabelNamesVariable.js +45 -0
- package/lib/variables/LokiLabelNamesVariable.js.map +1 -0
- package/lib/variables/LokiLabelValuesVariable.d.ts +4 -0
- package/lib/variables/LokiLabelValuesVariable.d.ts.map +1 -0
- package/lib/variables/LokiLabelValuesVariable.js +50 -0
- package/lib/variables/LokiLabelValuesVariable.js.map +1 -0
- package/lib/variables/LokiLogQLVariable.d.ts +4 -0
- package/lib/variables/LokiLogQLVariable.d.ts.map +1 -0
- package/lib/variables/LokiLogQLVariable.js +56 -0
- package/lib/variables/LokiLogQLVariable.js.map +1 -0
- package/lib/variables/MatcherEditor.d.ts +9 -0
- package/lib/variables/MatcherEditor.d.ts.map +1 -0
- package/lib/variables/MatcherEditor.js +71 -0
- package/lib/variables/MatcherEditor.js.map +1 -0
- package/lib/variables/index.d.ts +7 -0
- package/lib/variables/index.d.ts.map +1 -0
- package/lib/variables/index.js +20 -0
- package/lib/variables/index.js.map +1 -0
- package/lib/variables/loki-variables.d.ts +13 -0
- package/lib/variables/loki-variables.d.ts.map +1 -0
- package/lib/variables/loki-variables.js +211 -0
- package/lib/variables/loki-variables.js.map +1 -0
- package/lib/variables/types.d.ts +17 -0
- package/lib/variables/types.d.ts.map +1 -0
- package/lib/variables/types.js +15 -0
- package/lib/variables/types.js.map +1 -0
- package/mf-manifest.json +313 -133
- package/mf-stats.json +345 -133
- package/package.json +33 -6
- package/__mf/css/async/3061.d3010b86.css +0 -1
- package/__mf/css/async/5442.d3010b86.css +0 -1
- package/__mf/css/async/7370.d3010b86.css +0 -1
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/Loki.ca74c810.js +0 -6
- package/__mf/js/async/1616.60c9a082.js +0 -1
- package/__mf/js/async/1728.c6a9c8d6.js +0 -1
- package/__mf/js/async/1750.a7bd1384.js +0 -1
- package/__mf/js/async/1811.a291a38b.js +0 -28
- package/__mf/js/async/1825.5005b3af.js +0 -1
- package/__mf/js/async/1969.53d223ca.js +0 -1
- package/__mf/js/async/2043.eb7e1c61.js +0 -2
- package/__mf/js/async/208.55931f88.js +0 -4
- package/__mf/js/async/208.55931f88.js.LICENSE.txt +0 -15
- package/__mf/js/async/2386.a3cfef97.js +0 -2
- package/__mf/js/async/3059.cb101ca2.js +0 -1
- package/__mf/js/async/3181.d2b90b95.js +0 -2
- package/__mf/js/async/392.2c7c202d.js +0 -2
- package/__mf/js/async/4121.328a1e93.js +0 -2
- package/__mf/js/async/4466.21ddc88c.js +0 -74
- package/__mf/js/async/5002.29685f8e.js +0 -1
- package/__mf/js/async/5071.a03a64fd.js +0 -1
- package/__mf/js/async/54.f8265ee0.js +0 -22
- package/__mf/js/async/5440.995ad0c5.js +0 -2
- package/__mf/js/async/5587.55dbc663.js +0 -1
- package/__mf/js/async/6100.e2898f9c.js +0 -1
- package/__mf/js/async/6274.293b47c4.js +0 -2
- package/__mf/js/async/6283.78af4bc8.js +0 -2
- package/__mf/js/async/6710.a94fd362.js +0 -2
- package/__mf/js/async/7177.b50a1c64.js +0 -1
- package/__mf/js/async/7192.4dea1fd0.js +0 -1
- package/__mf/js/async/7370.0ddd349a.js +0 -2
- package/__mf/js/async/7968.ec040694.js +0 -1
- package/__mf/js/async/7978.38078276.js +0 -1
- package/__mf/js/async/8356.5635696c.js +0 -1
- package/__mf/js/async/8470.c67049a2.js +0 -2
- package/__mf/js/async/8482.07caae1a.js +0 -1
- package/__mf/js/async/873.02aa55af.js +0 -1
- package/__mf/js/async/8988.1c565f12.js +0 -1
- package/__mf/js/async/9071.ed72bdac.js +0 -2
- package/__mf/js/async/9235.f2e0e95c.js +0 -1
- package/__mf/js/async/9249.d90da2ad.js +0 -1
- package/__mf/js/async/9389.29616aa6.js +0 -2
- package/__mf/js/async/941.0bce16fe.js +0 -2
- package/__mf/js/async/9588.2d82f477.js +0 -1
- package/__mf/js/async/9754.5d7b21c2.js +0 -10
- package/__mf/js/async/9811.422fb6ad.js +0 -7
- package/__mf/js/async/9836.de786d07.js +0 -1
- package/__mf/js/async/9877.b76d1711.js +0 -38
- package/__mf/js/async/__federation_expose_LokiDatasource.5e30f7dd.js +0 -2
- package/__mf/js/async/__federation_expose_LokiLogQuery.c30e299e.js +0 -1
- package/__mf/js/async/__federation_expose_LokiTimeSeriesQuery.aa1ffedf.js +0 -1
- package/__mf/js/main.34b789cc.js +0 -6
- /package/__mf/js/async/{2043.eb7e1c61.js.LICENSE.txt → 2043.79caea8b.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2386.a3cfef97.js.LICENSE.txt → 2386.cebea91a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3181.d2b90b95.js.LICENSE.txt → 3181.b238b7b9.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.2c7c202d.js.LICENSE.txt → 392.22b48ffa.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.328a1e93.js.LICENSE.txt → 4121.e547e3d4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7370.0ddd349a.js.LICENSE.txt → 5038.c6e1ac5e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5440.995ad0c5.js.LICENSE.txt → 5440.ff741d36.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.293b47c4.js.LICENSE.txt → 6274.7255b4e9.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9071.ed72bdac.js.LICENSE.txt → 6688.ad8a65bc.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6283.78af4bc8.js.LICENSE.txt → 7862.679d0bd3.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.c67049a2.js.LICENSE.txt → 8470.6f15ddf5.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9389.29616aa6.js.LICENSE.txt → 9389.a063f523.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.0bce16fe.js.LICENSE.txt → 941.49e5f628.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{54.f8265ee0.js.LICENSE.txt → 9916.d88af7d4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_LokiDatasource.5e30f7dd.js.LICENSE.txt → __federation_expose_LokiDatasource.6b14cd90.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loki-selectors.d.ts","sourceRoot":"","sources":["../../../src/model/loki-selectors.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"loki-selectors.d.ts","sourceRoot":"","sources":["../../../src/model/loki-selectors.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAwB,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,oBAAoB,EAAG,gBAAyB,CAAC;AAE9D,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,IAAI,EAAE,OAAO,oBAAoB,CAAC;CACnC;AAED,eAAO,MAAM,YAAY,EAAE,sBAAuD,CAAC;AAEnF,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,qBAAqB,GAAG,OAAO,CAE3F;AAED,wBAAgB,wBAAwB,CACtC,qBAAqB,EAAE,qBAAqB,GAC3C,qBAAqB,IAAI,sBAAsB,CAEjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/loki-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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/model/loki-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 LOKI_DATASOURCE_KIND = 'LokiDatasource' as const;\n\nexport interface LokiDatasourceSelector extends DatasourceSelector {\n kind: typeof LOKI_DATASOURCE_KIND;\n}\n\nexport const DEFAULT_LOKI: LokiDatasourceSelector = { kind: LOKI_DATASOURCE_KIND };\n\nexport function isDefaultLokiSelector(datasourceSelectValue: DatasourceSelectValue): boolean {\n return !isVariableDatasource(datasourceSelectValue) && datasourceSelectValue.name === undefined;\n}\n\nexport function isLokiDatasourceSelector(\n datasourceSelectValue: DatasourceSelectValue\n): datasourceSelectValue is LokiDatasourceSelector {\n return isVariableDatasource(datasourceSelectValue) || datasourceSelectValue.kind === LOKI_DATASOURCE_KIND;\n}\n"],"names":["isVariableDatasource","LOKI_DATASOURCE_KIND","DEFAULT_LOKI","kind","isDefaultLokiSelector","datasourceSelectValue","name","undefined","isLokiDatasourceSelector"],"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,uBAAuB,iBAA0B;AAM9D,OAAO,MAAMC,eAAuC;IAAEC,MAAMF;AAAqB,EAAE;AAEnF,OAAO,SAASG,sBAAsBC,qBAA4C;IAChF,OAAO,CAACL,qBAAqBK,0BAA0BA,sBAAsBC,IAAI,KAAKC;AACxF;AAEA,OAAO,SAASC,yBACdH,qBAA4C;IAE5C,OAAOL,qBAAqBK,0BAA0BA,sBAAsBF,IAAI,KAAKF;AACvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LokiLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAInB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LokiLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAInB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;AAQ3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,KAAK,oBAAoB,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CA6H5E"}
|
|
@@ -16,6 +16,7 @@ import { InputLabel, Stack, ToggleButton, ToggleButtonGroup } from '@mui/materia
|
|
|
16
16
|
import { useCallback, useMemo } from 'react';
|
|
17
17
|
import { produce } from 'immer';
|
|
18
18
|
import { OptionsEditorControl } from '@perses-dev/components';
|
|
19
|
+
import { createModEnterHandler } from '@perses-dev/dashboards';
|
|
19
20
|
import { LogQLEditor } from '../../components';
|
|
20
21
|
import { isDefaultLokiSelector, LOKI_DATASOURCE_KIND } from '../../model';
|
|
21
22
|
import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';
|
|
@@ -102,12 +103,7 @@ export function LokiLogQueryEditor(props) {
|
|
|
102
103
|
value: query,
|
|
103
104
|
onChange: handleLogsQueryChange,
|
|
104
105
|
onBlur: handleQueryBlur,
|
|
105
|
-
onKeyDown: (
|
|
106
|
-
if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
|
|
107
|
-
event.preventDefault();
|
|
108
|
-
handleQueryExecute(query);
|
|
109
|
-
}
|
|
110
|
-
},
|
|
106
|
+
onKeyDown: createModEnterHandler(()=>handleQueryExecute(query)),
|
|
111
107
|
placeholder: 'Enter LogQL query (e.g. {job="mysql"} |= "error")',
|
|
112
108
|
completionConfig: completionConfig
|
|
113
109
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.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 useDatasourceClient,\n useTimeRange,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack, ToggleButton, ToggleButtonGroup } from '@mui/material';\nimport { ReactElement, useCallback, useMemo } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { LogQLEditor } from '../../components';\nimport { isDefaultLokiSelector, LOKI_DATASOURCE_KIND, LokiDatasourceSelector, LokiClient } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiLogQuerySpec } from './loki-log-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiLogQuerySpec>;\n\nexport function LokiLogQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n // Get client and time range for autocompletion\n const { data: client } = useDatasourceClient<LokiClient>(selectedDatasource);\n const { absoluteTimeRange } = useTimeRange();\n\n // Create completion config for autocompletion\n const completionConfig = useMemo(() => {\n if (!client) return undefined;\n return {\n client,\n timeRange: absoluteTimeRange,\n };\n }, [client, absoluteTimeRange]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n const nextDatasource = isDefaultLokiSelector(newDatasourceSelection) ? undefined : newDatasourceSelection;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n const handleLogsDirection = (_: React.MouseEvent, v: 'backward' | 'forward'): void =>\n onChange(\n produce(value, (draft: LokiLogQuerySpec) => {\n draft.direction = v;\n })\n );\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\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=\"Loki 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 LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.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 useDatasourceClient,\n useTimeRange,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack, ToggleButton, ToggleButtonGroup } from '@mui/material';\nimport { ReactElement, useCallback, useMemo } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { createModEnterHandler } from '@perses-dev/dashboards';\nimport { LogQLEditor } from '../../components';\nimport { isDefaultLokiSelector, LOKI_DATASOURCE_KIND, LokiDatasourceSelector, LokiClient } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiLogQuerySpec } from './loki-log-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiLogQuerySpec>;\n\nexport function LokiLogQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n // Get client and time range for autocompletion\n const { data: client } = useDatasourceClient<LokiClient>(selectedDatasource);\n const { absoluteTimeRange } = useTimeRange();\n\n // Create completion config for autocompletion\n const completionConfig = useMemo(() => {\n if (!client) return undefined;\n return {\n client,\n timeRange: absoluteTimeRange,\n };\n }, [client, absoluteTimeRange]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n const nextDatasource = isDefaultLokiSelector(newDatasourceSelection) ? undefined : newDatasourceSelection;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n const handleLogsDirection = (_: React.MouseEvent, v: 'backward' | 'forward'): void =>\n onChange(\n produce(value, (draft: LokiLogQuerySpec) => {\n draft.direction = v;\n })\n );\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\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=\"Loki 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 LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={createModEnterHandler(() => handleQueryExecute(query))}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\n completionConfig={completionConfig}\n // height=\"120px\"\n />\n </div>\n <div>\n <OptionsEditorControl\n label=\"Order\"\n // description=\"Percentage means thresholds relative to min & max\"\n control={\n <ToggleButtonGroup\n exclusive\n value={value?.direction ?? 'backward'}\n onChange={handleLogsDirection}\n sx={{ height: '36px', marginLeft: '10px', width: 'max-content' }}\n >\n <ToggleButton aria-label=\"backward\" value=\"backward\" sx={{ fontWeight: 500 }}>\n Newest first\n </ToggleButton>\n <ToggleButton aria-label=\"forward\" value=\"forward\" sx={{ fontWeight: 500 }}>\n Oldest first\n </ToggleButton>\n </ToggleButtonGroup>\n }\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","useDatasourceClient","useTimeRange","InputLabel","Stack","ToggleButton","ToggleButtonGroup","useCallback","useMemo","produce","OptionsEditorControl","createModEnterHandler","LogQLEditor","isDefaultLokiSelector","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiLogQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","data","client","absoluteTimeRange","completionConfig","undefined","timeRange","handleDatasourceChange","newDatasourceSelection","kind","draft","nextDatasource","Error","handleLogsDirection","_","v","direction","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","placeholder","control","exclusive","height","marginLeft","width","aria-label"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7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AAI;oCAAEG,YAAY;gCAAI;0CAAG;;0CAG9E,KAAChD;gCAAa4D,cAAW;gCAAU5C,OAAM;gCAAU6B,IAAI;oCAAEG,YAAY;gCAAI;0CAAG;;;;;;;;AAS1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-loki-log-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/get-loki-log-data.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"get-loki-log-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/get-loki-log-data.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AAqB/E,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAwCzE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/get-loki-log-data.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/get-loki-log-data.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport { LogData, LogEntry } from '@perses-dev/spec';\nimport { LokiStreamResult } from '../../model/loki-client-types';\nimport { LokiClient } from '../../model/loki-client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LokiLogQuerySpec } from './loki-log-query-types';\nimport { LogQueryPlugin, LogQueryContext } from './log-query-plugin-interface';\n\nfunction convertStreamsToLogs(streams: LokiStreamResult[]): LogData {\n const entries: LogEntry[] = [];\n\n streams.forEach((stream) => {\n stream.values.forEach(([timestamp, logLine]: [string, string]) => {\n entries.push({\n timestamp: Number(timestamp) / 1000000000,\n line: logLine,\n labels: stream.stream,\n });\n });\n });\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getLokiLogData: LogQueryPlugin<LokiLogQuerySpec>['getLogData'] = async (\n spec: LokiLogQuerySpec,\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<LokiClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as LokiClient;\n\n const { start, end } = context.timeRange;\n\n const response = await client.queryRange({\n query,\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n direction: spec.direction,\n });\n\n if (response.data.resultType === 'streams') {\n const logs = convertStreamsToLogs(response.data.result);\n return {\n logs,\n timeRange: { start, end },\n metadata: {\n executedQueryString: query,\n },\n };\n }\n\n return {\n logs: { entries: [], totalCount: 0 },\n timeRange: { start, end },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","convertStreamsToLogs","streams","entries","forEach","stream","values","timestamp","logLine","push","Number","line","labels","totalCount","length","getLokiLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","response","queryRange","getTime","toString","direction","data","resultType","result","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,qBAAqBC,OAA2B;IACvD,MAAMC,UAAsB,EAAE;IAE9BD,QAAQE,OAAO,CAAC,CAACC;QACfA,OAAOC,MAAM,CAACF,OAAO,CAAC,CAAC,CAACG,WAAWC,QAA0B;YAC3DL,QAAQM,IAAI,CAAC;gBACXF,WAAWG,OAAOH,aAAa;gBAC/BI,MAAMH;gBACNI,QAAQP,OAAOA,MAAM;YACvB;QACF;IACF;IAEA,OAAO;QACLF;QACAU,YAAYV,QAAQW,MAAM;IAC5B;AACF;AAEA,OAAO,MAAMC,iBAAiE,OAC5EC,MACAC;IAEA,IAAI,CAACD,KAAKE,KAAK,EAAE;QACf,OAAO;YACLC,MAAM;gBAAEhB,SAAS,EAAE;gBAAEU,YAAY;YAAE;YACnCO,WAAW;gBAAEC,OAAOJ,QAAQG,SAAS,CAACC,KAAK;gBAAEC,KAAKL,QAAQG,SAAS,CAACE,GAAG;YAAC;QAC1E;IACF;IAEA,MAAMJ,QAAQnB,iBAAiBiB,KAAKE,KAAK,EAAED,QAAQM,aAAa;IAChE,MAAMC,SAAU,MAAMP,QAAQQ,eAAe,CAACC,mBAAmB,CAC/DV,KAAKW,UAAU,IAAI3B;IAGrB,MAAM,EAAEqB,KAAK,EAAEC,GAAG,EAAE,GAAGL,QAAQG,SAAS;IAExC,MAAMQ,WAAW,MAAMJ,OAAOK,UAAU,CAAC;QACvCX;QACAG,OAAOA,MAAMS,OAAO,GAAGC,QAAQ;QAC/BT,KAAKA,IAAIQ,OAAO,GAAGC,QAAQ;QAC3BC,WAAWhB,KAAKgB,SAAS;IAC3B;IAEA,IAAIJ,SAASK,IAAI,CAACC,UAAU,KAAK,WAAW;QAC1C,MAAMf,OAAOlB,qBAAqB2B,SAASK,IAAI,CAACE,MAAM;QACtD,OAAO;YACLhB;YACAC,WAAW;gBAAEC;gBAAOC;YAAI;YACxBc,UAAU;gBACRC,qBAAqBnB;YACvB;QACF;IACF;IAEA,OAAO;QACLC,MAAM;YAAEhB,SAAS,EAAE;YAAEU,YAAY;QAAE;QACnCO,WAAW;YAAEC;YAAOC;QAAI;IAC1B;AACF,EAAE"}
|
|
@@ -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":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/log-query-plugin-interface.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/log-query-plugin-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/loki-log-query/log-query-plugin-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 {
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/log-query-plugin-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/loki-log-query/loki-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/
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/loki-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';\nimport { LokiQueryRangeStreamsResponse } from '../../model/loki-client-types';\n\nexport interface LokiLogQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n direction?: 'backward' | 'forward';\n}\n\nexport type LokiLogQueryResponse = LokiQueryRangeStreamsResponse;\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;AAWjC,WAAiE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LokiTimeSeriesQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LokiTimeSeriesQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAOlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,KAAK,oBAAoB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;AAExE,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAiFzE"}
|
|
@@ -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 } from 'react';
|
|
17
|
+
import { createModEnterHandler } from '@perses-dev/dashboards';
|
|
17
18
|
import { produce } from 'immer';
|
|
18
19
|
import { LogQLEditor } from '../../components';
|
|
19
20
|
import { LOKI_DATASOURCE_KIND } from '../../model';
|
|
@@ -82,12 +83,7 @@ export function LokiQueryEditor(props) {
|
|
|
82
83
|
value: query,
|
|
83
84
|
onChange: handleLogsQueryChange,
|
|
84
85
|
onBlur: handleQueryBlur,
|
|
85
|
-
onKeyDown: (
|
|
86
|
-
if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
|
|
87
|
-
event.preventDefault();
|
|
88
|
-
handleQueryExecute(query);
|
|
89
|
-
}
|
|
90
|
-
},
|
|
86
|
+
onKeyDown: createModEnterHandler(()=>handleQueryExecute(query)),
|
|
91
87
|
placeholder: 'Enter LogQL query (e.g. {job="mysql"} |= "error")'
|
|
92
88
|
})
|
|
93
89
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.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 } from 'react';\nimport { produce } from 'immer';\nimport { LogQLEditor } from '../../components';\nimport { LOKI_DATASOURCE_KIND, LokiDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiTimeSeriesQuerySpec>;\n\nexport function LokiQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\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=\"Loki 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 LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.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 } from 'react';\nimport { createModEnterHandler } from '@perses-dev/dashboards';\nimport { produce } from 'immer';\nimport { LogQLEditor } from '../../components';\nimport { LOKI_DATASOURCE_KIND, LokiDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiTimeSeriesQuerySpec>;\n\nexport function LokiQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\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=\"Loki 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 LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={createModEnterHandler(() => handleQueryExecute(query))}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","createModEnterHandler","produce","LogQLEditor","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","place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IAGrB,qBACE,MAACjB;QAAM2B,SAAS;QAAKC,eAAe;;0BAClC,MAACC;;kCACC,KAAC9B;wBACC+B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACrC;wBACCsC,sBAAsB5B;wBACtBM,OAAOG;wBACPJ,UAAUQ;wBACVgB,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC9B;wBACC+B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC7B;wBACCQ,OAAOI;wBACPL,UAAUc;wBACVY,QAAQnB;wBACRoB,WAAWpC,sBAAsB,IAAMsB,mBAAmBR;wBAC1DuB,aAAY;;;;;;AAMtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-loki-time-series-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-loki-time-series-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,2BAA2B,CAAC;AAIpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,QAAQ,CAAC;IACrB,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAkEF,eAAO,MAAM,qBAAqB,EAAE,qBAAqB,CAAC,uBAAuB,CAAC,CAAC,mBAAmB,CAoDrG,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 Loki step calculation
|
|
18
18
|
const MAX_LOKI_DATA_POINTS = 10000; // Similar to Prometheus
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { milliseconds } from 'date-fns';\nimport { DurationString, parseDurationString, TimeSeries } from '@perses-dev/spec';\nimport { LokiClient } from '../../model/loki-client';\nimport { LokiMatrixResult } from '../../model/loki-client-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';\n\nexport type LokiMatrixResponse = {\n resultType: 'matrix';\n result: LokiMatrixResult[];\n};\n\n// Constants for Loki step calculation\nconst MAX_LOKI_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 Loki range queries\n */\nfunction getLokiRangeStep(\n startMs: number,\n endMs: number,\n minStepSeconds = DEFAULT_MIN_STEP_SECONDS,\n suggestedStepMs = 0\n): number {\n const suggestedStepSeconds = suggestedStepMs / 1000;\n const queryRangeSeconds = (endMs - startMs) / 1000;\n\n let safeStep = queryRangeSeconds / MAX_LOKI_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 Loki API\n */\nfunction formatStepForLoki(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: LokiMatrixResult[]): TimeSeries[] {\n return matrix.map((series) => {\n const name = Object.entries(series.metric)\n .map(([k, v]) => `${k}=${v}`)\n .join(', ');\n return {\n name,\n values: series.values.map(([timestamp, value]) => [\n Number(timestamp) * 1000, // Convert seconds to milliseconds\n Number(value),\n ]),\n labels: series.metric,\n };\n });\n}\n\nexport const getLokiTimeSeriesData: TimeSeriesQueryPlugin<LokiTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\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<LokiClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as LokiClient;\n\n const { start, end } = context.timeRange;\n\n // Calculate proper step using similar logic to Prometheus\n const minStepSeconds = spec.step\n ? (getDurationStringSeconds(spec.step as DurationString) ?? DEFAULT_MIN_STEP_SECONDS)\n : DEFAULT_MIN_STEP_SECONDS;\n const stepSeconds = getLokiRangeStep(start.getTime(), end.getTime(), minStepSeconds, context.suggestedStepMs);\n const stepString = formatStepForLoki(stepSeconds);\n const stepMs = stepSeconds * 1000;\n\n const response = await client.queryRange({\n query,\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n step: stepString,\n });\n\n if (response.data.resultType === 'matrix') {\n const convertedSeries = convertMatrixToTimeSeries(response.data.result as LokiMatrixResult[]);\n\n return {\n series: convertedSeries,\n timeRange: { start, end },\n stepMs,\n metadata: {\n executedQueryString: query,\n },\n };\n }\n\n return {\n series: [],\n timeRange: { start, end },\n stepMs,\n };\n};\n"],"names":["replaceVariables","milliseconds","parseDurationString","DEFAULT_DATASOURCE","MAX_LOKI_DATA_POINTS","DEFAULT_MIN_STEP_SECONDS","getDurationStringSeconds","durationString","undefined","duration","ms","Math","floor","getLokiRangeStep","startMs","endMs","minStepSeconds","suggestedStepMs","suggestedStepSeconds","queryRangeSeconds","safeStep","ceil","max","formatStepForLoki","stepSeconds","round","convertMatrixToTimeSeries","matrix","map","series","name","Object","entries","metric","k","v","join","values","timestamp","value","Number","labels","getLokiTimeSeriesData","spec","context","query","timeRange","start","end","stepMs","variableState","client","datasourceStore","getDatasourceClient","datasource","step","getTime","stepString","response","queryRange","toString","data","resultType","convertedSeries","result","metadata","executedQueryString"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,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ACR;IAEA,IAAIC,SAASG,IAAI,CAACC,UAAU,KAAK,UAAU;QACzC,MAAMC,kBAAkBrC,0BAA0BgC,SAASG,IAAI,CAACG,MAAM;QAEtE,OAAO;YACLnC,QAAQkC;YACRjB,WAAW;gBAAEC;gBAAOC;YAAI;YACxBC;YACAgB,UAAU;gBACRC,qBAAqBrB;YACvB;QACF;IACF;IAEA,OAAO;QACLhB,QAAQ,EAAE;QACViB,WAAW;YAAEC;YAAOC;QAAI;QACxBC;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/loki-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/
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/loki-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';\nimport { LokiQueryRangeMatrixResponse } from '../../model/loki-client-types';\n\nexport interface LokiTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n step?: string;\n}\n\nexport type LokiTimeSeriesQueryResponse = LokiQueryRangeMatrixResponse;\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;AAWjC,WAAuE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LokiLabelNamesVariable.d.ts","sourceRoot":"","sources":["../../../src/variables/LokiLabelNamesVariable.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,cAAc,EAKf,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,6BAA6B,CAsBhF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
import { replaceVariables, parseVariables, datasourceSelectValueToSelector, isVariableDatasource } from '@perses-dev/plugin-system';
|
|
14
|
+
import { DEFAULT_LOKI, getLokiTimeRange, LOKI_DATASOURCE_KIND } from '../model';
|
|
15
|
+
import { stringArrayToVariableOptions, LokiLabelNamesVariableEditor } from './loki-variables';
|
|
16
|
+
export const LokiLabelNamesVariable = {
|
|
17
|
+
getVariableOptions: async (spec, ctx)=>{
|
|
18
|
+
const datasourceSelector = datasourceSelectValueToSelector(spec.datasource ?? DEFAULT_LOKI, ctx.variables, await ctx.datasourceStore.listDatasourceSelectItems(LOKI_DATASOURCE_KIND)) ?? DEFAULT_LOKI;
|
|
19
|
+
const client = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);
|
|
20
|
+
const query = spec.matchers ? replaceVariables(spec.matchers[0] ?? '', ctx.variables) || undefined : undefined;
|
|
21
|
+
const timeRange = getLokiTimeRange(ctx.timeRange);
|
|
22
|
+
const { data: options } = await client.labels({
|
|
23
|
+
start: timeRange.start,
|
|
24
|
+
end: timeRange.end,
|
|
25
|
+
query
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
data: stringArrayToVariableOptions(options)
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
dependsOn: (spec)=>{
|
|
32
|
+
const matcherVariables = spec.matchers?.map((m)=>parseVariables(m)).flat() || [];
|
|
33
|
+
const datasourceVariables = spec.datasource && isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource) : [];
|
|
34
|
+
return {
|
|
35
|
+
variables: [
|
|
36
|
+
...matcherVariables,
|
|
37
|
+
...datasourceVariables
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
OptionsEditorComponent: LokiLabelNamesVariableEditor,
|
|
42
|
+
createInitialOptions: ()=>({})
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=LokiLabelNamesVariable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/variables/LokiLabelNamesVariable.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 VariablePlugin,\n replaceVariables,\n parseVariables,\n datasourceSelectValueToSelector,\n isVariableDatasource,\n} from '@perses-dev/plugin-system';\nimport { LokiClient, DEFAULT_LOKI, getLokiTimeRange, LOKI_DATASOURCE_KIND } from '../model';\nimport { stringArrayToVariableOptions, LokiLabelNamesVariableEditor } from './loki-variables';\nimport { LokiLabelNamesVariableOptions } from './types';\n\nexport const LokiLabelNamesVariable: VariablePlugin<LokiLabelNamesVariableOptions> = {\n getVariableOptions: async (spec, ctx) => {\n const datasourceSelector =\n datasourceSelectValueToSelector(\n spec.datasource ?? DEFAULT_LOKI,\n ctx.variables,\n await ctx.datasourceStore.listDatasourceSelectItems(LOKI_DATASOURCE_KIND)\n ) ?? DEFAULT_LOKI;\n const client: LokiClient = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);\n const query = spec.matchers ? replaceVariables(spec.matchers[0] ?? '', ctx.variables) || undefined : undefined;\n const timeRange = getLokiTimeRange(ctx.timeRange);\n const { data: options } = await client.labels({ start: timeRange.start, end: timeRange.end, query });\n return { data: stringArrayToVariableOptions(options) };\n },\n dependsOn: (spec) => {\n const matcherVariables = spec.matchers?.map((m) => parseVariables(m)).flat() || [];\n const datasourceVariables =\n spec.datasource && isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource) : [];\n return { variables: [...matcherVariables, ...datasourceVariables] };\n },\n OptionsEditorComponent: LokiLabelNamesVariableEditor,\n createInitialOptions: () => ({}),\n};\n"],"names":["replaceVariables","parseVariables","datasourceSelectValueToSelector","isVariableDatasource","DEFAULT_LOKI","getLokiTimeRange","LOKI_DATASOURCE_KIND","stringArrayToVariableOptions","LokiLabelNamesVariableEditor","LokiLabelNamesVariable","getVariableOptions","spec","ctx","datasourceSelector","datasource","variables","datasourceStore","listDatasourceSelectItems","client","getDatasourceClient","query","matchers","undefined","timeRange","data","options","labels","start","end","dependsOn","matcherVariables","map","m","flat","datasourceVariables","Opt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,WAAW;mBAAIe;mBAAqBI;aAAoB;QAAC;IACpE;IACAC,wBAAwB3B;IACxB4B,sBAAsB,IAAO,CAAA,CAAC,CAAA;AAChC,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LokiLabelValuesVariable.d.ts","sourceRoot":"","sources":["../../../src/variables/LokiLabelValuesVariable.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,cAAc,EAKf,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAAC,8BAA8B,CA4BlF,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
import { replaceVariables, parseVariables, datasourceSelectValueToSelector, isVariableDatasource } from '@perses-dev/plugin-system';
|
|
14
|
+
import { DEFAULT_LOKI, getLokiTimeRange, LOKI_DATASOURCE_KIND } from '../model';
|
|
15
|
+
import { stringArrayToVariableOptions, LokiLabelValuesVariableEditor } from './loki-variables';
|
|
16
|
+
export const LokiLabelValuesVariable = {
|
|
17
|
+
getVariableOptions: async (spec, ctx)=>{
|
|
18
|
+
const datasourceSelector = datasourceSelectValueToSelector(spec.datasource ?? DEFAULT_LOKI, ctx.variables, await ctx.datasourceStore.listDatasourceSelectItems(LOKI_DATASOURCE_KIND)) ?? DEFAULT_LOKI;
|
|
19
|
+
const client = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);
|
|
20
|
+
const query = spec.matchers ? replaceVariables(spec.matchers[0] ?? '', ctx.variables) || undefined : undefined;
|
|
21
|
+
const timeRange = getLokiTimeRange(ctx.timeRange);
|
|
22
|
+
const { data: options } = await client.labelValues({
|
|
23
|
+
labelName: replaceVariables(spec.labelName, ctx.variables),
|
|
24
|
+
start: timeRange.start,
|
|
25
|
+
end: timeRange.end,
|
|
26
|
+
query
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
data: stringArrayToVariableOptions(options)
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
dependsOn: (spec)=>{
|
|
33
|
+
const matcherVariables = spec.matchers?.map((m)=>parseVariables(m)).flat() || [];
|
|
34
|
+
const labelVariables = parseVariables(spec.labelName);
|
|
35
|
+
const datasourceVariables = spec.datasource && isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource) : [];
|
|
36
|
+
return {
|
|
37
|
+
variables: [
|
|
38
|
+
...matcherVariables,
|
|
39
|
+
...labelVariables,
|
|
40
|
+
...datasourceVariables
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
OptionsEditorComponent: LokiLabelValuesVariableEditor,
|
|
45
|
+
createInitialOptions: ()=>({
|
|
46
|
+
labelName: ''
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=LokiLabelValuesVariable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/variables/LokiLabelValuesVariable.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 VariablePlugin,\n replaceVariables,\n parseVariables,\n datasourceSelectValueToSelector,\n isVariableDatasource,\n} from '@perses-dev/plugin-system';\nimport { LokiClient, DEFAULT_LOKI, getLokiTimeRange, LOKI_DATASOURCE_KIND } from '../model';\nimport { stringArrayToVariableOptions, LokiLabelValuesVariableEditor } from './loki-variables';\nimport { LokiLabelValuesVariableOptions } from './types';\n\nexport const LokiLabelValuesVariable: VariablePlugin<LokiLabelValuesVariableOptions> = {\n getVariableOptions: async (spec, ctx) => {\n const datasourceSelector =\n datasourceSelectValueToSelector(\n spec.datasource ?? DEFAULT_LOKI,\n ctx.variables,\n await ctx.datasourceStore.listDatasourceSelectItems(LOKI_DATASOURCE_KIND)\n ) ?? DEFAULT_LOKI;\n const client: LokiClient = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);\n const query = spec.matchers ? replaceVariables(spec.matchers[0] ?? '', ctx.variables) || undefined : undefined;\n const timeRange = getLokiTimeRange(ctx.timeRange);\n const { data: options } = await client.labelValues({\n labelName: replaceVariables(spec.labelName, ctx.variables),\n start: timeRange.start,\n end: timeRange.end,\n query,\n });\n return { data: stringArrayToVariableOptions(options) };\n },\n dependsOn: (spec) => {\n const matcherVariables = spec.matchers?.map((m) => parseVariables(m)).flat() || [];\n const labelVariables = parseVariables(spec.labelName);\n const datasourceVariables =\n spec.datasource && isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource) : [];\n return { variables: [...matcherVariables, ...labelVariables, ...datasourceVariables] };\n },\n OptionsEditorComponent: LokiLabelValuesVariableEditor,\n createInitialOptions: () => ({ labelName: '' }),\n};\n"],"names":["replaceVariables","parseVariables","datasourceSelectValueToSelector","isVariableDatasource","DEFAULT_LOKI","getLokiTimeRange","LOKI_DATASOURCE_KIND","stringArrayToVariableOptions","LokiLabelValuesVariableEditor","LokiLabelValuesVariable","getVariableOptions","spec","ctx","datasourceSelector","datasource","variables","datasourceStore","listDatasourceSelectItems","client","getDatasourceClient","query","matchers","undefined","timeRange","data","options","labelValues","labelName","start","end","dependsOn","matcherVariables","map","m","flat","labelVariables","datasourceVariables","OptionsEditorComponent","createInitialOptions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAEEA,gBAAgB,EAChBC,cAAc,EACdC,+BAA+B,EAC/BC,oBAAoB,QACf,4BAA4B;AACnC,SAAqBC,YAAY,EAAEC,gBAAgB,EAAEC,oBAAoB,QAAQ,WAAW;AAC5F,SAASC,4BAA4B,EAAEC,6BAA6B,QAAQ,mBAAmB;AAG/F,OAAO,MAAMC,0BAA0E;IACrFC,oBAAoB,OAAOC,MAAMC;QAC/B,MAAMC,qBACJX,gCACES,KAAKG,UAAU,IAAIV,cACnBQ,IAAIG,SAAS,EACb,MAAMH,IAAII,eAAe,CAACC,yBAAyB,CAACX,0BACjDF;QACP,MAAMc,SAAqB,MAAMN,IAAII,eAAe,CAACG,mBAAmB,CAACN;QACzE,MAAMO,QAAQT,KAAKU,QAAQ,GAAGrB,iBAAiBW,KAAKU,QAAQ,CAAC,EAAE,IAAI,IAAIT,IAAIG,SAAS,KAAKO,YAAYA;QACrG,MAAMC,YAAYlB,iBAAiBO,IAAIW,SAAS;QAChD,MAAM,EAAEC,MAAMC,OAAO,EAAE,GAAG,MAAMP,OAAOQ,WAAW,CAAC;YACjDC,WAAW3B,iBAAiBW,KAAKgB,SAAS,EAAEf,IAAIG,SAAS;YACzDa,OAAOL,UAAUK,KAAK;YACtBC,KAAKN,UAAUM,GAAG;YAClBT;QACF;QACA,OAAO;YAAEI,MAAMjB,6BAA6BkB;QAAS;IACvD;IACAK,WAAW,CAACnB;QACV,MAAMoB,mBAAmBpB,KAAKU,QAAQ,EAAEW,IAAI,CAACC,IAAMhC,eAAegC,IAAIC,UAAU,EAAE;QAClF,MAAMC,iBAAiBlC,eAAeU,KAAKgB,SAAS;QACpD,MAAMS,sBACJzB,KAAKG,UAAU,IAAIX,qBAAqBQ,KAAKG,UAAU,IAAIb,eAAeU,KAAKG,UAAU,IAAI,EAAE;QACjG,OAAO;YAAEC,WAAW;mBAAIgB;mBAAqBI;mBAAmBC;aAAoB;QAAC;IACvF;IACAC,wBAAwB7B;IACxB8B,sBAAsB,IAAO,CAAA;YAAEX,WAAW;QAAG,CAAA;AAC/C,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LokiLogQLVariable.d.ts","sourceRoot":"","sources":["../../../src/variables/LokiLogQLVariable.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,cAAc,EAKf,MAAM,2BAA2B,CAAC;AAQnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,wBAAwB,CAiCtE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
import { replaceVariables, parseVariables, datasourceSelectValueToSelector, isVariableDatasource } from '@perses-dev/plugin-system';
|
|
14
|
+
import { DEFAULT_LOKI, LOKI_DATASOURCE_KIND, getLokiTimeRange } from '../model';
|
|
15
|
+
import { capturingMetric, capturingStreams, stringArrayToVariableOptions, LokiLogQLVariableEditor } from './loki-variables';
|
|
16
|
+
export const LokiLogQLVariable = {
|
|
17
|
+
getVariableOptions: async (spec, ctx)=>{
|
|
18
|
+
const datasourceSelector = datasourceSelectValueToSelector(spec.datasource ?? DEFAULT_LOKI, ctx.variables, await ctx.datasourceStore.listDatasourceSelectItems(LOKI_DATASOURCE_KIND)) ?? DEFAULT_LOKI;
|
|
19
|
+
const client = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);
|
|
20
|
+
const timeRange = getLokiTimeRange(ctx.timeRange);
|
|
21
|
+
const response = await client.queryRange({
|
|
22
|
+
query: replaceVariables(spec.expr, ctx.variables),
|
|
23
|
+
start: timeRange.start,
|
|
24
|
+
end: timeRange.end
|
|
25
|
+
});
|
|
26
|
+
const labelName = replaceVariables(spec.labelName, ctx.variables);
|
|
27
|
+
let values = [];
|
|
28
|
+
if (response.data?.resultType === 'streams') {
|
|
29
|
+
values = capturingStreams(response.data.result, labelName);
|
|
30
|
+
} else if (response.data?.resultType === 'matrix') {
|
|
31
|
+
values = capturingMetric(response.data.result, labelName);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
data: stringArrayToVariableOptions(values)
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
dependsOn: (spec)=>{
|
|
38
|
+
const exprVariables = parseVariables(spec.expr);
|
|
39
|
+
const labelVariables = parseVariables(spec.labelName);
|
|
40
|
+
const datasourceVariables = spec.datasource && isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource) : [];
|
|
41
|
+
return {
|
|
42
|
+
variables: [
|
|
43
|
+
...exprVariables,
|
|
44
|
+
...labelVariables,
|
|
45
|
+
...datasourceVariables
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
OptionsEditorComponent: LokiLogQLVariableEditor,
|
|
50
|
+
createInitialOptions: ()=>({
|
|
51
|
+
expr: '',
|
|
52
|
+
labelName: ''
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=LokiLogQLVariable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/variables/LokiLogQLVariable.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 VariablePlugin,\n replaceVariables,\n parseVariables,\n datasourceSelectValueToSelector,\n isVariableDatasource,\n} from '@perses-dev/plugin-system';\nimport { LokiClient, DEFAULT_LOKI, LOKI_DATASOURCE_KIND, getLokiTimeRange } from '../model';\nimport {\n capturingMetric,\n capturingStreams,\n stringArrayToVariableOptions,\n LokiLogQLVariableEditor,\n} from './loki-variables';\nimport { LokiLogQLVariableOptions } from './types';\n\nexport const LokiLogQLVariable: VariablePlugin<LokiLogQLVariableOptions> = {\n getVariableOptions: async (spec, ctx) => {\n const datasourceSelector =\n datasourceSelectValueToSelector(\n spec.datasource ?? DEFAULT_LOKI,\n ctx.variables,\n await ctx.datasourceStore.listDatasourceSelectItems(LOKI_DATASOURCE_KIND)\n ) ?? DEFAULT_LOKI;\n const client: LokiClient = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);\n const timeRange = getLokiTimeRange(ctx.timeRange);\n const response = await client.queryRange({\n query: replaceVariables(spec.expr, ctx.variables),\n start: timeRange.start,\n end: timeRange.end,\n });\n const labelName = replaceVariables(spec.labelName, ctx.variables);\n let values: string[] = [];\n if (response.data?.resultType === 'streams') {\n values = capturingStreams(response.data.result, labelName);\n } else if (response.data?.resultType === 'matrix') {\n values = capturingMetric(response.data.result, labelName);\n }\n return { data: stringArrayToVariableOptions(values) };\n },\n dependsOn: (spec) => {\n const exprVariables = parseVariables(spec.expr);\n const labelVariables = parseVariables(spec.labelName);\n const datasourceVariables =\n spec.datasource && isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource) : [];\n return { variables: [...exprVariables, ...labelVariables, ...datasourceVariables] };\n },\n OptionsEditorComponent: LokiLogQLVariableEditor,\n createInitialOptions: () => ({ expr: '', labelName: '' }),\n};\n"],"names":["replaceVariables","parseVariables","datasourceSelectValueToSelector","isVariableDatasource","DEFAULT_LOKI","LOKI_DATASOURCE_KIND","getLokiTimeRange","capturingMetric","capturingStreams","stringArrayToVariableOptions","LokiLogQLVariableEditor","LokiLogQLVariable","getVariableOptions","spec","ctx","datasourceSelector","datasource","variables","datasourceStore","listDatasourceSelectItems","client","getDatasourceClient","timeRange","response","queryRange","query","expr","start","end","labelName","values","data","resultType","result","dependsOn","exprVariables","labelVariables","datasourceVariables","OptionsEditorComponent","createInitialOptions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAEEA,gBAAgB,EAChBC,cAAc,EACdC,+BAA+B,EAC/BC,oBAAoB,QACf,4BAA4B;AACnC,SAAqBC,YAAY,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,WAAW;AAC5F,SACEC,eAAe,EACfC,gBAAgB,EAChBC,4BAA4B,EAC5BC,uBAAuB,QAClB,mBAAmB;AAG1B,OAAO,MAAMC,oBAA8D;IACzEC,oBAAoB,OAAOC,MAAMC;QAC/B,MAAMC,qBACJb,gCACEW,KAAKG,UAAU,IAAIZ,cACnBU,IAAIG,SAAS,EACb,MAAMH,IAAII,eAAe,CAACC,yBAAyB,CAACd,0BACjDD;QACP,MAAMgB,SAAqB,MAAMN,IAAII,eAAe,CAACG,mBAAmB,CAACN;QACzE,MAAMO,YAAYhB,iBAAiBQ,IAAIQ,SAAS;QAChD,MAAMC,WAAW,MAAMH,OAAOI,UAAU,CAAC;YACvCC,OAAOzB,iBAAiBa,KAAKa,IAAI,EAAEZ,IAAIG,SAAS;YAChDU,OAAOL,UAAUK,KAAK;YACtBC,KAAKN,UAAUM,GAAG;QACpB;QACA,MAAMC,YAAY7B,iBAAiBa,KAAKgB,SAAS,EAAEf,IAAIG,SAAS;QAChE,IAAIa,SAAmB,EAAE;QACzB,IAAIP,SAASQ,IAAI,EAAEC,eAAe,WAAW;YAC3CF,SAAStB,iBAAiBe,SAASQ,IAAI,CAACE,MAAM,EAAEJ;QAClD,OAAO,IAAIN,SAASQ,IAAI,EAAEC,eAAe,UAAU;YACjDF,SAASvB,gBAAgBgB,SAASQ,IAAI,CAACE,MAAM,EAAEJ;QACjD;QACA,OAAO;YAAEE,MAAMtB,6BAA6BqB;QAAQ;IACtD;IACAI,WAAW,CAACrB;QACV,MAAMsB,gBAAgBlC,eAAeY,KAAKa,IAAI;QAC9C,MAAMU,iBAAiBnC,eAAeY,KAAKgB,SAAS;QACpD,MAAMQ,sBACJxB,KAAKG,UAAU,IAAIb,qBAAqBU,KAAKG,UAAU,IAAIf,eAAeY,KAAKG,UAAU,IAAI,EAAE;QACjG,OAAO;YAAEC,WAAW;mBAAIkB;mBAAkBC;mBAAmBC;aAAoB;QAAC;IACpF;IACAC,wBAAwB5B;IACxB6B,sBAAsB,IAAO,CAAA;YAAEb,MAAM;YAAIG,WAAW;QAAG,CAAA;AACzD,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
type MatcherEditorProps = {
|
|
3
|
+
matchers: string[];
|
|
4
|
+
onChange: (matchers: string[]) => void;
|
|
5
|
+
isReadonly?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function MatcherEditor({ matchers, onChange, isReadonly }: MatcherEditorProps): ReactElement;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=MatcherEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatcherEditor.d.ts","sourceRoot":"","sources":["../../../src/variables/MatcherEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,YAAY,CAkDlG"}
|