@perses-dev/prometheus-plugin 0.40.1 → 0.41.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/dist/cjs/plugins/{PrometheusDatasourceEditor/PrometheusDatasourceEditor.js → PrometheusDatasourceEditor.js} +203 -133
- package/dist/cjs/plugins/prometheus-datasource.js +2 -1
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +2 -2
- package/dist/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +2 -2
- package/dist/cjs/plugins/types.js +7 -0
- package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +1 -0
- package/dist/plugins/{PrometheusDatasourceEditor/PrometheusDatasourceEditor.js → PrometheusDatasourceEditor.js} +204 -134
- package/dist/plugins/PrometheusDatasourceEditor.js.map +1 -0
- package/dist/plugins/prometheus-datasource.d.ts +2 -8
- package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
- package/dist/plugins/prometheus-datasource.js +2 -1
- package/dist/plugins/prometheus-datasource.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
- package/dist/plugins/types.d.ts +21 -0
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +1 -1
- package/dist/plugins/types.js.map +1 -1
- package/package.json +4 -4
- package/dist/cjs/plugins/PrometheusDatasourceEditor/index.js +0 -31
- package/dist/cjs/plugins/PrometheusDatasourceEditor/types.js +0 -23
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts +0 -3
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.js +0 -16
- package/dist/plugins/PrometheusDatasourceEditor/index.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts +0 -22
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.js +0 -15
- package/dist/plugins/PrometheusDatasourceEditor/types.js.map +0 -1
- /package/dist/plugins/{PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts → PrometheusDatasourceEditor.d.ts} +0 -0
|
@@ -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 { PrometheusDatasourceSpec } from '../
|
|
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,cAA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hB,UAAU,CAAC2C,IAAM1B,oBAAoB0B,EAAEC,OAAO3C;wBAC9CsC,QAAQrB;wBACR2B,IAAI;4BAAEC,OAAO;wBAAQ;;;;;;AAK/B"}
|
|
@@ -15,7 +15,7 @@ import { replaceTemplateVariables, replaceTemplateVariable } from '@perses-dev/p
|
|
|
15
15
|
import { fromUnixTime, milliseconds } from 'date-fns';
|
|
16
16
|
import { parseValueTuple, getDurationStringSeconds, getPrometheusTimeRange, getRangeStep, DEFAULT_PROM } from '../../model';
|
|
17
17
|
import { getFormattedPrometheusSeriesName } from '../../utils';
|
|
18
|
-
import { DEFAULT_SCRAPE_INTERVAL } from '../
|
|
18
|
+
import { DEFAULT_SCRAPE_INTERVAL } from '../types';
|
|
19
19
|
export const getTimeSeriesData = async (spec, context)=>{
|
|
20
20
|
var _response_data;
|
|
21
21
|
if (spec.query === undefined || spec.query === null || spec.query === '') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/prometheus-time-series-query/get-time-series-data.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 {\n DatasourceSpec,\n formatDuration,\n msToPrometheusDuration,\n Notice,\n parseDurationString,\n TimeSeriesData,\n} from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceTemplateVariables, replaceTemplateVariable } from '@perses-dev/plugin-system';\nimport { fromUnixTime, milliseconds } from 'date-fns';\nimport {\n parseValueTuple,\n PrometheusClient,\n getDurationStringSeconds,\n getPrometheusTimeRange,\n getRangeStep,\n DEFAULT_PROM,\n} from '../../model';\nimport { getFormattedPrometheusSeriesName } from '../../utils';\nimport { DEFAULT_SCRAPE_INTERVAL, PrometheusDatasourceSpec } from '../
|
|
1
|
+
{"version":3,"sources":["../../../src/plugins/prometheus-time-series-query/get-time-series-data.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 {\n DatasourceSpec,\n formatDuration,\n msToPrometheusDuration,\n Notice,\n parseDurationString,\n TimeSeriesData,\n} from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceTemplateVariables, replaceTemplateVariable } from '@perses-dev/plugin-system';\nimport { fromUnixTime, milliseconds } from 'date-fns';\nimport {\n parseValueTuple,\n PrometheusClient,\n getDurationStringSeconds,\n getPrometheusTimeRange,\n getRangeStep,\n DEFAULT_PROM,\n} from '../../model';\nimport { getFormattedPrometheusSeriesName } from '../../utils';\nimport { DEFAULT_SCRAPE_INTERVAL, PrometheusDatasourceSpec } from '../types';\nimport { PrometheusTimeSeriesQuerySpec } from './time-series-query-model';\n\nexport const getTimeSeriesData: TimeSeriesQueryPlugin<PrometheusTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n // Do not make a request to the backend, instead return an empty TimeSeriesData\n return { series: [] };\n }\n\n const datasource = (await context.datasourceStore.getDatasource(\n spec.datasource ?? DEFAULT_PROM\n )) as DatasourceSpec<PrometheusDatasourceSpec>;\n const datasourceScrapeInterval = Math.trunc(\n milliseconds(parseDurationString(datasource.plugin.spec.scrapeInterval ?? DEFAULT_SCRAPE_INTERVAL)) / 1000\n );\n\n const minStep = getDurationStringSeconds(spec.minStep) ?? datasourceScrapeInterval;\n const timeRange = getPrometheusTimeRange(context.timeRange);\n const step = getRangeStep(timeRange, minStep, undefined, context.suggestedStepMs); // TODO: resolution\n\n // Align the time range so that it's a multiple of the step\n let { start, end } = timeRange;\n const utcOffsetSec = new Date().getTimezoneOffset() * 60;\n\n const alignedEnd = Math.floor((end + utcOffsetSec) / step) * step - utcOffsetSec;\n const alignedStart = Math.floor((start + utcOffsetSec) / step) * step - utcOffsetSec;\n start = alignedStart;\n end = alignedEnd;\n\n // Replace template variable placeholders in PromQL query\n const intervalMs = context.suggestedStepMs ?? step * 1000; // Step is in seconds\n let query = replaceTemplateVariable(spec.query, '__interval_ms', intervalMs.toString());\n query = replaceTemplateVariable(spec.query, '__interval', formatDuration(msToPrometheusDuration(intervalMs)));\n\n const scrapeIntervalMs = minStep * 1000;\n // The $__rate_interval variable is meant to be used in the rate function.\n // It is defined as max($__interval + Scrape interval, 4 * Scrape interval), where Scrape interval is the Min step setting (a setting per PromQL query),\n // if any is set, and otherwise the Scrape interval as set in the Prometheus datasource\n const rateIntervalMs = Math.max(intervalMs + scrapeIntervalMs, 4 * scrapeIntervalMs);\n query = replaceTemplateVariable(query, '__rate_interval', formatDuration(msToPrometheusDuration(rateIntervalMs)));\n query = replaceTemplateVariables(query, context.variableState);\n\n let seriesNameFormat = spec.seriesNameFormat;\n // if series name format is defined, replace template variable placeholders in series name format\n if (seriesNameFormat) {\n seriesNameFormat = replaceTemplateVariables(seriesNameFormat, context.variableState);\n }\n\n // Get the datasource, using the default Prom Datasource if one isn't specified in the query\n const client: PrometheusClient = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_PROM);\n\n // Make the request to Prom\n const response = await client.rangeQuery({\n query,\n start,\n end,\n step,\n });\n\n // TODO: What about error responses from Prom that have a response body?\n const result = response.data?.result ?? [];\n\n // Custom display for response header warnings, configurable error responses display coming next\n const notices: Notice[] = [];\n if (response.status === 'success') {\n const warnings = response.warnings ?? [];\n const warningMessage = warnings[0] ?? '';\n if (warningMessage !== '') {\n notices.push({\n type: 'warning',\n message: warningMessage,\n });\n }\n }\n\n // Transform response\n const chartData: TimeSeriesData = {\n // Return the time range and step we actually used for the query\n timeRange: { start: fromUnixTime(start), end: fromUnixTime(end) },\n stepMs: step * 1000,\n\n series: result.map((value) => {\n const { metric, values } = value;\n\n // Account for seriesNameFormat from query editor when determining name to show in legend, tooltip, etc.\n const { name, formattedName } = getFormattedPrometheusSeriesName(query, metric, seriesNameFormat);\n\n return {\n name,\n values: values.map(parseValueTuple),\n formattedName,\n labels: metric,\n };\n }),\n metadata: {\n notices,\n executedQueryString: query,\n },\n };\n\n return chartData;\n};\n"],"names":["formatDuration","msToPrometheusDuration","parseDurationString","replaceTemplateVariables","replaceTemplateVariable","fromUnixTime","milliseconds","parseValueTuple","getDurationStringSeconds","getPrometheusTimeRange","getRangeStep","DEFAULT_PROM","getFormattedPrometheusSeriesName","DEFAULT_SCRAPE_INTERVAL","getTimeSeriesData","spec","context","response","query","undefined","series","datasource","datasourceStore","getDatasource","datasourceScrapeInterval","Math","trunc","plugin","scrapeInterval","minStep","timeRange","step","suggestedStepMs","start","end","utcOffsetSec","Date","getTimezoneOffset","alignedEnd","floor","alignedStart","intervalMs","toString","scrapeIntervalMs","rateIntervalMs","max","variableState","seriesNameFormat","client","getDatasourceClient","rangeQuery","result","data","notices","status","warnings","warningMessage","push","type","message","chartData","stepMs","map","value","metric","values","name","formattedName","labels","metadata","executedQueryString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAEEA,cAAc,EACdC,sBAAsB,EAEtBC,mBAAmB,QAEd,mBAAmB;AAC1B,SAAgCC,wBAAwB,EAAEC,uBAAuB,QAAQ,4BAA4B;AACrH,SAAS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qBAAqB;IACrB,MAAMI,YAA4B;QAChC,gEAAgE;QAChE9B,WAAW;YAAEG,OAAO5B,aAAa4B;YAAQC,KAAK7B,aAAa6B;QAAK;QAChE2B,QAAQ9B,OAAO;QAEfX,QAAQ+B,OAAOW,IAAI,CAACC;YAClB,MAAM,EAAEC,OAAM,EAAEC,OAAM,EAAE,GAAGF;YAE3B,wGAAwG;YACxG,MAAM,EAAEG,KAAI,EAAEC,cAAa,EAAE,GAAGvD,iCAAiCM,OAAO8C,QAAQjB;YAEhF,OAAO;gBACLmB;gBACAD,QAAQA,OAAOH,IAAIvD;gBACnB4D;gBACAC,QAAQJ;YACV;QACF;QACAK,UAAU;YACRhB;YACAiB,qBAAqBpD;QACvB;IACF;IAEA,OAAO0C;AACT,EAAE"}
|
package/dist/plugins/types.d.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
|
+
import { DurationString, RequestHeaders } from '@perses-dev/core';
|
|
1
2
|
import { PrometheusDatasourceSelector } from '../model';
|
|
3
|
+
export declare const DEFAULT_SCRAPE_INTERVAL: DurationString;
|
|
4
|
+
export interface PrometheusDatasourceSpec {
|
|
5
|
+
directUrl?: string;
|
|
6
|
+
proxy?: HTTPProxy;
|
|
7
|
+
scrapeInterval?: DurationString;
|
|
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
|
+
}
|
|
2
23
|
export interface PrometheusVariableOptionsBase {
|
|
3
24
|
datasource?: PrometheusDatasourceSelector;
|
|
4
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,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,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"}
|
package/dist/plugins/types.js
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
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
|
-
export
|
|
13
|
+
export const DEFAULT_SCRAPE_INTERVAL = '1m';
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=types.js.map
|
|
@@ -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 { PrometheusDatasourceSelector } from '../model';\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":[],"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;
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/prometheus-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.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.
|
|
35
|
-
"@perses-dev/core": "0.
|
|
36
|
-
"@perses-dev/plugin-system": "0.
|
|
34
|
+
"@perses-dev/components": "0.41.0",
|
|
35
|
+
"@perses-dev/core": "0.41.0",
|
|
36
|
+
"@perses-dev/plugin-system": "0.41.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",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
_export_star(require("./PrometheusDatasourceEditor"), exports);
|
|
18
|
-
_export_star(require("./types"), exports);
|
|
19
|
-
function _export_star(from, to) {
|
|
20
|
-
Object.keys(from).forEach(function(k) {
|
|
21
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
22
|
-
Object.defineProperty(to, k, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function() {
|
|
25
|
-
return from[k];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return from;
|
|
31
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "DEFAULT_SCRAPE_INTERVAL", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return DEFAULT_SCRAPE_INTERVAL;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const DEFAULT_SCRAPE_INTERVAL = '1m';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrometheusDatasourceEditor.d.ts","sourceRoot":"","sources":["../../../src/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAA2B,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE5E,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,wBAAwB,CAAC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,eAiVhF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.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 { DurationString, RequestHeaders } from '@perses-dev/core';\nimport { OptionsEditorRadios } from '@perses-dev/plugin-system';\nimport { Grid, IconButton, TextField, Typography } from '@mui/material';\nimport React, { Fragment, useState } from 'react';\nimport MinusIcon from 'mdi-material-ui/Minus';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { DEFAULT_SCRAPE_INTERVAL, PrometheusDatasourceSpec } from './types';\n\nexport interface PrometheusDatasourceEditorProps {\n value: PrometheusDatasourceSpec;\n onChange: (next: PrometheusDatasourceSpec) => void;\n isReadonly?: boolean;\n}\n\nexport function PrometheusDatasourceEditor(props: PrometheusDatasourceEditorProps) {\n const { value, onChange, isReadonly } = props;\n const strDirect = 'Direct access';\n const strProxy = 'Proxy';\n\n // TODO refactor with useImmer to avoid doing so much destructuring? feasibility & performances to be checked\n\n // utilitary function used for headers when renaming a property\n // -> TODO it would be cleaner to manipulate headers as a list instead, to avoid doing this.\n // This could be a pure frontend trick, but change in the backend datamodel should also be considered\n const buildNewHeaders = (oldHeaders: RequestHeaders | undefined, oldName: string, newName: string) => {\n if (oldHeaders === undefined) return oldHeaders;\n const keys = Object.keys(oldHeaders);\n const newHeaders = keys.reduce<Record<string, string>>((acc, val) => {\n if (val === oldName) {\n acc[newName] = oldHeaders[oldName] || '';\n } else {\n acc[val] = oldHeaders[val] || '';\n }\n return acc;\n }, {});\n\n return { ...newHeaders };\n };\n\n const tabs = [\n {\n label: strDirect,\n content: (\n <>\n <TextField\n fullWidth\n label=\"URL\"\n value={value.directUrl || ''}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => onChange({ ...value, directUrl: e.target.value })}\n />\n </>\n ),\n },\n {\n label: strProxy,\n content: (\n <>\n <TextField\n fullWidth\n label=\"URL\"\n value={value.proxy?.spec.url || ''}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) =>\n onChange({\n ...value,\n ...(value.proxy && {\n proxy: {\n ...value.proxy,\n spec: {\n ...value.proxy.spec,\n url: e.target.value,\n },\n },\n }),\n })\n }\n />\n <Typography variant=\"h4\" mt={2} mb={1}>\n Allowed endpoints\n </Typography>\n <Grid container spacing={2} mb={2}>\n {value.proxy?.spec.allowedEndpoints ? (\n value.proxy.spec.allowedEndpoints.map(({ endpointPattern, method }, i) => {\n return (\n <Fragment key={i}>\n <Grid item xs={8}>\n <TextField\n disabled // at the moment the allowed endpoints cannot be modified (enforced by backend)\n fullWidth\n label=\"Endpoint pattern\"\n value={endpointPattern}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n />\n </Grid>\n <Grid item xs={4}>\n <TextField\n disabled // at the moment the allowed endpoints cannot be modified (enforced by backend)\n fullWidth\n label=\"URL\"\n value={method}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n />\n </Grid>\n </Fragment>\n );\n })\n ) : (\n <Grid item xs={4}>\n <Typography>None</Typography> {/* TODO: in edit mode, allow user to add endpoints */}\n </Grid>\n )}\n </Grid>\n <Typography variant=\"h4\" mb={1}>\n Request Headers\n </Typography>\n <Grid container spacing={2} mb={2}>\n {value.proxy?.spec.headers &&\n Object.keys(value.proxy.spec.headers).map((headerName, i) => {\n return (\n <Fragment key={i}>\n <Grid item xs={4}>\n <TextField\n fullWidth\n label=\"Header name\"\n value={headerName}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) =>\n onChange({\n ...value,\n ...(value.proxy && {\n proxy: {\n ...value.proxy,\n spec: {\n ...value.proxy.spec,\n headers: buildNewHeaders(value.proxy.spec.headers, headerName, e.target.value),\n },\n },\n }),\n })\n }\n />\n </Grid>\n <Grid item xs={7}>\n <TextField\n fullWidth\n label=\"Header value\"\n value={value.proxy?.spec.headers?.[headerName]}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) =>\n onChange({\n ...value,\n ...(value.proxy && {\n proxy: {\n ...value.proxy,\n spec: {\n ...value.proxy.spec,\n headers: { ...value.proxy.spec.headers, [headerName]: e.target.value },\n },\n },\n }),\n })\n }\n />\n </Grid>\n <Grid item xs={1}>\n <IconButton\n disabled={isReadonly}\n onClick={() => {\n const newHeaders = { ...value.proxy?.spec.headers };\n delete newHeaders[headerName];\n onChange({\n ...value,\n ...(value.proxy && {\n proxy: {\n ...value.proxy,\n spec: {\n ...value.proxy.spec,\n headers: newHeaders,\n },\n },\n }),\n });\n }}\n >\n <MinusIcon />\n </IconButton>\n </Grid>\n </Fragment>\n );\n })}\n <Grid item xs={12} sx={{ paddingTop: '5px !important' }}>\n <IconButton\n disabled={isReadonly}\n onClick={() =>\n onChange({\n ...value,\n ...(value.proxy && {\n proxy: {\n ...value.proxy,\n spec: {\n ...value.proxy.spec,\n headers: { ...value.proxy.spec.headers, '': '' },\n },\n },\n }),\n })\n }\n >\n <PlusIcon />\n </IconButton>\n </Grid>\n </Grid>\n <TextField\n fullWidth\n label=\"Secret\"\n value={value.proxy?.spec.secret || ''}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) =>\n onChange({\n ...value,\n ...(value.proxy && {\n proxy: {\n ...value.proxy,\n spec: {\n ...value.proxy.spec,\n secret: e.target.value,\n },\n },\n }),\n })\n }\n />\n </>\n ),\n },\n ];\n\n // Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or\n // bug in case the tabs get eventually swapped in the future.\n const directModeId = tabs.findIndex((tab) => tab.label == strDirect);\n const proxyModeId = tabs.findIndex((tab) => tab.label == strProxy);\n\n // In \"update datasource\" case, set defaultTab to the mode that this datasource is currently relying on.\n // Otherwise (create datasource), set defaultTab to Direct access.\n const defaultTab = value.proxy ? proxyModeId : directModeId;\n\n const initialSpecDirect: PrometheusDatasourceSpec = {\n directUrl: '',\n };\n\n const initialSpecProxy: PrometheusDatasourceSpec = {\n proxy: {\n kind: 'HTTPProxy',\n spec: {\n allowedEndpoints: [\n // hardcoded list of allowed endpoints for now since those are enforced by the backend\n {\n endpointPattern: '/api/v1/labels',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/series',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/metadata',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v1/query',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/query_range',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/label/([a-zA-Z0-9_-]+)/values',\n method: 'GET',\n },\n ],\n url: '',\n },\n },\n };\n\n // For better user experience, save previous states in mind for both mode.\n // This avoids losing everything when the user changes their mind back.\n const [previousSpecDirect, setPreviousSpecDirect] = useState(initialSpecDirect);\n const [previousSpecProxy, setPreviousSpecProxy] = useState(initialSpecProxy);\n\n // When changing mode, remove previous mode's config + append default values for the new mode.\n const handleModeChange = (v: number) => {\n if (tabs[v]?.label == strDirect) {\n setPreviousSpecProxy(value);\n onChange(previousSpecDirect);\n } else if (tabs[v]?.label == strProxy) {\n setPreviousSpecDirect(value);\n onChange(previousSpecProxy);\n }\n };\n\n return (\n <>\n <Typography variant=\"h4\" mb={2}>\n General Settings\n </Typography>\n <TextField\n fullWidth\n label=\"Scrape Interval\"\n value={value.scrapeInterval || ''}\n placeholder={`Default: ${DEFAULT_SCRAPE_INTERVAL}`}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => onChange({ ...value, scrapeInterval: e.target.value as DurationString })}\n />\n <Typography variant=\"h4\" mt={2}>\n HTTP Settings\n </Typography>\n <OptionsEditorRadios\n isReadonly={isReadonly}\n tabs={tabs}\n defaultTab={defaultTab}\n onModeChange={handleModeChange}\n />\n </>\n );\n}\n"],"names":["OptionsEditorRadios","Grid","IconButton","TextField","Typography","React","Fragment","useState","MinusIcon","PlusIcon","DEFAULT_SCRAPE_INTERVAL","PrometheusDatasourceEditor","props","value","onChange","isReadonly","strDirect","strProxy","buildNewHeaders","oldHeaders","oldName","newName","undefined","keys","Object","newHeaders","reduce","acc","val","tabs","label","content","fullWidth","directUrl","InputProps","readOnly","InputLabelProps","shrink","e","target","proxy","spec","url","variant","mt","mb","container","spacing","allowedEndpoints","map","endpointPattern","method","i","item","xs","disabled","headers","headerName","onClick","sx","paddingTop","secret","directModeId","findIndex","tab","proxyModeId","defaultTab","initialSpecDirect","initialSpecProxy","kind","previousSpecDirect","setPreviousSpecDirect","previousSpecProxy","setPreviousSpecProxy","handleModeChange","v","scrapeInterval","placeholder","onModeChange"],"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;;AAGjC,SAASA,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,IAAI,EAAEC,UAAU,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AACxE,OAAOC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,QAAQ;AAClD,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,cAAc,uBAAuB;AAC5C,SAASC,uBAAuB,QAAkC,UAAU;AAQ5E,OAAO,SAASC,2BAA2BC,KAAsC;QAkD9DC,cAwBNA,eAyCAA,eAyGMA;IA3NjB,MAAM,EAAEA,MAAK,EAAEC,SAAQ,EAAEC,WAAU,EAAE,GAAGH;IACxC,MAAMI,YAAY;IAClB,MAAMC,WAAW;IAEjB,6GAA6G;IAE7G,+DAA+D;IAC/D,4FAA4F;IAC5F,wGAAw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IACF;IAEA,qBACE;;0BACE,KAACpE;gBAAWuC,SAAQ;gBAAKE,IAAI;0BAAG;;0BAGhC,KAAC1C;gBACC6B,SAAS;gBACTF,OAAM;gBACNjB,OAAOA,MAAM+D,kBAAkB;gBAC/BC,aAAa,CAAC,SAAS,EAAEnE,wBAAwB,CAAC;gBAClDwB,YAAY;oBACVC,UAAUpB;gBACZ;gBACAqB,iBAAiB;oBAAEC,QAAQtB,aAAa,OAAOO;gBAAU;gBACzDR,UAAU,CAACwB,IAAMxB,SAAS;wBAAE,GAAGD,KAAK;wBAAE+D,gBAAgBtC,EAAEC,OAAO1B;oBAAwB;;0BAEzF,KAACT;gBAAWuC,SAAQ;gBAAKC,IAAI;0BAAG;;0BAGhC,KAAC5C;gBACCe,YAAYA;gBACZc,MAAMA;gBACNqC,YAAYA;gBACZY,cAAcJ;;;;AAItB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/PrometheusDatasourceEditor/index.ts"],"names":[],"mappings":"AAaA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,SAAS,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
export * from './PrometheusDatasourceEditor';
|
|
14
|
-
export * from './types';
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/PrometheusDatasourceEditor/index.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\nexport * from './PrometheusDatasourceEditor';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,+BAA+B;AAC7C,cAAc,UAAU"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DurationString, RequestHeaders } from '@perses-dev/core';
|
|
2
|
-
export declare const DEFAULT_SCRAPE_INTERVAL: DurationString;
|
|
3
|
-
export interface PrometheusDatasourceSpec {
|
|
4
|
-
directUrl?: string;
|
|
5
|
-
proxy?: HTTPProxy;
|
|
6
|
-
scrapeInterval?: DurationString;
|
|
7
|
-
}
|
|
8
|
-
export interface HTTPProxy {
|
|
9
|
-
kind: 'HTTPProxy';
|
|
10
|
-
spec: HTTPProxySpec;
|
|
11
|
-
}
|
|
12
|
-
export interface HTTPProxySpec {
|
|
13
|
-
url: string;
|
|
14
|
-
allowedEndpoints?: HTTPAllowedEndpoint[];
|
|
15
|
-
headers?: RequestHeaders;
|
|
16
|
-
secret?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface HTTPAllowedEndpoint {
|
|
19
|
-
endpointPattern: string;
|
|
20
|
-
method: string;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/PrometheusDatasourceEditor/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElE,eAAO,MAAM,uBAAuB,EAAE,cAAqB,CAAC;AAG5D,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"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
export const DEFAULT_SCRAPE_INTERVAL = '1m';
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/PrometheusDatasourceEditor/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';\n\nexport const DEFAULT_SCRAPE_INTERVAL: DurationString = '1m';\n\n// TODO: unify this one with the other PrometheusDatasourceSpec used for datasource store manipulation\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"],"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;AAIjC,OAAO,MAAMA,0BAA0C,KAAK"}
|
|
File without changes
|