@perses-dev/loki-plugin 0.4.0 → 0.5.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 (155) hide show
  1. package/__mf/js/Loki.b64c7408.js +6 -0
  2. package/__mf/js/async/1238.71fd7843.js +1 -0
  3. package/__mf/js/async/1490.0d8dcc42.js +22 -0
  4. package/__mf/js/async/1501.eefd56b9.js +1 -0
  5. package/__mf/js/async/1616.60c9a082.js +1 -0
  6. package/__mf/js/async/1728.21a8f690.js +1 -0
  7. package/__mf/js/async/1811.a291a38b.js +28 -0
  8. package/__mf/js/async/1825.5005b3af.js +1 -0
  9. package/__mf/js/async/1969.53d223ca.js +1 -0
  10. package/__mf/js/async/2043.eb7e1c61.js +2 -0
  11. package/__mf/js/async/2386.a3cfef97.js +2 -0
  12. package/__mf/js/async/3059.cb101ca2.js +1 -0
  13. package/__mf/js/async/3181.d2b90b95.js +2 -0
  14. package/__mf/js/async/3849.85df5535.js +7 -0
  15. package/__mf/js/async/392.c0f9d49a.js +2 -0
  16. package/__mf/js/async/{1964.7b2e7223.js → 4121.328a1e93.js} +2 -2
  17. package/__mf/js/async/4466.21ddc88c.js +74 -0
  18. package/__mf/js/async/{2651.ef335482.js → 5002.29685f8e.js} +1 -1
  19. package/__mf/js/async/5071.a03a64fd.js +1 -0
  20. package/__mf/js/async/5440.3fedd5ea.js +2 -0
  21. package/__mf/js/async/5501.01af8b43.js +2 -0
  22. package/__mf/js/async/{5214.fee648bb.js → 5587.55dbc663.js} +1 -1
  23. package/__mf/js/async/6100.e2898f9c.js +1 -0
  24. package/__mf/js/async/6274.293b47c4.js +2 -0
  25. package/__mf/js/async/6283.78af4bc8.js +2 -0
  26. package/__mf/js/async/6498.903f2a94.js +2 -0
  27. package/__mf/js/async/7177.b50a1c64.js +1 -0
  28. package/__mf/js/async/7192.4dea1fd0.js +1 -0
  29. package/__mf/js/async/7370.0ddd349a.js +2 -0
  30. package/__mf/js/async/7968.ec040694.js +1 -0
  31. package/__mf/js/async/7978.38078276.js +1 -0
  32. package/__mf/js/async/8035.8dab4893.js +38 -0
  33. package/__mf/js/async/8356.5635696c.js +1 -0
  34. package/__mf/js/async/8470.c67049a2.js +2 -0
  35. package/__mf/js/async/8482.07caae1a.js +1 -0
  36. package/__mf/js/async/873.02aa55af.js +1 -0
  37. package/__mf/js/async/8988.1c565f12.js +1 -0
  38. package/__mf/js/async/9071.ed72bdac.js +2 -0
  39. package/__mf/js/async/9235.f2e0e95c.js +1 -0
  40. package/__mf/js/async/9389.a8ea42a0.js +2 -0
  41. package/__mf/js/async/941.0bce16fe.js +2 -0
  42. package/__mf/js/async/9588.2d82f477.js +1 -0
  43. package/__mf/js/async/9754.5d7b21c2.js +10 -0
  44. package/__mf/js/async/9836.de786d07.js +1 -0
  45. package/__mf/js/async/__federation_expose_LokiDatasource.3da46ee2.js +2 -0
  46. package/__mf/js/async/__federation_expose_LokiLogQuery.c1be0273.js +1 -0
  47. package/__mf/js/async/__federation_expose_LokiTimeSeriesQuery.cf876f4b.js +1 -0
  48. package/__mf/js/main.de30f7e6.js +6 -0
  49. package/lib/bootstrap.js +3 -3
  50. package/lib/bootstrap.js.map +1 -1
  51. package/lib/cjs/bootstrap.js +1 -1
  52. package/lib/cjs/components/complete.js +258 -0
  53. package/lib/cjs/components/logql-editor.js +6 -3
  54. package/lib/cjs/components/logql-extension.js +15 -1
  55. package/lib/cjs/model/index.js +1 -0
  56. package/lib/cjs/model/loki-client.js +10 -10
  57. package/lib/cjs/model/loki-selectors.js +5 -5
  58. package/lib/cjs/queries/constants.js +3 -3
  59. package/lib/cjs/queries/loki-log-query/LokiLogQueryEditor.js +16 -1
  60. package/lib/components/complete.d.ts +37 -0
  61. package/lib/components/complete.d.ts.map +1 -0
  62. package/lib/components/complete.js +249 -0
  63. package/lib/components/complete.js.map +1 -0
  64. package/lib/components/logql-editor.d.ts +4 -1
  65. package/lib/components/logql-editor.d.ts.map +1 -1
  66. package/lib/components/logql-editor.js +7 -4
  67. package/lib/components/logql-editor.js.map +1 -1
  68. package/lib/components/logql-extension.d.ts +9 -1
  69. package/lib/components/logql-extension.d.ts.map +1 -1
  70. package/lib/components/logql-extension.js +15 -1
  71. package/lib/components/logql-extension.js.map +1 -1
  72. package/lib/datasources/loki-datasource/LokiDatasourceEditor.js +1 -1
  73. package/lib/datasources/loki-datasource/LokiDatasourceEditor.js.map +1 -1
  74. package/lib/model/index.d.ts +1 -0
  75. package/lib/model/index.d.ts.map +1 -1
  76. package/lib/model/index.js +1 -0
  77. package/lib/model/index.js.map +1 -1
  78. package/lib/queries/loki-log-query/LokiLogQueryEditor.d.ts.map +1 -1
  79. package/lib/queries/loki-log-query/LokiLogQueryEditor.js +19 -4
  80. package/lib/queries/loki-log-query/LokiLogQueryEditor.js.map +1 -1
  81. package/lib/queries/loki-log-query/get-loki-log-data.js.map +1 -1
  82. package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js +1 -1
  83. package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js.map +1 -1
  84. package/lib/queries/loki-time-series-query/get-loki-time-series-data.d.ts +1 -4
  85. package/lib/queries/loki-time-series-query/get-loki-time-series-data.d.ts.map +1 -1
  86. package/lib/queries/loki-time-series-query/get-loki-time-series-data.js.map +1 -1
  87. package/mf-manifest.json +107 -102
  88. package/mf-stats.json +107 -102
  89. package/package.json +7 -6
  90. package/__mf/js/Loki.c48c56a7.js +0 -5
  91. package/__mf/js/async/1360.2348e2a7.js +0 -10
  92. package/__mf/js/async/1398.ca579c40.js +0 -2
  93. package/__mf/js/async/1540.6b797827.js +0 -74
  94. package/__mf/js/async/1580.c7d3c3f1.js +0 -2
  95. package/__mf/js/async/2226.a056d1a3.js +0 -1
  96. package/__mf/js/async/2292.35c2eeec.js +0 -2
  97. package/__mf/js/async/2652.7b7038d2.js +0 -28
  98. package/__mf/js/async/282.6c4c5a94.js +0 -1
  99. package/__mf/js/async/3224.b1170acc.js +0 -1
  100. package/__mf/js/async/3431.2270637c.js +0 -1
  101. package/__mf/js/async/3863.16343b76.js +0 -2
  102. package/__mf/js/async/3960.6091bb00.js +0 -2
  103. package/__mf/js/async/3980.08ab4aef.js +0 -2
  104. package/__mf/js/async/4075.19dee570.js +0 -1
  105. package/__mf/js/async/4238.155e3b8a.js +0 -1
  106. package/__mf/js/async/4269.b4d0f49d.js +0 -2
  107. package/__mf/js/async/4310.6d2d2ce3.js +0 -7
  108. package/__mf/js/async/4421.28cc8e2d.js +0 -1
  109. package/__mf/js/async/4557.fd670526.js +0 -2
  110. package/__mf/js/async/4676.d4c41b7a.js +0 -22
  111. package/__mf/js/async/5409.ff95cf63.js +0 -1
  112. package/__mf/js/async/5780.d837c3cd.js +0 -1
  113. package/__mf/js/async/5981.a46c5157.js +0 -2
  114. package/__mf/js/async/6134.f7ee513c.js +0 -38
  115. package/__mf/js/async/6292.9997ca36.js +0 -1
  116. package/__mf/js/async/6329.9c3a3698.js +0 -2
  117. package/__mf/js/async/6333.01fb6457.js +0 -2
  118. package/__mf/js/async/6377.9f308c7f.js +0 -2
  119. package/__mf/js/async/6770.ba5a38f3.js +0 -1
  120. package/__mf/js/async/694.c25a1f84.js +0 -1
  121. package/__mf/js/async/7376.0459aaf7.js +0 -1
  122. package/__mf/js/async/738.a16c93b6.js +0 -1
  123. package/__mf/js/async/7740.6f193fac.js +0 -1
  124. package/__mf/js/async/7797.822237c9.js +0 -1
  125. package/__mf/js/async/8216.d9cc6234.js +0 -1
  126. package/__mf/js/async/8488.5b4b7170.js +0 -1
  127. package/__mf/js/async/8537.dc791586.js +0 -1
  128. package/__mf/js/async/9173.75bbe78a.js +0 -2
  129. package/__mf/js/async/9554.728cf7b9.js +0 -2
  130. package/__mf/js/async/__federation_expose_LokiDatasource.3ce6abca.js +0 -2
  131. package/__mf/js/async/__federation_expose_LokiLogQuery.c446c7ff.js +0 -1
  132. package/__mf/js/async/__federation_expose_LokiTimeSeriesQuery.eda99bf8.js +0 -1
  133. package/__mf/js/main.ccf461ea.js +0 -5
  134. /package/__mf/css/async/{1580.d3010b86.css → 3061.d3010b86.css} +0 -0
  135. /package/__mf/css/async/{2341.d3010b86.css → 5442.d3010b86.css} +0 -0
  136. /package/__mf/css/async/{6759.d3010b86.css → 7370.d3010b86.css} +0 -0
  137. /package/__mf/js/async/{4676.d4c41b7a.js.LICENSE.txt → 1490.0d8dcc42.js.LICENSE.txt} +0 -0
  138. /package/__mf/js/async/{2292.35c2eeec.js.LICENSE.txt → 2043.eb7e1c61.js.LICENSE.txt} +0 -0
  139. /package/__mf/js/async/{1398.ca579c40.js.LICENSE.txt → 2386.a3cfef97.js.LICENSE.txt} +0 -0
  140. /package/__mf/js/async/{1580.c7d3c3f1.js.LICENSE.txt → 3181.d2b90b95.js.LICENSE.txt} +0 -0
  141. /package/__mf/js/async/{4310.6d2d2ce3.js.LICENSE.txt → 3849.85df5535.js.LICENSE.txt} +0 -0
  142. /package/__mf/js/async/{5981.a46c5157.js.LICENSE.txt → 392.c0f9d49a.js.LICENSE.txt} +0 -0
  143. /package/__mf/js/async/{1964.7b2e7223.js.LICENSE.txt → 4121.328a1e93.js.LICENSE.txt} +0 -0
  144. /package/__mf/js/async/{6377.9f308c7f.js.LICENSE.txt → 5440.3fedd5ea.js.LICENSE.txt} +0 -0
  145. /package/__mf/js/async/{4557.fd670526.js.LICENSE.txt → 5501.01af8b43.js.LICENSE.txt} +0 -0
  146. /package/__mf/js/async/{3960.6091bb00.js.LICENSE.txt → 6274.293b47c4.js.LICENSE.txt} +0 -0
  147. /package/__mf/js/async/{3980.08ab4aef.js.LICENSE.txt → 6283.78af4bc8.js.LICENSE.txt} +0 -0
  148. /package/__mf/js/async/{9554.728cf7b9.js.LICENSE.txt → 6498.903f2a94.js.LICENSE.txt} +0 -0
  149. /package/__mf/js/async/{3863.16343b76.js.LICENSE.txt → 7370.0ddd349a.js.LICENSE.txt} +0 -0
  150. /package/__mf/js/async/{9173.75bbe78a.js.LICENSE.txt → 8470.c67049a2.js.LICENSE.txt} +0 -0
  151. /package/__mf/js/async/{4269.b4d0f49d.js.LICENSE.txt → 9071.ed72bdac.js.LICENSE.txt} +0 -0
  152. /package/__mf/js/async/{6329.9c3a3698.js.LICENSE.txt → 9389.a8ea42a0.js.LICENSE.txt} +0 -0
  153. /package/__mf/js/async/{6333.01fb6457.js.LICENSE.txt → 941.0bce16fe.js.LICENSE.txt} +0 -0
  154. /package/__mf/js/async/{1360.2348e2a7.js.LICENSE.txt → 9754.5d7b21c2.js.LICENSE.txt} +0 -0
  155. /package/__mf/js/async/{__federation_expose_LokiDatasource.3ce6abca.js.LICENSE.txt → __federation_expose_LokiDatasource.3da46ee2.js.LICENSE.txt} +0 -0
@@ -1,3 +1,4 @@
1
1
  export * from './loki-client';
2
+ export * from './loki-client-types';
2
3
  export * from './loki-selectors';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
@@ -11,6 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './loki-client';
14
+ export * from './loki-client-types';
14
15
  export * from './loki-selectors';
15
16
 
16
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './loki-client';\nexport * from './loki-selectors';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB"}
1
+ {"version":3,"sources":["../../../src/model/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './loki-client';\nexport * from './loki-client-types';\nexport * from './loki-selectors';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"LokiLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAOlD,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,CAoH5E"}
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;AAO3D,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,CAkI5E"}
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  // Copyright 2025 The Perses Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,10 +11,9 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { DatasourceSelect, isVariableDatasource, useDatasourceSelectValueToSelector } from '@perses-dev/plugin-system';
14
+ import { DatasourceSelect, isVariableDatasource, useDatasourceSelectValueToSelector, useDatasourceClient, useTimeRange } from '@perses-dev/plugin-system';
15
15
  import { InputLabel, Stack, ToggleButton, ToggleButtonGroup } from '@mui/material';
16
- import { useCallback } from 'react';
16
+ import { useCallback, useMemo } from 'react';
17
17
  import { produce } from 'immer';
18
18
  import { OptionsEditorControl } from '@perses-dev/components';
19
19
  import { LogQLEditor } from '../../components';
@@ -26,6 +26,20 @@ export function LokiLogQueryEditor(props) {
26
26
  const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;
27
27
  const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, LOKI_DATASOURCE_KIND);
28
28
  const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);
29
+ // Get client and time range for autocompletion
30
+ const { data: client } = useDatasourceClient(selectedDatasource);
31
+ const { absoluteTimeRange } = useTimeRange();
32
+ // Create completion config for autocompletion
33
+ const completionConfig = useMemo(()=>{
34
+ if (!client) return undefined;
35
+ return {
36
+ client,
37
+ timeRange: absoluteTimeRange
38
+ };
39
+ }, [
40
+ client,
41
+ absoluteTimeRange
42
+ ]);
29
43
  const handleDatasourceChange = (newDatasourceSelection)=>{
30
44
  if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {
31
45
  onChange(produce(value, (draft)=>{
@@ -94,7 +108,8 @@ export function LokiLogQueryEditor(props) {
94
108
  handleQueryExecute(query);
95
109
  }
96
110
  },
97
- placeholder: 'Enter LogQL query (e.g. {job="mysql"} |= "error")'
111
+ placeholder: 'Enter LogQL query (e.g. {job="mysql"} |= "error")',
112
+ completionConfig: completionConfig
98
113
  })
99
114
  ]
100
115
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack, ToggleButton, ToggleButtonGroup } from '@mui/material';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { LogQLEditor } from '../../components';\nimport { isDefaultLokiSelector, LOKI_DATASOURCE_KIND, LokiDatasourceSelector } 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 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') =>\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) => {\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={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\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","InputLabel","Stack","ToggleButton","ToggleButtonGroup","useCallback","produce","OptionsEditorControl","LogQLEditor","isDefaultLokiSelector","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiLogQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","nextDatasource","undefined","Error","handleLogsDirection","_","v","direction","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","control","exclusive","height","marginLeft","width","aria-label"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,gBAAgB;AACnF,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,qBAAqB,EAAEC,oBAAoB,QAAgC,cAAc;AAClG,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,wBAAwB;AAKtD,OAAO,SAASC,mBAAmBC,KAA2B;IAC5D,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,wBAAwBD,cAAcN;IAC5C,MAAMQ,qBAAqBpB,mCACzBmB,uBACAT;IAEF,MAAM,EAAEW,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGV,cAAcE;IAEpE,MAAMS,yBAA4D,CAACC;QACjE,IAAI,CAAC1B,qBAAqB0B,2BAA2BA,uBAAuBC,IAAI,KAAKf,iBAAiB;YACpGK,SACEV,QAAQW,OAAO,CAACU;gBACd,sFAAsF;gBACtF,MAAMC,iBAAiBnB,sBAAsBgB,0BAA0BI,YAAYJ;gBACnFE,MAAMT,UAAU,GAAGU;YACrB;YAEF;QACF;QAEA,MAAM,IAAI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;gCAAU5C,OAAM;gCAAUwB,IAAI;oCAAEG,YAAY;gCAAI;0CAAG;;;;;;;;AAS1F"}
1
+ {"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n 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') =>\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) => {\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={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\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","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","event","key","ctrlKey","metaKey","preventDefault","placeholder","control","exclusive","height","marginLeft","width","aria-label"],"mappings":";AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,EAClCC,mBAAmB,EACnBC,YAAY,QACP,4BAA4B;AACnC,SAASC,U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AAY;gCAAI;0CAAG;;;;;;;;AAS1F"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/loki-log-query/get-loki-log-data.ts"],"sourcesContent":["import { replaceVariables } from '@perses-dev/plugin-system';\nimport { LokiStreamResult } from '../../model/loki-client-types';\nimport { LokiClient } from '../../model/loki-client';\nimport { LogEntry, LogData } from '@perses-dev/core';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LokiLogQuerySpec, LokiLogQueryResponse } 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: LokiLogQueryResponse = 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,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,WAAiC,MAAMJ,OAAOK,UAAU,CAAC;QAC7DX;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
+ {"version":3,"sources":["../../../../src/queries/loki-log-query/get-loki-log-data.ts"],"sourcesContent":["import { replaceVariables } from '@perses-dev/plugin-system';\nimport { LogEntry, LogData } from '@perses-dev/core';\nimport { LokiStreamResult } from '../../model/loki-client-types';\nimport { LokiClient } from '../../model/loki-client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LokiLogQuerySpec, LokiLogQueryResponse } 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: LokiLogQueryResponse = 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,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,WAAiC,MAAMJ,OAAOK,UAAU,CAAC;QAC7DX;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,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  // Copyright 2025 The Perses Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,7 +11,6 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
13
- 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';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n 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) => {\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={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\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","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","event","key","ctrlKey","metaKey","preventDefault","placeholder"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,QAAQ,gBAAgB;AAClD,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAA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A,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBR;4BACrB;wBACF;wBACA4B,aAAY;;;;;;AAMtB"}
1
+ {"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n 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) => {\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={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\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","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","event","key","ctrlKey","metaKey","preventDefault","placeholder"],"mappings":";AAA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,MAACC;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACpC;wBACCqC,sBAAsB5B;wBACtBM,OAAOG;wBACPJ,UAAUQ;wBACVgB,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC7B;wBACCQ,OAAOI;wBACPL,UAAUc;wBACVY,QAAQnB;wBACRoB,WAAW,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBR;4BACrB;wBACF;wBACA4B,aAAY;;;;;;AAMtB"}
@@ -1,9 +1,6 @@
1
1
  import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
+ import { LokiMatrixResult } from '../../model/loki-client-types';
2
3
  import { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';
3
- export type LokiMatrixResult = {
4
- metric: Record<string, string>;
5
- values: Array<[number, string]>;
6
- };
7
4
  export type LokiMatrixResponse = {
8
5
  resultType: 'matrix';
9
6
  result: LokiMatrixResult[];
@@ -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":"AAcA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,2BAA2B,CAAC;AAIpF,OAAO,EAAE,uBAAuB,EAA+B,MAAM,gCAAgC,CAAC;AAEtG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,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"}
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":"AAcA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,2BAA2B,CAAC;AAGpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAA+B,MAAM,gCAAgC,CAAC;AAEtG,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"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeries, DurationString, parseDurationString } from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { milliseconds } from 'date-fns';\nimport { LokiClient } from '../../model/loki-client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LokiTimeSeriesQuerySpec, LokiTimeSeriesQueryResponse } from './loki-time-series-query-types';\n\nexport type LokiMatrixResult = {\n metric: Record<string, string>;\n values: Array<[number, string]>;\n};\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: LokiTimeSeriesQueryResponse = 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":["parseDurationString","replaceVariables","milliseconds","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,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAqCA,mBAAmB,QAAQ,mBAAmB;AACnF,SAAgCC,gBAAgB,QAAQ,4BAA4B;AACpF,SAASC,YAAY,QAAQ,WAAW;AAExC,SAASC,kBAAkB,QAAQ,eAAe;AAalD,sCAAsC;AACtC,MAAMC,uBAAuB,OAAO,wBAAwB;AAC5D,MAAMC,2BAA2B,IAAI,6BAA6B;AAElE;;CAEC,GACD,SAASC,yBAAyBC,cAA+B;IAC/D,IAAI,CAACA,gBAAgB,OAAOC;IAE5B,MAAMC,WAAWT,oBAAoBO;IACrC,MAAMG,KAAKR,aAAaO;IACxB,OAAOE,KAAKC,KAAK,CAACF,KAAK;AACzB;AAEA;;CAEC,GACD,SAASG,iBACPC,OAAe,EACfC,KAAa,EACbC,iBAAiBX,wBAAwB,EACzCY,kBAAkB,CAAC;IAEnB,MAAMC,uBAAuBD,kBAAkB;IAC/C,MAAME,oBAAoB,AAACJ,CAAAA,QAAQD,OAAM,IAAK;IAE9C,IAAIM,WAAWD,oBAAoBf;IACnC,IAAIgB,WAAW,GAAG;QAChBA,WAAWT,KAAKU,IAAI,CAACD;IACvB;IAEA,OAAOT,KAAKW,GAAG,CAACJ,sBAAsBF,gBAAgBI;AACxD;AAEA;;CAEC,GACD,SAASG,kBAAkBC,WAAmB;IAC5C,IAAIA,cAAc,IAAI;QACpB,OAAO,GAAGb,KAAKc,KAAK,CAACD,aAAa,CAAC,CAAC;IACtC,OAAO,IAAIA,cAAc,MAAM;QAC7B,OAAO,GAAGb,KAAKc,KAAK,CAACD,cAAc,IAAI,CAAC,CAAC;IAC3C,OAAO;QACL,OAAO,GAAGb,KAAKc,KAAK,CAACD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pEd;QACAE,OAAOA,MAAMS,OAAO,GAAGI,QAAQ;QAC/BZ,KAAKA,IAAIQ,OAAO,GAAGI,QAAQ;QAC3BL,MAAME;IACR;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
+ {"version":3,"sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeries, DurationString, parseDurationString } from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { milliseconds } from 'date-fns';\nimport { LokiClient } from '../../model/loki-client';\nimport { LokiMatrixResult } from '../../model/loki-client-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LokiTimeSeriesQuerySpec, LokiTimeSeriesQueryResponse } 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: LokiTimeSeriesQueryResponse = 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":["parseDurationString","replaceVariables","milliseconds","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,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAqCA,mBAAmB,QAAQ,mBAAmB;AACnF,SAAgCC,gBAAgB,QAAQ,4BAA4B;AAC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