@perses-dev/loki-plugin 0.5.0-rc.0 → 0.5.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/js/{Loki.21b585d6.js → Loki.2bd94c1e.js} +3 -3
- package/__mf/js/async/1728.326f0c08.js +1 -0
- package/__mf/js/async/1750.eba509e1.js +1 -0
- package/__mf/js/async/392.2c7c202d.js +2 -0
- package/__mf/js/async/54.b3492a7a.js +22 -0
- package/__mf/js/async/5440.995ad0c5.js +2 -0
- package/__mf/js/async/{5440.3fedd5ea.js.LICENSE.txt → 5440.995ad0c5.js.LICENSE.txt} +3 -3
- package/__mf/js/async/6710.a94fd362.js +2 -0
- package/__mf/js/async/7958.f25f7332.js +7 -0
- package/__mf/js/async/9010.44bf2927.js +2 -0
- package/__mf/js/async/{1238.71fd7843.js → 9249.d90da2ad.js} +1 -1
- package/__mf/js/async/9389.29616aa6.js +2 -0
- package/__mf/js/async/9877.b76d1711.js +38 -0
- package/__mf/js/async/{__federation_expose_LokiDatasource.44ac1fa6.js → __federation_expose_LokiDatasource.3fe6141d.js} +2 -2
- package/__mf/js/async/{__federation_expose_LokiLogQuery.22f7c517.js → __federation_expose_LokiLogQuery.6591d0db.js} +1 -1
- package/__mf/js/async/{__federation_expose_LokiTimeSeriesQuery.4909566f.js → __federation_expose_LokiTimeSeriesQuery.2a9b451a.js} +1 -1
- package/__mf/js/{main.59f3d316.js → main.4d84b446.js} +3 -3
- package/lib/bootstrap.js +12 -0
- package/lib/bootstrap.js.map +1 -1
- package/lib/cjs/bootstrap.js +12 -0
- package/lib/cjs/components/complete.js +260 -34
- package/lib/cjs/components/index.js +1 -1
- package/lib/cjs/components/logql-editor.js +1 -1
- package/lib/cjs/components/logql-extension.js +1 -1
- package/lib/cjs/components/logql-highlight.js +1 -1
- package/lib/cjs/datasources/index.js +1 -1
- package/lib/cjs/datasources/loki-datasource/LokiDatasource.js +1 -1
- package/lib/cjs/datasources/loki-datasource/LokiDatasourceEditor.js +1 -1
- package/lib/cjs/datasources/loki-datasource/index.js +1 -1
- package/lib/cjs/datasources/loki-datasource/loki-datasource-types.js +1 -1
- package/lib/cjs/env.d.js +12 -0
- package/lib/cjs/getPluginModule.js +12 -0
- package/lib/cjs/index-federation.js +12 -0
- package/lib/cjs/index.js +12 -0
- package/lib/cjs/model/index.js +1 -1
- package/lib/cjs/model/loki-client-types.js +1 -1
- package/lib/cjs/model/loki-client.js +1 -1
- package/lib/cjs/model/loki-data-types.js +1 -1
- package/lib/cjs/model/loki-selectors.js +1 -1
- package/lib/cjs/queries/constants.js +12 -0
- package/lib/cjs/queries/index.js +1 -1
- package/lib/cjs/queries/loki-log-query/LokiLogQuery.js +12 -0
- package/lib/cjs/queries/loki-log-query/LokiLogQueryEditor.js +1 -1
- package/lib/cjs/queries/loki-log-query/get-loki-log-data.js +12 -0
- package/lib/cjs/queries/loki-log-query/index.js +12 -0
- package/lib/cjs/queries/loki-log-query/log-query-plugin-interface.js +12 -0
- package/lib/cjs/queries/loki-log-query/loki-log-query-types.js +12 -0
- package/lib/cjs/queries/loki-time-series-query/LokiTimeSeriesQuery.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/get-loki-time-series-data.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/index.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/loki-time-series-query-types.js +1 -1
- package/lib/cjs/queries/query-editor-model.js +1 -1
- package/lib/cjs/setup-tests.js +12 -0
- package/lib/components/complete.d.ts +5 -0
- package/lib/components/complete.d.ts.map +1 -1
- package/lib/components/complete.js +259 -33
- package/lib/components/complete.js.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/logql-editor.js +1 -1
- package/lib/components/logql-editor.js.map +1 -1
- package/lib/components/logql-extension.js +1 -1
- package/lib/components/logql-extension.js.map +1 -1
- package/lib/components/logql-highlight.js +1 -1
- package/lib/components/logql-highlight.js.map +1 -1
- package/lib/datasources/index.js +1 -1
- package/lib/datasources/index.js.map +1 -1
- package/lib/datasources/loki-datasource/LokiDatasource.js +1 -1
- package/lib/datasources/loki-datasource/LokiDatasource.js.map +1 -1
- package/lib/datasources/loki-datasource/LokiDatasourceEditor.js +1 -1
- package/lib/datasources/loki-datasource/LokiDatasourceEditor.js.map +1 -1
- package/lib/datasources/loki-datasource/index.js +1 -1
- package/lib/datasources/loki-datasource/index.js.map +1 -1
- package/lib/datasources/loki-datasource/loki-datasource-types.js +1 -1
- package/lib/datasources/loki-datasource/loki-datasource-types.js.map +1 -1
- package/lib/env.d.js +12 -0
- package/lib/env.d.js.map +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +12 -0
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +12 -0
- package/lib/index-federation.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -1
- package/lib/model/index.js +1 -1
- package/lib/model/index.js.map +1 -1
- package/lib/model/loki-client-types.js +1 -1
- package/lib/model/loki-client-types.js.map +1 -1
- package/lib/model/loki-client.js +1 -1
- package/lib/model/loki-client.js.map +1 -1
- package/lib/model/loki-data-types.js +1 -1
- package/lib/model/loki-data-types.js.map +1 -1
- package/lib/model/loki-selectors.js +1 -1
- package/lib/model/loki-selectors.js.map +1 -1
- package/lib/queries/constants.d.ts.map +1 -1
- package/lib/queries/constants.js +12 -0
- package/lib/queries/constants.js.map +1 -1
- package/lib/queries/index.js +1 -1
- package/lib/queries/index.js.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQuery.d.ts.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQuery.js +12 -0
- package/lib/queries/loki-log-query/LokiLogQuery.js.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQueryEditor.js +1 -1
- 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 +12 -0
- package/lib/queries/loki-log-query/get-loki-log-data.js.map +1 -1
- package/lib/queries/loki-log-query/index.d.ts.map +1 -1
- package/lib/queries/loki-log-query/index.js +12 -0
- package/lib/queries/loki-log-query/index.js.map +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 +12 -0
- 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.map +1 -1
- package/lib/queries/loki-log-query/loki-log-query-types.js +12 -0
- package/lib/queries/loki-log-query/loki-log-query-types.js.map +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQuery.js +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQuery.js.map +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js.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/index.js +1 -1
- package/lib/queries/loki-time-series-query/index.js.map +1 -1
- package/lib/queries/loki-time-series-query/loki-time-series-query-types.js +1 -1
- package/lib/queries/loki-time-series-query/loki-time-series-query-types.js.map +1 -1
- package/lib/queries/query-editor-model.js +1 -1
- package/lib/queries/query-editor-model.js.map +1 -1
- package/lib/setup-tests.d.ts.map +1 -1
- package/lib/setup-tests.js +12 -0
- package/lib/setup-tests.js.map +1 -1
- package/mf-manifest.json +46 -46
- package/mf-stats.json +46 -46
- package/package.json +6 -6
- package/__mf/js/async/1490.5aa6cbcc.js +0 -22
- package/__mf/js/async/1501.f1011a16.js +0 -1
- package/__mf/js/async/1728.516fcaaf.js +0 -1
- package/__mf/js/async/3849.89f86737.js +0 -7
- package/__mf/js/async/392.c0f9d49a.js +0 -2
- package/__mf/js/async/5440.3fedd5ea.js +0 -2
- package/__mf/js/async/5501.929e6257.js +0 -2
- package/__mf/js/async/6498.903f2a94.js +0 -2
- package/__mf/js/async/8035.8dab4893.js +0 -38
- package/__mf/js/async/9389.a8ea42a0.js +0 -2
- /package/__mf/js/async/{392.c0f9d49a.js.LICENSE.txt → 392.2c7c202d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1490.5aa6cbcc.js.LICENSE.txt → 54.b3492a7a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6498.903f2a94.js.LICENSE.txt → 6710.a94fd362.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3849.89f86737.js.LICENSE.txt → 7958.f25f7332.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5501.929e6257.js.LICENSE.txt → 9010.44bf2927.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9389.a8ea42a0.js.LICENSE.txt → 9389.29616aa6.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_LokiDatasource.44ac1fa6.js.LICENSE.txt → __federation_expose_LokiDatasource.3fe6141d.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/datasources/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/datasources/index.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\nexport * from './loki-datasource';\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;AAEjC,cAAc,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/datasources/loki-datasource/LokiDatasource.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/datasources/loki-datasource/LokiDatasource.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 { DatasourcePlugin } from '@perses-dev/plugin-system';\nimport {\n LokiClient,\n query,\n queryRange,\n labels,\n labelValues,\n series,\n volume,\n volumeRange,\n indexStats,\n} from '../../model/loki-client';\nimport { LokiDatasourceSpec } from './loki-datasource-types';\nimport { LokiDatasourceEditor } from './LokiDatasourceEditor';\n\nconst createClient: DatasourcePlugin<LokiDatasourceSpec, LokiClient>['createClient'] = (spec, options) => {\n const { directUrl, proxy } = spec;\n const { proxyUrl } = options;\n\n const datasourceUrl = directUrl ?? proxyUrl;\n if (datasourceUrl === undefined) {\n throw new Error('No URL specified for Loki client. You can use directUrl in the spec to configure it.');\n }\n\n const specHeaders = proxy?.spec.headers;\n\n return {\n options: {\n datasourceUrl,\n },\n query: (params, headers) => query(params, { datasourceUrl, headers: headers ?? specHeaders }),\n queryRange: (params, headers) => queryRange(params, { datasourceUrl, headers: headers ?? specHeaders }),\n labels: (start, end, headers) => labels(start, end, { datasourceUrl, headers: headers ?? specHeaders }),\n labelValues: (label, start, end, headers) =>\n labelValues(label, start, end, { datasourceUrl, headers: headers ?? specHeaders }),\n series: (match, start, end, headers) =>\n series(match, start, end, { datasourceUrl, headers: headers ?? specHeaders }),\n volume: (params, headers) => volume(params, { datasourceUrl, headers: headers ?? specHeaders }),\n volumeRange: (params, headers) => volumeRange(params, { datasourceUrl, headers: headers ?? specHeaders }),\n indexStats: (query, start, end, headers) =>\n indexStats(query, start, end, { datasourceUrl, headers: headers ?? specHeaders }),\n };\n};\n\nexport const LokiDatasource: DatasourcePlugin<LokiDatasourceSpec, LokiClient> = {\n createClient,\n OptionsEditorComponent: LokiDatasourceEditor,\n createInitialOptions: () => ({ directUrl: '' }),\n};\n"],"names":["query","queryRange","labels","labelValues","series","volume","volumeRange","indexStats","LokiDatasourceEditor","createClient","spec","options","directUrl","proxy","proxyUrl","datasourceUrl","undefined","Error","specHeaders","headers","params","start","end","label","match","LokiDatasource","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;AAGjC,SAEEA,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,MAAM,EACNC,WAAW,EACXC,UAAU,QACL,0BAA0B;AAEjC,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,MAAMC,eAAiF,CAACC,MAAMC;IAC5F,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGH;IAC7B,MAAM,EAAEI,QAAQ,EAAE,GAAGH;IAErB,MAAMI,gBAAgBH,aAAaE;IACnC,IAAIC,kBAAkBC,WAAW;QAC/B,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,cAAcL,OAAOH,KAAKS;IAEhC,OAAO;QACLR,SAAS;YACPI;QACF;QACAf,OAAO,CAACoB,QAAQD,UAAYnB,MAAMoB,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC3FjB,YAAY,CAACmB,QAAQD,UAAYlB,WAAWmB,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QACrGhB,QAAQ,CAACmB,OAAOC,KAAKH,UAAYjB,OAAOmB,OAAOC,KAAK;gBAAEP;gBAAeI,SAASA,WAAWD;YAAY;QACrGf,aAAa,CAACoB,OAAOF,OAAOC,KAAKH,UAC/BhB,YAAYoB,OAAOF,OAAOC,KAAK;gBAAEP;gBAAeI,SAASA,WAAWD;YAAY;QAClFd,QAAQ,CAACoB,OAAOH,OAAOC,KAAKH,UAC1Bf,OAAOoB,OAAOH,OAAOC,KAAK;gBAAEP;gBAAeI,SAASA,WAAWD;YAAY;QAC7Eb,QAAQ,CAACe,QAAQD,UAAYd,OAAOe,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QAC7FZ,aAAa,CAACc,QAAQD,UAAYb,YAAYc,QAAQ;gBAAEL;gBAAeI,SAASA,WAAWD;YAAY;QACvGX,YAAY,CAACP,OAAOqB,OAAOC,KAAKH,UAC9BZ,WAAWP,OAAOqB,OAAOC,KAAK;gBAAEP;gBAAeI,SAASA,WAAWD;YAAY;IACnF;AACF;AAEA,OAAO,MAAMO,iBAAmE;IAC9EhB;IACAiB,wBAAwBlB;IACxBmB,sBAAsB,IAAO,CAAA;YAAEf,WAAW;QAAG,CAAA;AAC/C,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
5
5
|
// You may obtain a copy of the License at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/datasources/loki-datasource/LokiDatasourceEditor.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/datasources/loki-datasource/LokiDatasourceEditor.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 { HTTPSettingsEditor } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\nimport { LokiDatasourceSpec } from './loki-datasource-types';\n\nexport interface LokiDatasourceEditorProps {\n value: LokiDatasourceSpec;\n onChange: (next: LokiDatasourceSpec) => void;\n isReadonly?: boolean;\n}\n\nexport function LokiDatasourceEditor(props: LokiDatasourceEditorProps): ReactElement {\n const { value, onChange, isReadonly } = props;\n\n const initialSpecDirect: LokiDatasourceSpec = {\n directUrl: '',\n };\n\n const initialSpecProxy: LokiDatasourceSpec = {\n proxy: {\n kind: 'HTTPProxy',\n spec: {\n allowedEndpoints: [\n {\n endpointPattern: '/loki/api/v1/query',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/query_range',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/labels',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/label/([a-zA-Z0-9_-]+)/values',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/series',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/index/volume',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/index/volume_range',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/index/stats',\n method: 'GET',\n },\n {\n endpointPattern: '/loki/api/v1/tail',\n method: 'GET',\n },\n ],\n url: '',\n },\n },\n };\n\n return (\n <HTTPSettingsEditor\n value={value}\n onChange={onChange}\n isReadonly={isReadonly}\n initialSpecDirect={initialSpecDirect}\n initialSpecProxy={initialSpecProxy}\n />\n );\n}\n"],"names":["HTTPSettingsEditor","LokiDatasourceEditor","props","value","onChange","isReadonly","initialSpecDirect","directUrl","initialSpecProxy","proxy","kind","spec","allowedEndpoints","endpointPattern","method","url"],"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,SAASA,kBAAkB,QAAQ,4BAA4B;AAU/D,OAAO,SAASC,qBAAqBC,KAAgC;IACnE,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGH;IAExC,MAAMI,oBAAwC;QAC5CC,WAAW;IACb;IAEA,MAAMC,mBAAuC;QAC3CC,OAAO;YACLC,MAAM;YACNC,MAAM;gBACJC,kBAAkB;oBAChB;wBACEC,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;oBACA;wBACED,iBAAiB;wBACjBC,QAAQ;oBACV;iBACD;gBACDC,KAAK;YACP;QACF;IACF;IAEA,qBACE,KAACf;QACCG,OAAOA;QACPC,UAAUA;QACVC,YAAYA;QACZC,mBAAmBA;QACnBE,kBAAkBA;;AAGxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/datasources/loki-datasource/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/datasources/loki-datasource/index.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\nexport * from './LokiDatasource';\nexport * from './LokiDatasourceEditor';\nexport * from './loki-datasource-types';\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;AAEjC,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,0BAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/datasources/loki-datasource/loki-datasource-types.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/datasources/loki-datasource/loki-datasource-types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { HTTPProxy } from '@perses-dev/core';\n\nexport interface LokiDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
|
package/lib/env.d.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
/// <reference types="@rsbuild/core/types" />
|
|
2
14
|
|
|
3
15
|
//# sourceMappingURL=env.d.js.map
|
package/lib/env.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/env.d.ts"],"sourcesContent":["/// <reference types=\"@rsbuild/core/types\" />\n"],"names":[],"mappings":"AAAA,6CAA6C"}
|
|
1
|
+
{"version":3,"sources":["../../src/env.d.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\n/// <reference types=\"@rsbuild/core/types\" />\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;AAEjC,6CAA6C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
|
package/lib/getPluginModule.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
import packageJson from '../package.json';
|
|
2
14
|
/**
|
|
3
15
|
* Returns the plugin module information from package.json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getPluginModule.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/getPluginModule.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 { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\nimport packageJson from '../package.json';\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","getPluginModule","name","version","perses","kind","metadata","spec"],"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;AAGjC,OAAOA,iBAAiB,kBAAkB;AAE1C;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAClC,OAAO;QACLK,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
|
package/lib/index-federation.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
import('./bootstrap');
|
|
2
14
|
|
|
3
15
|
//# sourceMappingURL=index-federation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index-federation.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/index-federation.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('./bootstrap');\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;AAEjC,MAAM,CAAC"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
export { getPluginModule } from './getPluginModule';
|
|
2
14
|
export * from './model';
|
|
3
15
|
export * from './queries';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/index.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\nexport { getPluginModule } from './getPluginModule';\nexport * from './model';\nexport * from './queries';\nexport * from './datasources';\n"],"names":["getPluginModule"],"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,eAAe,QAAQ,oBAAoB;AACpD,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,cAAc,gBAAgB"}
|
package/lib/model/index.js
CHANGED
package/lib/model/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/model/index.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\nexport * from './loki-client';\nexport * from './loki-client-types';\nexport * from './loki-selectors';\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;AAEjC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/loki-client-types.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/model/loki-client-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\nexport type LokiResultType = 'vector' | 'matrix' | 'streams';\n\nexport interface LokiQueryStats {\n ingester?: Record<string, unknown>;\n store?: Record<string, unknown>;\n summary?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\nexport interface LokiVectorResult {\n metric: Record<string, string>;\n value: [number, string];\n}\n\nexport interface LokiMatrixResult {\n metric: Record<string, string>;\n values: Array<[number, string]>;\n}\n\nexport interface LokiStreamResult {\n stream: Record<string, string>;\n values: Array<[string, string]>;\n}\n\nexport interface LokiQueryResponse {\n status: 'success' | 'error';\n data: {\n resultType: 'vector' | 'streams';\n result: LokiVectorResult[] | LokiStreamResult[];\n stats?: LokiQueryStats;\n };\n}\n\nexport type LokiQueryRangeResponse = LokiQueryRangeMatrixResponse & LokiQueryRangeStreamsResponse;\n\nexport interface LokiQueryRangeMatrixResponse {\n status: 'success' | 'error';\n data: {\n resultType: 'matrix';\n result: LokiMatrixResult[];\n stats?: LokiQueryStats;\n };\n}\n\nexport interface LokiQueryRangeStreamsResponse {\n status: 'success' | 'error';\n data: {\n resultType: 'streams';\n result: LokiStreamResult[];\n stats?: LokiQueryStats;\n };\n}\nexport interface LokiLabelsResponse {\n status: 'success' | 'error';\n data: string[];\n}\n\nexport interface LokiLabelValuesResponse {\n status: 'success' | 'error';\n data: string[];\n}\n\nexport interface LokiSeriesResponse {\n status: 'success' | 'error';\n data: Array<Record<string, string>>;\n}\n\nexport interface LokiIndexStatsResponse {\n streams: number;\n chunks: number;\n entries: number;\n bytes: number;\n}\n\nexport type LokiVolumeResponse = Record<string, unknown>;\n\nexport type LokiRequestHeaders = Record<string, string>;\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;AA8EjC,WAAwD"}
|
package/lib/model/loki-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/loki-client.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n LokiQueryResponse,\n LokiQueryRangeResponse,\n LokiLabelsResponse,\n LokiLabelValuesResponse,\n LokiSeriesResponse,\n LokiIndexStatsResponse,\n LokiVolumeResponse,\n LokiRequestHeaders,\n} from './loki-client-types';\n\nexport interface LokiQueryParams {\n query: string;\n time?: string;\n direction?: 'forward' | 'backward';\n limit?: number;\n}\n\nexport interface LokiQueryRangeParams {\n query: string;\n start: string;\n end: string;\n step?: string;\n interval?: string;\n direction?: 'forward' | 'backward';\n limit?: number;\n}\n\nexport interface LokiVolumeParams {\n query: string;\n start: string;\n end: string;\n step?: string;\n limit?: number;\n}\n\nexport interface LokiApiOptions {\n datasourceUrl: string;\n headers?: LokiRequestHeaders;\n}\n\nexport interface LokiClient {\n options: {\n datasourceUrl: string;\n };\n query: (params: LokiQueryParams, headers?: LokiRequestHeaders) => Promise<LokiQueryResponse>;\n queryRange: (params: LokiQueryRangeParams, headers?: LokiRequestHeaders) => Promise<LokiQueryRangeResponse>;\n labels: (start?: string, end?: string, headers?: LokiRequestHeaders) => Promise<LokiLabelsResponse>;\n labelValues: (\n label: string,\n start?: string,\n end?: string,\n headers?: LokiRequestHeaders\n ) => Promise<LokiLabelValuesResponse>;\n series: (match: string[], start?: string, end?: string, headers?: LokiRequestHeaders) => Promise<LokiSeriesResponse>;\n volume: (params: LokiVolumeParams, headers?: LokiRequestHeaders) => Promise<LokiVolumeResponse>;\n volumeRange: (params: LokiVolumeParams, headers?: LokiRequestHeaders) => Promise<LokiVolumeResponse>;\n indexStats: (\n query: string,\n start?: string,\n end?: string,\n headers?: LokiRequestHeaders\n ) => Promise<LokiIndexStatsResponse>;\n}\n\nexport async function query(params: LokiQueryParams, options: LokiApiOptions): Promise<LokiQueryResponse> {\n const url = buildUrl('/loki/api/v1/query', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n if (params.time) url.searchParams.append('time', params.time);\n if (params.direction) url.searchParams.append('direction', params.direction);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nfunction buildUrl(path: string, datasourceUrl: string): URL {\n if (datasourceUrl.startsWith('http://') || datasourceUrl.startsWith('https://')) {\n return new URL(path, datasourceUrl);\n }\n\n let fullPath = datasourceUrl;\n // Assume relative path, ensure no double slashes\n if (datasourceUrl.endsWith('/') && path.startsWith('/')) {\n fullPath = datasourceUrl + path.slice(1);\n } else if (!datasourceUrl.endsWith('/') && !path.startsWith('/')) {\n fullPath = datasourceUrl + '/' + path;\n } else {\n fullPath = datasourceUrl + path;\n }\n\n return new URL(fullPath, window.location.origin);\n}\n\nexport function toUnixSeconds(val: string | number | Date): string {\n if (val instanceof Date) return Math.floor(val.getTime() / 1000).toString();\n if (typeof val === 'number') {\n // If it's in ms (>= 10^12), convert to s\n return Math.floor(val > 1e11 ? val / 1000 : val).toString();\n }\n if (/^\\d+$/.test(val)) {\n const num = Number(val);\n return Math.floor(num > 1e11 ? num / 1000 : num).toString();\n }\n const d = new Date(val);\n return Math.floor(d.getTime() / 1000).toString();\n}\n\nexport async function queryRange(\n params: LokiQueryRangeParams,\n options: LokiApiOptions\n): Promise<LokiQueryRangeResponse> {\n const url = buildUrl('/loki/api/v1/query_range', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n url.searchParams.append('start', toUnixSeconds(params.start));\n url.searchParams.append('end', toUnixSeconds(params.end));\n if (params.step) url.searchParams.append('step', params.step);\n if (params.interval) url.searchParams.append('interval', params.interval);\n if (params.direction) url.searchParams.append('direction', params.direction);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function labels(\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiLabelsResponse> {\n const url = buildUrl('/loki/api/v1/labels', options.datasourceUrl);\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function labelValues(\n label: string,\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiLabelValuesResponse> {\n const url = buildUrl(`/loki/api/v1/label/${label}/values`, options.datasourceUrl);\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function series(\n match: string[],\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiSeriesResponse> {\n const url = buildUrl('/loki/api/v1/series', options.datasourceUrl);\n match.forEach((m) => url.searchParams.append('match[]', m));\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function volume(params: LokiVolumeParams, options: LokiApiOptions): Promise<LokiVolumeResponse> {\n const url = buildUrl('/loki/api/v1/index/volume', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n url.searchParams.append('start', params.start);\n url.searchParams.append('end', params.end);\n if (params.step) url.searchParams.append('step', params.step);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function volumeRange(params: LokiVolumeParams, options: LokiApiOptions): Promise<LokiVolumeResponse> {\n const url = buildUrl('/loki/api/v1/index/volume_range', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n url.searchParams.append('start', params.start);\n url.searchParams.append('end', params.end);\n if (params.step) url.searchParams.append('step', params.step);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function indexStats(\n query: string,\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiIndexStatsResponse> {\n const url = buildUrl('/loki/api/v1/index/stats', options.datasourceUrl);\n url.searchParams.append('query', query);\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n"],"names":["query","params","options","url","buildUrl","datasourceUrl","searchParams","append","time","direction","limit","toString","response","fetch","method","headers","json","path","startsWith","URL","fullPath","endsWith","slice","window","location","origin","toUnixSeconds","val","Date","Math","floor","getTime","test","num","Number","d","queryRange","start","end","step","interval","labels","labelValues","label","series","match","forEach","m","volume","volumeRange","indexStats"],"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;AAmEjC,OAAO,eAAeA,MAAMC,MAAuB,EAAEC,OAAuB;IAC1E,MAAMC,MAAMC,SAAS,sBAAsBF,QAAQG,aAAa;IAChEF,IAAIG,YAAY,CAACC,MAAM,CAAC,SAASN,OAAOD,KAAK;IAC7C,IAAIC,OAAOO,IAAI,EAAEL,IAAIG,YAAY,CAACC,MAAM,CAAC,QAAQN,OAAOO,IAAI;IAC5D,IAAIP,OAAOQ,SAAS,EAAEN,IAAIG,YAAY,CAACC,MAAM,CAAC,aAAaN,OAAOQ,SA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AIqC,OAAOlC,IAAIG,YAAY,CAACC,MAAM,CAAC,SAAS8B;IAC5C,IAAIC,KAAKnC,IAAIG,YAAY,CAACC,MAAM,CAAC,OAAO+B;IAExC,MAAM1B,WAAW,MAAMC,MAAMV,IAAIQ,QAAQ,IAAI;QAC3CG,QAAQ;QACRC,SAAS;YACP,gBAAgB;YAChB,GAAGb,QAAQa,OAAO;QACpB;IACF;IACA,OAAOH,SAASI,IAAI;AACtB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/model/loki-client.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 {\n LokiQueryResponse,\n LokiQueryRangeResponse,\n LokiLabelsResponse,\n LokiLabelValuesResponse,\n LokiSeriesResponse,\n LokiIndexStatsResponse,\n LokiVolumeResponse,\n LokiRequestHeaders,\n} from './loki-client-types';\n\nexport interface LokiQueryParams {\n query: string;\n time?: string;\n direction?: 'forward' | 'backward';\n limit?: number;\n}\n\nexport interface LokiQueryRangeParams {\n query: string;\n start: string;\n end: string;\n step?: string;\n interval?: string;\n direction?: 'forward' | 'backward';\n limit?: number;\n}\n\nexport interface LokiVolumeParams {\n query: string;\n start: string;\n end: string;\n step?: string;\n limit?: number;\n}\n\nexport interface LokiApiOptions {\n datasourceUrl: string;\n headers?: LokiRequestHeaders;\n}\n\nexport interface LokiClient {\n options: {\n datasourceUrl: string;\n };\n query: (params: LokiQueryParams, headers?: LokiRequestHeaders) => Promise<LokiQueryResponse>;\n queryRange: (params: LokiQueryRangeParams, headers?: LokiRequestHeaders) => Promise<LokiQueryRangeResponse>;\n labels: (start?: string, end?: string, headers?: LokiRequestHeaders) => Promise<LokiLabelsResponse>;\n labelValues: (\n label: string,\n start?: string,\n end?: string,\n headers?: LokiRequestHeaders\n ) => Promise<LokiLabelValuesResponse>;\n series: (match: string[], start?: string, end?: string, headers?: LokiRequestHeaders) => Promise<LokiSeriesResponse>;\n volume: (params: LokiVolumeParams, headers?: LokiRequestHeaders) => Promise<LokiVolumeResponse>;\n volumeRange: (params: LokiVolumeParams, headers?: LokiRequestHeaders) => Promise<LokiVolumeResponse>;\n indexStats: (\n query: string,\n start?: string,\n end?: string,\n headers?: LokiRequestHeaders\n ) => Promise<LokiIndexStatsResponse>;\n}\n\nexport async function query(params: LokiQueryParams, options: LokiApiOptions): Promise<LokiQueryResponse> {\n const url = buildUrl('/loki/api/v1/query', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n if (params.time) url.searchParams.append('time', params.time);\n if (params.direction) url.searchParams.append('direction', params.direction);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nfunction buildUrl(path: string, datasourceUrl: string): URL {\n if (datasourceUrl.startsWith('http://') || datasourceUrl.startsWith('https://')) {\n return new URL(path, datasourceUrl);\n }\n\n let fullPath = datasourceUrl;\n // Assume relative path, ensure no double slashes\n if (datasourceUrl.endsWith('/') && path.startsWith('/')) {\n fullPath = datasourceUrl + path.slice(1);\n } else if (!datasourceUrl.endsWith('/') && !path.startsWith('/')) {\n fullPath = datasourceUrl + '/' + path;\n } else {\n fullPath = datasourceUrl + path;\n }\n\n return new URL(fullPath, window.location.origin);\n}\n\nexport function toUnixSeconds(val: string | number | Date): string {\n if (val instanceof Date) return Math.floor(val.getTime() / 1000).toString();\n if (typeof val === 'number') {\n // If it's in ms (>= 10^12), convert to s\n return Math.floor(val > 1e11 ? val / 1000 : val).toString();\n }\n if (/^\\d+$/.test(val)) {\n const num = Number(val);\n return Math.floor(num > 1e11 ? num / 1000 : num).toString();\n }\n const d = new Date(val);\n return Math.floor(d.getTime() / 1000).toString();\n}\n\nexport async function queryRange(\n params: LokiQueryRangeParams,\n options: LokiApiOptions\n): Promise<LokiQueryRangeResponse> {\n const url = buildUrl('/loki/api/v1/query_range', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n url.searchParams.append('start', toUnixSeconds(params.start));\n url.searchParams.append('end', toUnixSeconds(params.end));\n if (params.step) url.searchParams.append('step', params.step);\n if (params.interval) url.searchParams.append('interval', params.interval);\n if (params.direction) url.searchParams.append('direction', params.direction);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function labels(\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiLabelsResponse> {\n const url = buildUrl('/loki/api/v1/labels', options.datasourceUrl);\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function labelValues(\n label: string,\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiLabelValuesResponse> {\n const url = buildUrl(`/loki/api/v1/label/${label}/values`, options.datasourceUrl);\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function series(\n match: string[],\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiSeriesResponse> {\n const url = buildUrl('/loki/api/v1/series', options.datasourceUrl);\n match.forEach((m) => url.searchParams.append('match[]', m));\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function volume(params: LokiVolumeParams, options: LokiApiOptions): Promise<LokiVolumeResponse> {\n const url = buildUrl('/loki/api/v1/index/volume', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n url.searchParams.append('start', params.start);\n url.searchParams.append('end', params.end);\n if (params.step) url.searchParams.append('step', params.step);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function volumeRange(params: LokiVolumeParams, options: LokiApiOptions): Promise<LokiVolumeResponse> {\n const url = buildUrl('/loki/api/v1/index/volume_range', options.datasourceUrl);\n url.searchParams.append('query', params.query);\n url.searchParams.append('start', params.start);\n url.searchParams.append('end', params.end);\n if (params.step) url.searchParams.append('step', params.step);\n if (params.limit) url.searchParams.append('limit', params.limit.toString());\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n\nexport async function indexStats(\n query: string,\n start: string | undefined,\n end: string | undefined,\n options: LokiApiOptions\n): Promise<LokiIndexStatsResponse> {\n const url = buildUrl('/loki/api/v1/index/stats', options.datasourceUrl);\n url.searchParams.append('query', query);\n if (start) url.searchParams.append('start', start);\n if (end) url.searchParams.append('end', end);\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n return response.json();\n}\n"],"names":["query","params","options","url","buildUrl","datasourceUrl","searchParams","append","time","direction","limit","toString","response","fetch","method","headers","json","path","startsWith","URL","fullPath","endsWith","slice","window","location","origin","toUnixSeconds","val","Date","Math","floor","getTime","test","num","Number","d","queryRange","start","end","step","interval","labels","labelValues","label","series","match","forEach","m","volume","volumeRange","indexStats"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;A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AAC,QAAQN,OAAOsC,IAAI;IAC5D,IAAItC,OAAOS,KAAK,EAAEP,IAAIG,YAAY,CAACC,MAAM,CAAC,SAASN,OAAOS,KAAK,CAACC,QAAQ;IAExE,MAAMC,WAAW,MAAMC,MAAMV,IAAIQ,QAAQ,IAAI;QAC3CG,QAAQ;QACRC,SAAS;YACP,gBAAgB;YAChB,GAAGb,QAAQa,OAAO;QACpB;IACF;IACA,OAAOH,SAASI,IAAI;AACtB;AAEA,OAAO,eAAekC,WACpBlD,KAAa,EACbqC,KAAyB,EACzBC,GAAuB,EACvBpC,OAAuB;IAEvB,MAAMC,MAAMC,SAAS,4BAA4BF,QAAQG,aAAa;IACtEF,IAAIG,YAAY,CAACC,MAAM,CAAC,SAASP;IACjC,IAAIqC,OAAOlC,IAAIG,YAAY,CAACC,MAAM,CAAC,SAAS8B;IAC5C,IAAIC,KAAKnC,IAAIG,YAAY,CAACC,MAAM,CAAC,OAAO+B;IAExC,MAAM1B,WAAW,MAAMC,MAAMV,IAAIQ,QAAQ,IAAI;QAC3CG,QAAQ;QACRC,SAAS;YACP,gBAAgB;YAChB,GAAGb,QAAQa,OAAO;QACpB;IACF;IACA,OAAOH,SAASI,IAAI;AACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/loki-data-types.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/model/loki-data-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 { LogData, AbsoluteTimeRange, TimeSeries, TimeSeriesData, TimeSeriesMetadata } from '@perses-dev/core';\n\nexport interface LokiTimeSeriesData extends TimeSeriesData {\n logs?: LogData;\n resultType?: 'matrix' | 'streams';\n}\n\nexport interface LokiQueryResult {\n timeRange?: AbsoluteTimeRange;\n stepMs?: number;\n series: TimeSeries[];\n logs?: LogData;\n resultType: 'matrix' | 'streams';\n metadata?: TimeSeriesMetadata;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC,WAOC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/loki-selectors.ts"],"sourcesContent":["// Copyright
|
|
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 { DatasourceSelector } from '@perses-dev/core';\nimport { DatasourceSelectValue, isVariableDatasource } from '@perses-dev/plugin-system';\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;AAGjC,SAAgCA,oBAAoB,QAAQ,4BAA4B;AAExF,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":"constants.d.ts","sourceRoot":"","sources":["../../../src/queries/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/queries/constants.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAChD,eAAO,MAAM,kBAAkB;;CAA4B,CAAC"}
|
package/lib/queries/constants.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
export const DATASOURCE_KIND = 'LokiDatasource';
|
|
2
14
|
export const DEFAULT_DATASOURCE = {
|
|
3
15
|
kind: DATASOURCE_KIND
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/queries/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/queries/constants.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\nexport const DATASOURCE_KIND = 'LokiDatasource';\nexport const DEFAULT_DATASOURCE = { kind: DATASOURCE_KIND };\n"],"names":["DATASOURCE_KIND","DEFAULT_DATASOURCE","kind"],"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,OAAO,MAAMA,kBAAkB,iBAAiB;AAChD,OAAO,MAAMC,qBAAqB;IAAEC,MAAMF;AAAgB,EAAE"}
|
package/lib/queries/index.js
CHANGED
package/lib/queries/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/queries/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/queries/index.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\nexport * from './loki-time-series-query';\nexport * from './loki-log-query';\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;AAEjC,cAAc,2BAA2B;AACzC,cAAc,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LokiLogQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/LokiLogQuery.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LokiLogQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/LokiLogQuery.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,gBAAgB,CAWzD,CAAC"}
|
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
import { parseVariables } from '@perses-dev/plugin-system';
|
|
2
14
|
import { getLokiLogData } from './get-loki-log-data';
|
|
3
15
|
import { LokiLogQueryEditor } from './LokiLogQueryEditor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQuery.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQuery.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 { parseVariables } from '@perses-dev/plugin-system';\nimport { getLokiLogData } from './get-loki-log-data';\nimport { LokiLogQueryEditor } from './LokiLogQueryEditor';\nimport { LokiLogQuerySpec } from './loki-log-query-types';\nimport { LogQueryPlugin } from './log-query-plugin-interface';\n\nexport const LokiLogQuery: LogQueryPlugin<LokiLogQuerySpec> = {\n getLogData: getLokiLogData,\n OptionsEditorComponent: LokiLogQueryEditor,\n createInitialOptions: () => ({ query: '' }),\n dependsOn: (spec) => {\n const queryVariables = parseVariables(spec.query);\n const allVariables = [...new Set([...queryVariables])];\n return {\n variables: allVariables,\n };\n },\n};\n"],"names":["parseVariables","getLokiLogData","LokiLogQueryEditor","LokiLogQuery","getLogData","OptionsEditorComponent","createInitialOptions","query","dependsOn","spec","queryVariables","allVariables","Set","variables"],"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,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,kBAAkB,QAAQ,uBAAuB;AAI1D,OAAO,MAAMC,eAAiD;IAC5DC,YAAYH;IACZI,wBAAwBH;IACxBI,sBAAsB,IAAO,CAAA;YAAEC,OAAO;QAAG,CAAA;IACzCC,WAAW,CAACC;QACV,MAAMC,iBAAiBV,eAAeS,KAAKF,KAAK;QAChD,MAAMI,eAAe;eAAI,IAAIC,IAAI;mBAAIF;aAAe;SAAE;QACtD,OAAO;YACLG,WAAWF;QACb;IACF;AACF,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
5
5
|
// You may obtain a copy of the License at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"sourcesContent":["// Copyright
|
|
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') =>\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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,EAClCC,mBAAmB,EACnBC,YAAY,QACP,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,gBAAgB;AACnF,SAAuBC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAC3D,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,qBAAqB,EAAEC,oBAAoB,QAA4C,cAAc;AAC9G,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,wBAAwB;AAKtD,OAAO,SAASC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4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACtD;wBACCuD,sBAAsBvC;wBACtBM,OAAOG;wBACPJ,UAAUc;wBACVqB,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC7C;wBACC8C,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACzC;wBACCS,OAAOI;wBACPL,UAAUyB;wBACVY,QAAQ9B;wBACR+B,WAAW,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBnB;4BACrB;wBACF;wBACAuC,aAAY;wBACZjC,kBAAkBA;;;;0BAItB,KAACkB;0BACC,cAAA,KAACtC;oBACC4C,OAAM;oBACN,kEAAkE;oBAClEU,uBACE,MAAC1D;wBACC2D,SAAS;wBACT7C,OAAOA,OAAOsB,aAAa;wBAC3BvB,UAAUoB;wBACVU,IAAI;4BAAEiB,QAAQ;4BAAQC,YAAY;4BAAQC,OAAO;wBAAc;;0CAE/D,KAAC/D;gCAAagE,cAAW;gCAAWjD,OAAM;gCAAW6B,IAAI;oCAAEG,YAAY;gCAAI;0CAAG;;0CAG9E,KAAC/C;gCAAagE,cAAW;gCAAUjD,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":"
|
|
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,EAAwB,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AAqB/E,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAwCzE,CAAC"}
|
|
@@ -1,3 +1,15 @@
|
|
|
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.
|
|
1
13
|
import { replaceVariables } from '@perses-dev/plugin-system';
|
|
2
14
|
import { DEFAULT_DATASOURCE } from '../constants';
|
|
3
15
|
function convertStreamsToLogs(streams) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/get-loki-log-data.ts"],"sourcesContent":["
|
|
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 { 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,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EA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