@perses-dev/prometheus-plugin 0.41.0 → 0.42.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 (34) hide show
  1. package/dist/cjs/model/prometheus-client.js +16 -0
  2. package/dist/cjs/model/prometheus-selectors.js +1 -1
  3. package/dist/cjs/plugins/PrometheusDatasourceEditor.js +272 -186
  4. package/dist/cjs/plugins/prometheus-datasource.js +4 -0
  5. package/dist/cjs/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js +88 -0
  6. package/dist/cjs/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js +123 -0
  7. package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +34 -60
  8. package/dist/model/prometheus-client.d.ts +4 -0
  9. package/dist/model/prometheus-client.d.ts.map +1 -1
  10. package/dist/model/prometheus-client.js +15 -0
  11. package/dist/model/prometheus-client.js.map +1 -1
  12. package/dist/model/prometheus-selectors.js +1 -1
  13. package/dist/model/prometheus-selectors.js.map +1 -1
  14. package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +1 -1
  15. package/dist/plugins/PrometheusDatasourceEditor.js +272 -186
  16. package/dist/plugins/PrometheusDatasourceEditor.js.map +1 -1
  17. package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
  18. package/dist/plugins/prometheus-datasource.js +5 -1
  19. package/dist/plugins/prometheus-datasource.js.map +1 -1
  20. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.d.ts +21 -0
  21. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
  22. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js +80 -0
  23. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js.map +1 -0
  24. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.d.ts +21 -0
  25. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
  26. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js +115 -0
  27. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js.map +1 -0
  28. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
  29. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +37 -63
  30. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
  31. package/dist/plugins/types.d.ts +1 -15
  32. package/dist/plugins/types.d.ts.map +1 -1
  33. package/dist/plugins/types.js.map +1 -1
  34. package/package.json +4 -4
@@ -10,18 +10,18 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { produce } from 'immer';
15
- import { Stack, TextField, FormControl, InputLabel } from '@mui/material';
16
- import { DatasourceSelect, useDatasource, useDatasourceClient } from '@perses-dev/plugin-system';
17
- import { DEFAULT_PROM, isDefaultPromSelector, isPrometheusDatasourceSelector, PROM_DATASOURCE_KIND } from '../../model';
18
- import { PromQLEditor } from '../../components';
15
+ import { useDatasource, useDatasourceClient } from '@perses-dev/plugin-system';
16
+ import { DEFAULT_PROM, isDefaultPromSelector, isPrometheusDatasourceSelector } from '../../model';
19
17
  import { DEFAULT_SCRAPE_INTERVAL } from '../types';
20
18
  import { useQueryState, useFormatState, useMinStepState } from './query-editor-model';
19
+ import { DashboardPrometheusTimeSeriesQueryEditor } from './DashboardPrometheusTimeSeriesQueryEditor';
20
+ import { ExplorePrometheusTimeSeriesQueryEditor } from './ExplorePrometheusTimeSeriesQueryEditor';
21
21
  /**
22
22
  * The options editor component for editing a PrometheusTimeSeriesQuery's spec.
23
23
  */ export function PrometheusTimeSeriesQueryEditor(props) {
24
- const { onChange , value } = props;
24
+ const { onChange , value , isExplore } = props;
25
25
  const { datasource } = value;
26
26
  const selectedDatasource = datasource !== null && datasource !== void 0 ? datasource : DEFAULT_PROM;
27
27
  const { data: client } = useDatasourceClient(selectedDatasource);
@@ -43,63 +43,37 @@ import { useQueryState, useFormatState, useMinStepState } from './query-editor-m
43
43
  }
44
44
  throw new Error('Got unexpected non-Prometheus datasource selector');
45
45
  };
46
- return /*#__PURE__*/ _jsxs(Stack, {
47
- spacing: 2,
48
- children: [
49
- /*#__PURE__*/ _jsxs(FormControl, {
50
- margin: "dense",
51
- fullWidth: false,
52
- children: [
53
- /*#__PURE__*/ _jsx(InputLabel, {
54
- id: "prom-datasource-label",
55
- children: "Prometheus Datasource"
56
- }),
57
- /*#__PURE__*/ _jsx(DatasourceSelect, {
58
- datasourcePluginKind: PROM_DATASOURCE_KIND,
59
- value: selectedDatasource,
60
- onChange: handleDatasourceChange,
61
- labelId: "prom-datasource-label",
62
- label: "Prometheus Datasource"
63
- })
64
- ]
65
- }),
66
- /*#__PURE__*/ _jsx(PromQLEditor, {
67
- completeConfig: {
68
- remote: {
69
- url: promURL
70
- }
71
- },
72
- value: query,
73
- onChange: handleQueryChange,
74
- onBlur: handleQueryBlur
75
- }),
76
- /*#__PURE__*/ _jsxs(Stack, {
77
- direction: "row",
78
- spacing: 2,
79
- children: [
80
- /*#__PURE__*/ _jsx(TextField, {
81
- fullWidth: true,
82
- label: "Legend Name",
83
- placeholder: "Tip: Use {{label_name}}. Example: {{instance}} will be replaced with values such as 'webserver-123' and 'webserver-456'.",
84
- helperText: "Name for each series in the legend and the tooltip.",
85
- value: format !== null && format !== void 0 ? format : '',
86
- onChange: (e)=>handleFormatChange(e.target.value),
87
- onBlur: handleFormatBlur
88
- }),
89
- /*#__PURE__*/ _jsx(TextField, {
90
- label: "Min Step",
91
- placeholder: minStepPlaceholder,
92
- helperText: "Step parameter of the query. Used by $__interval and $__rate_interval too.",
93
- value: minStep,
94
- onChange: (e)=>handleMinStepChange(e.target.value),
95
- onBlur: handleMinStepBlur,
96
- sx: {
97
- width: '250px'
98
- }
99
- })
100
- ]
101
- })
102
- ]
46
+ if (isExplore) {
47
+ return /*#__PURE__*/ _jsx(ExplorePrometheusTimeSeriesQueryEditor, {
48
+ selectedDatasource: selectedDatasource,
49
+ handleDatasourceChange: handleDatasourceChange,
50
+ promURL: promURL,
51
+ query: query,
52
+ handleQueryChange: handleQueryChange,
53
+ handleQueryBlur: handleQueryBlur,
54
+ format: format,
55
+ handleFormatChange: handleFormatChange,
56
+ handleFormatBlur: handleFormatBlur,
57
+ minStepPlaceholder: minStepPlaceholder,
58
+ minStep: minStep,
59
+ handleMinStepChange: handleMinStepChange,
60
+ handleMinStepBlur: handleMinStepBlur
61
+ });
62
+ }
63
+ return /*#__PURE__*/ _jsx(DashboardPrometheusTimeSeriesQueryEditor, {
64
+ selectedDatasource: selectedDatasource,
65
+ handleDatasourceChange: handleDatasourceChange,
66
+ promURL: promURL,
67
+ query: query,
68
+ handleQueryChange: handleQueryChange,
69
+ handleQueryBlur: handleQueryBlur,
70
+ format: format,
71
+ handleFormatChange: handleFormatChange,
72
+ handleFormatBlur: handleFormatBlur,
73
+ minStepPlaceholder: minStepPlaceholder,
74
+ minStep: minStep,
75
+ handleMinStepChange: handleMinStepChange,
76
+ handleMinStepBlur: handleMinStepBlur
103
77
  });
104
78
  }
105
79
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright 2023 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 { produce } from 'immer';\nimport { Stack, TextField, FormControl, InputLabel } from '@mui/material';\nimport { DatasourceSelect, DatasourceSelectProps, useDatasource, useDatasourceClient } from '@perses-dev/plugin-system';\nimport {\n DEFAULT_PROM,\n DurationString,\n isDefaultPromSelector,\n isPrometheusDatasourceSelector,\n PROM_DATASOURCE_KIND,\n PrometheusClient,\n} from '../../model';\nimport { PromQLEditor } from '../../components';\nimport { DEFAULT_SCRAPE_INTERVAL, PrometheusDatasourceSpec } from '../types';\nimport {\n PrometheusTimeSeriesQueryEditorProps,\n useQueryState,\n useFormatState,\n useMinStepState,\n} from './query-editor-model';\n\n/**\n * The options editor component for editing a PrometheusTimeSeriesQuery's spec.\n */\nexport function PrometheusTimeSeriesQueryEditor(props: PrometheusTimeSeriesQueryEditorProps) {\n const { onChange, value } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n\n const { data: client } = useDatasourceClient<PrometheusClient>(selectedDatasource);\n const promURL = client?.options.datasourceUrl;\n const { data: datasourceResource } = useDatasource(selectedDatasource);\n\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n const { format, handleFormatChange, handleFormatBlur } = useFormatState(props);\n const { minStep, handleMinStepChange, handleMinStepBlur } = useMinStepState(props);\n const minStepPlaceholder =\n minStep ??\n (datasourceResource && (datasourceResource?.plugin.spec as PrometheusDatasourceSpec).scrapeInterval) ??\n DEFAULT_SCRAPE_INTERVAL;\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (next) => {\n if (isPrometheusDatasourceSelector(next)) {\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 = isDefaultPromSelector(next) ? undefined : next;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n };\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\" fullWidth={false}>\n {/* TODO: How do we ensure unique ID values if there are multiple of these? Can we use React 18 useId and\n maintain 17 compatibility somehow with a polyfill/shim? */}\n <InputLabel id=\"prom-datasource-label\">Prometheus Datasource</InputLabel>\n <DatasourceSelect\n datasourcePluginKind={PROM_DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n <PromQLEditor\n completeConfig={{ remote: { url: promURL } }}\n value={query}\n onChange={handleQueryChange}\n onBlur={handleQueryBlur}\n />\n <Stack direction=\"row\" spacing={2}>\n <TextField\n fullWidth\n label=\"Legend Name\"\n placeholder=\"Tip: Use {{label_name}}. Example: {{instance}} will be replaced with values such as 'webserver-123' and 'webserver-456'.\"\n helperText=\"Name for each series in the legend and the tooltip.\"\n value={format ?? ''}\n onChange={(e) => handleFormatChange(e.target.value)}\n onBlur={handleFormatBlur}\n />\n <TextField\n label=\"Min Step\"\n placeholder={minStepPlaceholder}\n helperText=\"Step parameter of the query. Used by $__interval and $__rate_interval too.\"\n value={minStep}\n onChange={(e) => handleMinStepChange(e.target.value as DurationString)}\n onBlur={handleMinStepBlur}\n sx={{ width: '250px' }}\n />\n </Stack>\n </Stack>\n );\n}\n"],"names":["produce","Stack","TextField","FormControl","InputLabel","DatasourceSelect","useDatasource","useDatasourceClient","DEFAULT_PROM","isDefaultPromSelector","isPrometheusDatasourceSelector","PROM_DATASOURCE_KIND","PromQLEditor","DEFAULT_SCRAPE_INTERVAL","useQueryState","useFormatState","useMinStepState","PrometheusTimeSeriesQueryEditor","props","onChange","value","datasource","selectedDatasource","data","client","promURL","options","datasourceUrl","datasourceResource","query","handleQueryChange","handleQueryBlur","format","handleFormatChange","handleFormatBlur","minStep","handleMinStepChange","handleMinStepBlur","minStepPlaceholder","plugin","spec","scrapeInterval","handleDatasourceChange","next","draft","nextDatasource","undefined","Error","spacing","margin","fullWidth","id","datasourcePluginKind","labelId","label","completeConfig","remote","url","onBlur","direction","placeholder","helperText","e","target","sx","width"],"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,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,KAAK,EAAEC,SAAS,EAAEC,WAAW,EAAEC,UAAU,QAAQ,gBAAgB;AAC1E,SAASC,gBAAgB,EAAyBC,aAAa,EAAEC,mBAAmB,QAAQ,4BAA4B;AACxH,SACEC,YAAY,EAEZC,qBAAqB,EACrBC,8BAA8B,EAC9BC,oBAAoB,QAEf,cAAc;AACrB,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,uBAAuB,QAAkC,WAAW;AAC7E,SAEEC,aAAa,EACbC,cAAc,EACdC,eAAe,QACV,uBAAuB;AAE9B;;CAEC,GACD,OAAO,SAASC,gCAAgCC,KAA2C;IACzF,MAAM,EAAEC,SAAQ,EAAEC,MAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,WAAU,EAAE,GAAGD;IACvB,MAAME,qBAAqBD,uBAAAA,wBAAAA,aAAcb;IAEzC,MAAM,EAAEe,MAAMC,OAAM,EAAE,GAAGjB,oBAAsCe;IAC/D,MAAMG,UAAUD,mBAAAA,oBAAAA,KAAAA,IAAAA,OAAQE,QAAQC;IAChC,MAAM,EAAEJ,MAAMK,mBAAkB,EAAE,GAAGtB,cAAcgB;IAEnD,MAAM,EAAEO,MAAK,EAAEC,kBAAiB,EAAEC,gBAAe,EAAE,GAAGjB,cAAcI;IACpE,MAAM,EAAEc,OAAM,EAAEC,mBAAkB,EAAEC,iBAAgB,EAAE,GAAGnB,eAAeG;IACxE,MAAM,EAAEiB,QAAO,EAAEC,oBAAmB,EAAEC,kBAAiB,EAAE,GAAG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ugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright 2023 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 { produce } from 'immer';\nimport { DatasourceSelectProps, useDatasource, useDatasourceClient } from '@perses-dev/plugin-system';\nimport { DEFAULT_PROM, isDefaultPromSelector, isPrometheusDatasourceSelector, PrometheusClient } from '../../model';\nimport { DEFAULT_SCRAPE_INTERVAL, PrometheusDatasourceSpec } from '../types';\nimport {\n PrometheusTimeSeriesQueryEditorProps,\n useQueryState,\n useFormatState,\n useMinStepState,\n} from './query-editor-model';\nimport { DashboardPrometheusTimeSeriesQueryEditor } from './DashboardPrometheusTimeSeriesQueryEditor';\nimport { ExplorePrometheusTimeSeriesQueryEditor } from './ExplorePrometheusTimeSeriesQueryEditor';\n\n/**\n * The options editor component for editing a PrometheusTimeSeriesQuery's spec.\n */\nexport function PrometheusTimeSeriesQueryEditor(props: PrometheusTimeSeriesQueryEditorProps) {\n const { onChange, value, isExplore } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n\n const { data: client } = useDatasourceClient<PrometheusClient>(selectedDatasource);\n const promURL = client?.options.datasourceUrl;\n const { data: datasourceResource } = useDatasource(selectedDatasource);\n\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n const { format, handleFormatChange, handleFormatBlur } = useFormatState(props);\n const { minStep, handleMinStepChange, handleMinStepBlur } = useMinStepState(props);\n const minStepPlaceholder =\n minStep ??\n (datasourceResource && (datasourceResource?.plugin.spec as PrometheusDatasourceSpec).scrapeInterval) ??\n DEFAULT_SCRAPE_INTERVAL;\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (next) => {\n if (isPrometheusDatasourceSelector(next)) {\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 = isDefaultPromSelector(next) ? undefined : next;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n };\n\n if (isExplore) {\n return (\n <ExplorePrometheusTimeSeriesQueryEditor\n selectedDatasource={selectedDatasource}\n handleDatasourceChange={handleDatasourceChange}\n promURL={promURL}\n query={query}\n handleQueryChange={handleQueryChange}\n handleQueryBlur={handleQueryBlur}\n format={format}\n handleFormatChange={handleFormatChange}\n handleFormatBlur={handleFormatBlur}\n minStepPlaceholder={minStepPlaceholder}\n minStep={minStep}\n handleMinStepChange={handleMinStepChange}\n handleMinStepBlur={handleMinStepBlur}\n />\n );\n }\n\n return (\n <DashboardPrometheusTimeSeriesQueryEditor\n selectedDatasource={selectedDatasource}\n handleDatasourceChange={handleDatasourceChange}\n promURL={promURL}\n query={query}\n handleQueryChange={handleQueryChange}\n handleQueryBlur={handleQueryBlur}\n format={format}\n handleFormatChange={handleFormatChange}\n handleFormatBlur={handleFormatBlur}\n minStepPlaceholder={minStepPlaceholder}\n minStep={minStep}\n handleMinStepChange={handleMinStepChange}\n handleMinStepBlur={handleMinStepBlur}\n />\n );\n}\n"],"names":["produce","useDatasource","useDatasourceClient","DEFAULT_PROM","isDefaultPromSelector","isPrometheusDatasourceSelector","DEFAULT_SCRAPE_INTERVAL","useQueryState","useFormatState","useMinStepState","DashboardPrometheusTimeSeriesQueryEditor","ExplorePrometheusTimeSeriesQueryEditor","PrometheusTimeSeriesQueryEditor","props","onChange","value","isExplore","datasource","selectedDatasource","data","client","promURL","options","datasourceUrl","datasourceResource","query","handleQueryChange","handleQueryBlur","format","handleFormatChange","handleFormatBlur","minStep","handleMinStepChange","handleMinStepBlur","minStepPlaceholder","plugin","spec","scrapeIn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,+BAAAA,gCAAAA,KAAAA,IAAAA,mBAAoBW,OAAOC,IAAgC,EAAEC,4BADrFN,kBAAAA,OAEAzB;IAEF,MAAMgC,yBAA4D,CAACC;QACjE,IAAIlC,+BAA+BkC,OAAO;YACxCzB,SACEd,QAAQe,OAAO,CAACyB;gBACd,sFAAsF;gBACtF,MAAMC,iBAAiBrC,sBAAsBmC,QAAQG,YAAYH;gBACjEC,MAAMvB,aAAawB;YACrB;YAEF;QACF;QAEA,MAAM,IAAIE,MAAM;IAClB;IAEA,IAAI3B,WAAW;QACb,qBACE,KAACL;YACCO,oBAAoBA;YACpBoB,wBAAwBA;YACxBjB,SAASA;YACTI,OAAOA;YACPC,mBAAmBA;YACnBC,iBAAiBA;YACjBC,QAAQA;YACRC,oBAAoBA;YACpBC,kBAAkBA;YAClBI,oBAAoBA;YACpBH,SAASA;YACTC,qBAAqBA;YACrBC,mBAAmBA;;IAGzB;IAEA,qBACE,KAACvB;QACCQ,oBAAoBA;QACpBoB,wBAAwBA;QACxBjB,SAASA;QACTI,OAAOA;QACPC,mBAAmBA;QACnBC,iBAAiBA;QACjBC,QAAQA;QACRC,oBAAoBA;QACpBC,kBAAkBA;QAClBI,oBAAoBA;QACpBH,SAASA;QACTC,qBAAqBA;QACrBC,mBAAmBA;;AAGzB"}
@@ -1,4 +1,4 @@
1
- import { DurationString, RequestHeaders } from '@perses-dev/core';
1
+ import { DurationString, HTTPProxy } from '@perses-dev/core';
2
2
  import { PrometheusDatasourceSelector } from '../model';
3
3
  export declare const DEFAULT_SCRAPE_INTERVAL: DurationString;
4
4
  export interface PrometheusDatasourceSpec {
@@ -6,20 +6,6 @@ export interface PrometheusDatasourceSpec {
6
6
  proxy?: HTTPProxy;
7
7
  scrapeInterval?: DurationString;
8
8
  }
9
- export interface HTTPProxy {
10
- kind: 'HTTPProxy';
11
- spec: HTTPProxySpec;
12
- }
13
- export interface HTTPProxySpec {
14
- url: string;
15
- allowedEndpoints?: HTTPAllowedEndpoint[];
16
- headers?: RequestHeaders;
17
- secret?: string;
18
- }
19
- export interface HTTPAllowedEndpoint {
20
- endpointPattern: string;
21
- method: string;
22
- }
23
9
  export interface PrometheusVariableOptionsBase {
24
10
  datasource?: PrometheusDatasourceSelector;
25
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,uBAAuB,EAAE,cAAqB,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;CACrB;AACD,MAAM,WAAW,aAAa;IAG5B,GAAG,EAAE,MAAM,CAAC;IAGZ,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAEzC,OAAO,CAAC,EAAE,cAAc,CAAC;IAGzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C;AAED,oBAAY,mCAAmC,GAAG,6BAA6B,GAAG;IAChF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,oCAAoC,GAAG,6BAA6B,GAAG;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,+BAA+B,GAAG,6BAA6B,GAAG;IAE5E,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,uBAAuB,EAAE,cAAqB,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C;AAED,oBAAY,mCAAmC,GAAG,6BAA6B,GAAG;IAChF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,oCAAoC,GAAG,6BAA6B,GAAG;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,+BAA+B,GAAG,6BAA6B,GAAG;IAE5E,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/types.ts"],"sourcesContent":["// Copyright 2023 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 { DurationString, RequestHeaders } from '@perses-dev/core';\nimport { PrometheusDatasourceSelector } from '../model';\n\nexport const DEFAULT_SCRAPE_INTERVAL: DurationString = '1m';\n\nexport interface PrometheusDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n scrapeInterval?: DurationString; // default to 1m\n}\n\nexport interface HTTPProxy {\n kind: 'HTTPProxy';\n spec: HTTPProxySpec;\n}\nexport interface HTTPProxySpec {\n // url is the url of the datasource. It is not the url of the proxy.\n // The Perses server is the proxy, so it needs to know where to redirect the request.\n url: string;\n // allowedEndpoints is a list of tuples of http methods and http endpoints that will be accessible.\n // Leave it empty if you don't want to restrict the access to the datasource.\n allowedEndpoints?: HTTPAllowedEndpoint[];\n // headers can be used to provide additional headers that need to be forwarded when requesting the datasource\n headers?: RequestHeaders;\n // secret is the name of the secret that should be used for the proxy or discovery configuration\n // It will contain any sensitive information such as password, token, certificate.\n secret?: string;\n}\n\nexport interface HTTPAllowedEndpoint {\n endpointPattern: string;\n method: string;\n}\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: PrometheusDatasourceSelector;\n}\n\nexport type PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase & {\n matchers?: string[];\n};\n\nexport type PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {\n labelName: string;\n matchers?: string[];\n};\n\nexport type PrometheusPromQLVariableOptions = PrometheusVariableOptionsBase & {\n // expr is the PromQL expression.\n expr: string;\n // labelName is the name of the label that will be used after the PromQL query is performed to select the label value.\n // Note: This field is not part of the Prometheus API.\n labelName: string;\n};\n"],"names":["DEFAULT_SCRAPE_INTERVAL"],"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;AAKjC,OAAO,MAAMA,0BAA0C,KAAK"}
1
+ {"version":3,"sources":["../../src/plugins/types.ts"],"sourcesContent":["// Copyright 2023 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 { DurationString, HTTPProxy } from '@perses-dev/core';\nimport { PrometheusDatasourceSelector } from '../model';\n\nexport const DEFAULT_SCRAPE_INTERVAL: DurationString = '1m';\n\nexport interface PrometheusDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n scrapeInterval?: DurationString; // default to 1m\n}\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: PrometheusDatasourceSelector;\n}\n\nexport type PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase & {\n matchers?: string[];\n};\n\nexport type PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {\n labelName: string;\n matchers?: string[];\n};\n\nexport type PrometheusPromQLVariableOptions = PrometheusVariableOptionsBase & {\n // expr is the PromQL expression.\n expr: string;\n // labelName is the name of the label that will be used after the PromQL query is performed to select the label value.\n // Note: This field is not part of the Prometheus API.\n labelName: string;\n};\n"],"names":["DEFAULT_SCRAPE_INTERVAL"],"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;AAKjC,OAAO,MAAMA,0BAA0C,KAAK"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/prometheus-plugin",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "Prometheus plugin for Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -31,9 +31,9 @@
31
31
  "dependencies": {
32
32
  "@lezer/highlight": "^1.0.0",
33
33
  "@lezer/lr": "^1.2.0",
34
- "@perses-dev/components": "0.41.0",
35
- "@perses-dev/core": "0.41.0",
36
- "@perses-dev/plugin-system": "0.41.0",
34
+ "@perses-dev/components": "0.42.0",
35
+ "@perses-dev/core": "0.42.0",
36
+ "@perses-dev/plugin-system": "0.42.0",
37
37
  "@prometheus-io/codemirror-promql": "^0.43.0",
38
38
  "@uiw/react-codemirror": "^4.19.1",
39
39
  "date-fns": "^2.28.0",