@perses-dev/prometheus-plugin 0.58.0-beta.3 → 0.58.0-beta.4
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/Prometheus.b529e8d3.js +7 -0
- package/__mf/js/async/1432.e29db35e.js +1 -0
- package/__mf/js/async/{1605.7c7a0998.js → 1605.a204b95c.js} +2 -2
- package/__mf/js/async/1616.3041c72f.js +1 -0
- package/__mf/js/async/1728.ed039ac8.js +1 -0
- package/__mf/js/async/1969.6563f651.js +1 -0
- package/__mf/js/async/2043.d03e35cf.js +2 -0
- package/__mf/js/async/{2177.a9ef2479.js → 2177.1bd9b5dd.js} +5 -5
- package/__mf/js/async/{2186.9a98bd8f.js → 2186.a78343d7.js} +1 -1
- package/__mf/js/async/2506.a5e3fa9e.js +1 -0
- package/__mf/js/async/2979.bb987a1e.js +1 -0
- package/__mf/js/async/3075.10dd1cd7.js +1 -0
- package/__mf/js/async/3499.24f1fd45.js +1 -0
- package/__mf/js/async/392.7bf830d9.js +2 -0
- package/__mf/js/async/3963.d41ea897.js +1 -0
- package/__mf/js/async/4121.c001d061.js +2 -0
- package/__mf/js/async/425.e5eb361a.js +1 -0
- package/__mf/js/async/4626.f0edb327.js +1 -0
- package/__mf/js/async/4635.1d829282.js +2 -0
- package/__mf/js/async/4987.fc4d4c7c.js +1 -0
- package/__mf/js/async/5002.95d78deb.js +1 -0
- package/__mf/js/async/5061.758604ba.js +1 -0
- package/__mf/js/async/5071.96533845.js +1 -0
- package/__mf/js/async/5440.62626c57.js +2 -0
- package/__mf/js/async/5587.da62b369.js +1 -0
- package/__mf/js/async/5763.32764827.js +1 -0
- package/__mf/js/async/6274.404a3115.js +2 -0
- package/__mf/js/async/6293.3d4c6e7f.js +1 -0
- package/__mf/js/async/6438.6cf5bc56.js +1 -0
- package/__mf/js/async/6507.6eff5f62.js +1 -0
- package/__mf/js/async/6593.3cb2cfba.js +3 -0
- package/__mf/js/async/7177.a7b44f03.js +1 -0
- package/__mf/js/async/7192.4de9c6ee.js +1 -0
- package/__mf/js/async/7647.56445ecd.js +1 -0
- package/__mf/js/async/7862.9d9007af.js +2 -0
- package/__mf/js/async/7894.3f4153b0.js +1 -0
- package/__mf/js/async/7968.e2c70459.js +1 -0
- package/__mf/js/async/7978.ddabf18e.js +1 -0
- package/__mf/js/async/7984.e80ae184.js +22 -0
- package/__mf/js/async/8356.e01ee829.js +1 -0
- package/__mf/js/async/8470.b11a8957.js +2 -0
- package/__mf/js/async/851.c5db9756.js +1 -0
- package/__mf/js/async/873.5877e102.js +1 -0
- package/__mf/js/async/8888.8d48a6ee.js +1 -0
- package/__mf/js/async/899.253567a6.js +1 -0
- package/__mf/js/async/9020.3de2dac7.js +1 -0
- package/__mf/js/async/9184.e1e86d58.js +1 -0
- package/__mf/js/async/9235.a8bf4fd8.js +1 -0
- package/__mf/js/async/941.3020e9b0.js +2 -0
- package/__mf/js/async/9537.d74b4d52.js +1 -0
- package/__mf/js/async/9588.a934a42d.js +1 -0
- package/__mf/js/async/9745.8a112555.js +1 -0
- package/__mf/js/async/9836.5d033753.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusDatasource.3e365ba8.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusExplorer.54b7bd6d.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.39d61ff7.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.625e0810.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusPromQLAnnotation.0ada2816.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.1f09a9bc.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.63010995.js +1 -0
- package/__mf/js/main.50a64eeb.js +7 -0
- package/lib/annotations/PrometheusPromQLAnnotation.d.ts +4 -0
- package/lib/annotations/PrometheusPromQLAnnotation.d.ts.map +1 -0
- package/lib/annotations/PrometheusPromQLAnnotation.js +32 -0
- package/lib/annotations/PrometheusPromQLAnnotation.js.map +1 -0
- package/lib/annotations/PrometheusPromQLAnnotationOptionEditor.d.ts +13 -0
- package/lib/annotations/PrometheusPromQLAnnotationOptionEditor.d.ts.map +1 -0
- package/lib/annotations/PrometheusPromQLAnnotationOptionEditor.js +139 -0
- package/lib/annotations/PrometheusPromQLAnnotationOptionEditor.js.map +1 -0
- package/lib/annotations/get-annotation-data.d.ts +5 -0
- package/lib/annotations/get-annotation-data.d.ts.map +1 -0
- package/lib/annotations/get-annotation-data.js +79 -0
- package/lib/annotations/get-annotation-data.js.map +1 -0
- package/lib/annotations/index.d.ts +2 -0
- package/lib/annotations/index.d.ts.map +1 -0
- package/lib/annotations/index.js +15 -0
- package/lib/annotations/index.js.map +1 -0
- package/lib/cjs/annotations/PrometheusPromQLAnnotation.js +40 -0
- package/lib/cjs/annotations/PrometheusPromQLAnnotationOptionEditor.js +147 -0
- package/lib/cjs/annotations/get-annotation-data.js +87 -0
- package/lib/cjs/annotations/index.js +30 -0
- package/lib/cjs/explore/PrometheusExplorer.js +2 -16
- package/lib/cjs/explore/PrometheusMetricsFinder/overview/MetricOverview.js +3 -13
- package/lib/cjs/index.js +1 -0
- package/lib/explore/PrometheusExplorer.d.ts.map +1 -1
- package/lib/explore/PrometheusExplorer.js +2 -16
- package/lib/explore/PrometheusExplorer.js.map +1 -1
- package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.d.ts.map +1 -1
- package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js +3 -13
- package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/plugins/PrometheusLabelValuesVariable.d.ts.map +1 -1
- package/lib/plugins/PrometheusLabelValuesVariable.js.map +1 -1
- package/lib/plugins/types.d.ts +7 -0
- package/lib/plugins/types.d.ts.map +1 -1
- package/lib/plugins/types.js.map +1 -1
- package/mf-manifest.json +341 -267
- package/mf-stats.json +356 -286
- package/package.json +15 -6
- package/__mf/js/Prometheus.e833859d.js +0 -7
- package/__mf/js/async/1432.0bb0ef6b.js +0 -1
- package/__mf/js/async/1616.ed429c53.js +0 -1
- package/__mf/js/async/1728.11ee7ff9.js +0 -1
- package/__mf/js/async/1969.a1e1979e.js +0 -1
- package/__mf/js/async/2043.c2948add.js +0 -2
- package/__mf/js/async/2228.53db17f4.js +0 -2
- package/__mf/js/async/2506.baf20a10.js +0 -1
- package/__mf/js/async/2814.fbf52858.js +0 -1
- package/__mf/js/async/2979.1d711dae.js +0 -1
- package/__mf/js/async/3075.08023434.js +0 -1
- package/__mf/js/async/3499.19c4bfa6.js +0 -1
- package/__mf/js/async/3613.f0b10cb1.js +0 -22
- package/__mf/js/async/392.233c0945.js +0 -2
- package/__mf/js/async/3963.81c8be7e.js +0 -1
- package/__mf/js/async/4121.9ed83f2a.js +0 -2
- package/__mf/js/async/425.b9d2dc6f.js +0 -1
- package/__mf/js/async/4626.90ae092f.js +0 -1
- package/__mf/js/async/4987.f7360bdf.js +0 -1
- package/__mf/js/async/5002.bd952313.js +0 -1
- package/__mf/js/async/5071.5fcfd9a8.js +0 -1
- package/__mf/js/async/5440.9f33f7a9.js +0 -2
- package/__mf/js/async/5587.e4d331db.js +0 -1
- package/__mf/js/async/5763.ccf403b7.js +0 -1
- package/__mf/js/async/5922.ba33c996.js +0 -1
- package/__mf/js/async/6274.f04c9ecd.js +0 -2
- package/__mf/js/async/6438.b86a2aba.js +0 -1
- package/__mf/js/async/6507.71182781.js +0 -1
- package/__mf/js/async/7177.0ab860e0.js +0 -1
- package/__mf/js/async/7192.bbf62500.js +0 -1
- package/__mf/js/async/7647.82297501.js +0 -1
- package/__mf/js/async/7862.e13fbb9d.js +0 -2
- package/__mf/js/async/7894.9fe90396.js +0 -1
- package/__mf/js/async/7968.253f5f1d.js +0 -1
- package/__mf/js/async/7978.be30c741.js +0 -1
- package/__mf/js/async/8002.011a74d4.js +0 -3
- package/__mf/js/async/8356.6a2bfd53.js +0 -1
- package/__mf/js/async/8470.84935087.js +0 -2
- package/__mf/js/async/873.6aafbb7b.js +0 -1
- package/__mf/js/async/8888.3a188176.js +0 -1
- package/__mf/js/async/9020.311b6932.js +0 -1
- package/__mf/js/async/9184.e6de21be.js +0 -1
- package/__mf/js/async/9235.85fb6b63.js +0 -1
- package/__mf/js/async/941.075ed563.js +0 -2
- package/__mf/js/async/9537.d1466e1b.js +0 -1
- package/__mf/js/async/9588.dfdaeff2.js +0 -1
- package/__mf/js/async/9594.d1a3d0d9.js +0 -1
- package/__mf/js/async/9745.0a6c90a2.js +0 -1
- package/__mf/js/async/9836.888f4ed2.js +0 -1
- package/__mf/js/async/__federation_expose_PrometheusDatasource.534ca47d.js +0 -1
- package/__mf/js/async/__federation_expose_PrometheusExplorer.2c37dbd9.js +0 -1
- package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.ffb9bbc3.js +0 -1
- package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.a17f75cc.js +0 -1
- package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.26f85fc6.js +0 -1
- package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.6626e886.js +0 -1
- package/__mf/js/main.f4a1cbf1.js +0 -7
- /package/__mf/js/async/{1605.7c7a0998.js.LICENSE.txt → 1605.a204b95c.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2043.c2948add.js.LICENSE.txt → 2043.d03e35cf.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2177.a9ef2479.js.LICENSE.txt → 2177.1bd9b5dd.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.233c0945.js.LICENSE.txt → 392.7bf830d9.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.9ed83f2a.js.LICENSE.txt → 4121.c001d061.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2228.53db17f4.js.LICENSE.txt → 4635.1d829282.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5440.9f33f7a9.js.LICENSE.txt → 5440.62626c57.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.f04c9ecd.js.LICENSE.txt → 6274.404a3115.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7862.e13fbb9d.js.LICENSE.txt → 7862.9d9007af.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3613.f0b10cb1.js.LICENSE.txt → 7984.e80ae184.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.84935087.js.LICENSE.txt → 8470.b11a8957.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.075ed563.js.LICENSE.txt → 941.3020e9b0.js.LICENSE.txt} +0 -0
|
@@ -26,9 +26,9 @@ export function OverviewPanel({ metricName, datasource, filters, type, isLoading
|
|
|
26
26
|
const { width, ref: panelRef } = useResizeObserver();
|
|
27
27
|
const suggestedStepMs = useSuggestedStepMs(width);
|
|
28
28
|
const [rateEnabled, setRateEnabled] = useState(true);
|
|
29
|
-
const
|
|
29
|
+
const queries = useMemo(()=>{
|
|
30
30
|
const expr = type === 'counter' || rateEnabled && (type === undefined || type === 'summary' || type === 'histogram') ? `rate({__name__="${metricName}", ${computeFilterExpr(filters)}}[5m])` : `{__name__="${metricName}", ${computeFilterExpr(filters)}}`;
|
|
31
|
-
|
|
31
|
+
return [
|
|
32
32
|
{
|
|
33
33
|
kind: 'TimeSeriesQuery',
|
|
34
34
|
spec: {
|
|
@@ -42,16 +42,6 @@ export function OverviewPanel({ metricName, datasource, filters, type, isLoading
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
];
|
|
45
|
-
const definitions = queries.map((query)=>{
|
|
46
|
-
return {
|
|
47
|
-
kind: query.spec.plugin.kind,
|
|
48
|
-
spec: query.spec.plugin.spec
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
queries,
|
|
53
|
-
definitions
|
|
54
|
-
};
|
|
55
45
|
}, [
|
|
56
46
|
datasource,
|
|
57
47
|
filters,
|
|
@@ -82,7 +72,7 @@ export function OverviewPanel({ metricName, datasource, filters, type, isLoading
|
|
|
82
72
|
onChange: (_, checked)=>setRateEnabled(checked)
|
|
83
73
|
}),
|
|
84
74
|
/*#__PURE__*/ _jsx(DataQueriesProvider, {
|
|
85
|
-
definitions:
|
|
75
|
+
definitions: queries,
|
|
86
76
|
options: {
|
|
87
77
|
suggestedStepMs,
|
|
88
78
|
mode: 'range'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/explore/PrometheusMetricsFinder/overview/MetricOverview.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 { Checkbox, FormControlLabel, Skeleton, Stack, StackProps, Tab, Tabs, Tooltip } from '@mui/material';\nimport { ReactElement, useMemo, useState } from 'react';\n\nimport { Panel } from '@perses-dev/dashboards';\nimport useResizeObserver from 'use-resize-observer';\nimport { DataQueriesProvider, useSuggestedStepMs } from '@perses-dev/plugin-system';\nimport HelpCircleOutlineIcon from 'mdi-material-ui/HelpCircleOutline';\nimport { DatasourceSelector, Definition, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport { computeFilterExpr, LabelFilter } from '../types';\nimport { useMetricMetadata } from '../utils';\nimport { OverviewTab } from './tabs/OverviewTab';\nimport { JobTab } from './tabs/JobTab';\nimport { SimilarTab } from './tabs/SimilarTab';\n\nexport interface OverviewPanelProps extends StackProps {\n metricName: string;\n datasource: DatasourceSelector;\n filters: LabelFilter[];\n type?: string;\n isLoading?: boolean;\n}\n\nexport function OverviewPanel({\n metricName,\n datasource,\n filters,\n type,\n isLoading,\n ...props\n}: OverviewPanelProps): ReactElement {\n const { width, ref: panelRef } = useResizeObserver();\n const suggestedStepMs = useSuggestedStepMs(width);\n\n const [rateEnabled, setRateEnabled] = useState(true);\n\n const { queries, definitions }: { queries: QueryDefinition[]; definitions: Array<Definition<UnknownSpec>> } =\n useMemo(() => {\n const expr =\n type === 'counter' || (rateEnabled && (type === undefined || type === 'summary' || type === 'histogram'))\n ? `rate({__name__=\"${metricName}\", ${computeFilterExpr(filters)}}[5m])`\n : `{__name__=\"${metricName}\", ${computeFilterExpr(filters)}}`;\n\n const queries = [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n datasource: datasource,\n query: expr,\n },\n },\n },\n },\n ];\n\n const definitions = queries.map((query) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n });\n\n return { queries, definitions };\n }, [datasource, filters, metricName, rateEnabled, type]);\n\n if (isLoading) {\n return (\n <Stack {...props}>\n <Skeleton variant=\"rectangular\" height=\"100%\" />\n </Stack>\n );\n }\n\n return (\n <Stack ref={panelRef} alignItems=\"end\" {...props}>\n {(type === undefined || type === 'summary' || type === 'histogram') && (\n <FormControlLabel\n control={<Checkbox size=\"small\" />}\n label=\"Enable rate\"\n checked={rateEnabled}\n onChange={(_, checked) => setRateEnabled(checked)}\n />\n )}\n <DataQueriesProvider definitions={definitions} options={{ suggestedStepMs, mode: 'range' }}>\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: {\n queries: queries,\n display: { name: '' },\n plugin: { kind: 'TimeSeriesChart', spec: {} },\n },\n }}\n />\n </DataQueriesProvider>\n </Stack>\n );\n}\n\nexport interface MetricOverviewProps extends StackProps {\n metricName: string;\n datasource: DatasourceSelector;\n filters: LabelFilter[];\n isMetadataEnabled?: boolean;\n isPanelEnabled?: boolean;\n onExplore?: (metricName: string) => void;\n onFiltersChange: (filters: LabelFilter[]) => void;\n}\n\nexport function MetricOverview({\n metricName,\n datasource,\n filters,\n isMetadataEnabled,\n isPanelEnabled,\n onExplore,\n onFiltersChange,\n ...props\n}: MetricOverviewProps): ReactElement {\n const [tab, setTab] = useState(0);\n const { metadata, isLoading: isMetadataLoading } = useMetricMetadata(metricName, datasource);\n\n const filtersWithMetricName: LabelFilter[] = useMemo(() => {\n const result = filters.filter((filter) => filter.label !== '__name__');\n result.push({ label: '__name__', labelValues: [metricName], operator: '=' });\n return result;\n }, [filters, metricName]);\n\n function handleFilterAdd(filter: LabelFilter): void {\n onFiltersChange([...filters, filter]);\n }\n\n function handleExplore(metricName: string, tab?: number): void {\n onExplore?.(metricName);\n if (tab !== undefined) {\n setTab(tab);\n }\n }\n\n return (\n <Stack sx={{ width: '100%' }} {...props}>\n {isPanelEnabled && (\n <OverviewPanel\n metricName={metricName}\n filters={filters}\n datasource={datasource}\n type={metadata?.type}\n height=\"250px\"\n isLoading={isMetadataEnabled && isMetadataLoading}\n />\n )}\n <Tabs\n value={tab}\n onChange={(_, state) => setTab(state)}\n variant=\"scrollable\"\n sx={{ borderBottom: 1, borderColor: 'divider' }}\n >\n <Tab label=\"Overview\" />\n <Tab\n label=\"Job related metrics\"\n icon={\n <Tooltip title=\"All metrics scraped from the same job\" placement=\"top\">\n <HelpCircleOutlineIcon />\n </Tooltip>\n }\n iconPosition=\"end\"\n />\n {filters.length > 0 && (\n <Tab\n label=\"Similar metrics\"\n icon={\n <Tooltip title=\"All metrics matching current filters\" placement=\"top\">\n <HelpCircleOutlineIcon />\n </Tooltip>\n }\n iconPosition=\"end\"\n />\n )}\n </Tabs>\n <Stack gap={1}>\n {tab === 0 && (\n <OverviewTab\n metricName={metricName}\n datasource={datasource}\n filters={filtersWithMetricName}\n onFilterAdd={handleFilterAdd}\n />\n )}\n {tab === 1 && (\n <JobTab\n filters={filtersWithMetricName}\n datasource={datasource}\n isMetadataEnabled={isMetadataEnabled}\n onExplore={(metricName) => handleExplore(metricName, 0)}\n />\n )}\n {tab === 2 && (\n <SimilarTab\n filters={filtersWithMetricName}\n datasource={datasource}\n isMetadataEnabled={isMetadataEnabled}\n onExplore={(metricName) => handleExplore(metricName, 0)}\n />\n )}\n </Stack>\n </Stack>\n );\n}\n"],"names":["Checkbox","FormControlLabel","Skeleton","Stack","Tab","Tabs","Tooltip","useMemo","useState","Panel","useResizeObserver","DataQueriesProvider","useSuggestedStepMs","HelpCircleOutlineIcon","computeFilterExpr","useMetricMetadata","OverviewTab","JobTab","SimilarTab","OverviewPanel","metricName","datasource","filters","type","isLoading","props","width","ref","panelRef","suggestedStepMs","rateEnabled","setRateEnabled","queries","definitions","expr","undefined","kind","spec","plugin","query","map","variant","height","alignItems","control","size","label","checked","onChange","_","options","mode","panelOptions","hideHeader","definition","display","name","MetricOverview","isMetadataEnabled","isPanelEnabled","onExplore","onFiltersChange","tab","setTab","metadata","isMetadataLoading","filtersWithMetricName","result","filter","push","labelValues","operator","handleFilterAdd","handleExplore","sx","value","state","borderBottom","borderColor","icon","title","placement","iconPosition","length","gap","onFilterAdd"],"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,QAAQ,EAAEC,gBAAgB,EAAEC,QAAQ,EAAEC,KAAK,EAAcC,GAAG,EAAEC,IAAI,EAAEC,OAAO,QAAQ,gBAAgB;AAC5G,SAAuBC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAExD,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,OAAOC,uBAAuB,sBAAsB;AACpD,SAASC,mBAAmB,EAAEC,kBAAkB,QAAQ,4BAA4B;AACpF,OAAOC,2BAA2B,oCAAoC;AAEtE,SAASC,iBAAiB,QAAqB,WAAW;AAC1D,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ACrB4B,OAAOD;QACT;IACF;IAEA,qBACE,MAAC3D;QAAMuE,IAAI;YAAEhD,OAAO;QAAO;QAAI,GAAGD,KAAK;;YACpCkC,gCACC,KAACxC;gBACCC,YAAYA;gBACZE,SAASA;gBACTD,YAAYA;gBACZE,MAAMyC,UAAUzC;gBAChBmB,QAAO;gBACPlB,WAAWkC,qBAAqBO;;0BAGpC,MAAC5D;gBACCsE,OAAOb;gBACPd,UAAU,CAACC,GAAG2B,QAAUb,OAAOa;gBAC/BnC,SAAQ;gBACRiC,IAAI;oBAAEG,cAAc;oBAAGC,aAAa;gBAAU;;kCAE9C,KAAC1E;wBAAI0C,OAAM;;kCACX,KAAC1C;wBACC0C,OAAM;wBACNiC,oBACE,KAACzE;4BAAQ0E,OAAM;4BAAwCC,WAAU;sCAC/D,cAAA,KAACpE;;wBAGLqE,cAAa;;oBAEd5D,QAAQ6D,MAAM,GAAG,mBAChB,KAAC/E;wBACC0C,OAAM;wBACNiC,oBACE,KAACzE;4BAAQ0E,OAAM;4BAAuCC,WAAU;sCAC9D,cAAA,KAACpE;;wBAGLqE,cAAa;;;;0BAInB,MAAC/E;gBAAMiF,KAAK;;oBACTtB,QAAQ,mBACP,KAAC9C;wBACCI,YAAYA;wBACZC,YAAYA;wBACZC,SAAS4C;wBACTmB,aAAab;;oBAGhBV,QAAQ,mBACP,KAAC7C;wBACCK,SAAS4C;wBACT7C,YAAYA;wBACZqC,mBAAmBA;wBACnBE,WAAW,CAACxC,aAAeqD,cAAcrD,YAAY;;oBAGxD0C,QAAQ,mBACP,KAAC5C;wBACCI,SAAS4C;wBACT7C,YAAYA;wBACZqC,mBAAmBA;wBACnBE,WAAW,CAACxC,aAAeqD,cAAcrD,YAAY;;;;;;AAMjE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/explore/PrometheusMetricsFinder/overview/MetricOverview.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 { Checkbox, FormControlLabel, Skeleton, Stack, StackProps, Tab, Tabs, Tooltip } from '@mui/material';\nimport { ReactElement, useMemo, useState } from 'react';\n\nimport { Panel } from '@perses-dev/dashboards';\nimport useResizeObserver from 'use-resize-observer';\nimport { DataQueriesProvider, useSuggestedStepMs } from '@perses-dev/plugin-system';\nimport HelpCircleOutlineIcon from 'mdi-material-ui/HelpCircleOutline';\nimport { DatasourceSelector, QueryDefinition } from '@perses-dev/spec';\nimport { computeFilterExpr, LabelFilter } from '../types';\nimport { useMetricMetadata } from '../utils';\nimport { OverviewTab } from './tabs/OverviewTab';\nimport { JobTab } from './tabs/JobTab';\nimport { SimilarTab } from './tabs/SimilarTab';\n\nexport interface OverviewPanelProps extends StackProps {\n metricName: string;\n datasource: DatasourceSelector;\n filters: LabelFilter[];\n type?: string;\n isLoading?: boolean;\n}\n\nexport function OverviewPanel({\n metricName,\n datasource,\n filters,\n type,\n isLoading,\n ...props\n}: OverviewPanelProps): ReactElement {\n const { width, ref: panelRef } = useResizeObserver();\n const suggestedStepMs = useSuggestedStepMs(width);\n\n const [rateEnabled, setRateEnabled] = useState(true);\n\n const queries: QueryDefinition[] = useMemo(() => {\n const expr =\n type === 'counter' || (rateEnabled && (type === undefined || type === 'summary' || type === 'histogram'))\n ? `rate({__name__=\"${metricName}\", ${computeFilterExpr(filters)}}[5m])`\n : `{__name__=\"${metricName}\", ${computeFilterExpr(filters)}}`;\n\n return [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n datasource: datasource,\n query: expr,\n },\n },\n },\n },\n ];\n }, [datasource, filters, metricName, rateEnabled, type]);\n\n if (isLoading) {\n return (\n <Stack {...props}>\n <Skeleton variant=\"rectangular\" height=\"100%\" />\n </Stack>\n );\n }\n\n return (\n <Stack ref={panelRef} alignItems=\"end\" {...props}>\n {(type === undefined || type === 'summary' || type === 'histogram') && (\n <FormControlLabel\n control={<Checkbox size=\"small\" />}\n label=\"Enable rate\"\n checked={rateEnabled}\n onChange={(_, checked) => setRateEnabled(checked)}\n />\n )}\n <DataQueriesProvider definitions={queries} options={{ suggestedStepMs, mode: 'range' }}>\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: {\n queries: queries,\n display: { name: '' },\n plugin: { kind: 'TimeSeriesChart', spec: {} },\n },\n }}\n />\n </DataQueriesProvider>\n </Stack>\n );\n}\n\nexport interface MetricOverviewProps extends StackProps {\n metricName: string;\n datasource: DatasourceSelector;\n filters: LabelFilter[];\n isMetadataEnabled?: boolean;\n isPanelEnabled?: boolean;\n onExplore?: (metricName: string) => void;\n onFiltersChange: (filters: LabelFilter[]) => void;\n}\n\nexport function MetricOverview({\n metricName,\n datasource,\n filters,\n isMetadataEnabled,\n isPanelEnabled,\n onExplore,\n onFiltersChange,\n ...props\n}: MetricOverviewProps): ReactElement {\n const [tab, setTab] = useState(0);\n const { metadata, isLoading: isMetadataLoading } = useMetricMetadata(metricName, datasource);\n\n const filtersWithMetricName: LabelFilter[] = useMemo(() => {\n const result = filters.filter((filter) => filter.label !== '__name__');\n result.push({ label: '__name__', labelValues: [metricName], operator: '=' });\n return result;\n }, [filters, metricName]);\n\n function handleFilterAdd(filter: LabelFilter): void {\n onFiltersChange([...filters, filter]);\n }\n\n function handleExplore(metricName: string, tab?: number): void {\n onExplore?.(metricName);\n if (tab !== undefined) {\n setTab(tab);\n }\n }\n\n return (\n <Stack sx={{ width: '100%' }} {...props}>\n {isPanelEnabled && (\n <OverviewPanel\n metricName={metricName}\n filters={filters}\n datasource={datasource}\n type={metadata?.type}\n height=\"250px\"\n isLoading={isMetadataEnabled && isMetadataLoading}\n />\n )}\n <Tabs\n value={tab}\n onChange={(_, state) => setTab(state)}\n variant=\"scrollable\"\n sx={{ borderBottom: 1, borderColor: 'divider' }}\n >\n <Tab label=\"Overview\" />\n <Tab\n label=\"Job related metrics\"\n icon={\n <Tooltip title=\"All metrics scraped from the same job\" placement=\"top\">\n <HelpCircleOutlineIcon />\n </Tooltip>\n }\n iconPosition=\"end\"\n />\n {filters.length > 0 && (\n <Tab\n label=\"Similar metrics\"\n icon={\n <Tooltip title=\"All metrics matching current filters\" placement=\"top\">\n <HelpCircleOutlineIcon />\n </Tooltip>\n }\n iconPosition=\"end\"\n />\n )}\n </Tabs>\n <Stack gap={1}>\n {tab === 0 && (\n <OverviewTab\n metricName={metricName}\n datasource={datasource}\n filters={filtersWithMetricName}\n onFilterAdd={handleFilterAdd}\n />\n )}\n {tab === 1 && (\n <JobTab\n filters={filtersWithMetricName}\n datasource={datasource}\n isMetadataEnabled={isMetadataEnabled}\n onExplore={(metricName) => handleExplore(metricName, 0)}\n />\n )}\n {tab === 2 && (\n <SimilarTab\n filters={filtersWithMetricName}\n datasource={datasource}\n isMetadataEnabled={isMetadataEnabled}\n onExplore={(metricName) => handleExplore(metricName, 0)}\n />\n )}\n </Stack>\n </Stack>\n );\n}\n"],"names":["Checkbox","FormControlLabel","Skeleton","Stack","Tab","Tabs","Tooltip","useMemo","useState","Panel","useResizeObserver","DataQueriesProvider","useSuggestedStepMs","HelpCircleOutlineIcon","computeFilterExpr","useMetricMetadata","OverviewTab","JobTab","SimilarTab","OverviewPanel","metricName","datasource","filters","type","isLoading","props","width","ref","panelRef","suggestedStepMs","rateEnabled","setRateEnabled","queries","expr","undefined","kind","spec","plugin","query","variant","height","alignItems","control","size","label","checked","onChange","_","definitions","options","mode","panelOptions","hideHeader","definition","display","name","MetricOverview","isMetadataEnabled","isPanelEnabled","onExplore","onFiltersChange","tab","setTab","metadata","isMetadataLoading","filtersWithMetricName","result","filter","push","labelValues","operator","handleFilterAdd","handleExplore","sx","value","state","borderBottom","borderColor","icon","title","placement","iconPosition","length","gap","onFilterAdd"],"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,QAAQ,EAAEC,gBAAgB,EAAEC,QAAQ,EAAEC,KAAK,EAAcC,GAAG,EAAEC,IAAI,EAAEC,OAAO,QAAQ,gBAAgB;AAC5G,SAAuBC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAExD,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,OAAOC,uBAAuB,sBAAsB;AACpD,SAASC,mBAAmB,EAAEC,kBAAkB,QAAQ,4BAA4B;AACpF,OAAOC,2BAA2B,oCAAoC;AAEtE,SAASC,iBAAiB,QAAqB,WAAW;AAC1D,SAASC,iBAAiB,QAAQ,WAAW;AAC7C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,UAAU,QAAQ,oBAAoB;AAU/C,OAAO,SAASC,cAAc,EAC5BC,UAAU,EACVC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,SAAS,EACT,GAAGC,OACgB;IACnB,MAAM,EAAEC,KAAK,EAAEC,KAAKC,QAAQ,EAAE,GAAGlB;IACjC,MAAMmB,kBAAkBjB,mBAAmBc;IAE3C,MAAM,CAACI,aAAaC,eAAe,GAAGvB,SAAS;IAE/C,MAAMwB,UAA6BzB,QAAQ;QACzC,MAAM0B,OACJV,SAAS,aAAcO,eAAgBP,CAAAA,SAASW,aAAaX,SAAS,aAAaA,SAAS,WAAU,IAClG,CAAC,gBAAgB,EAAEH,WAAW,GAAG,EAAEN,kBAAkBQ,SAAS,MAAM,CAAC,GACrE,CAAC,WAAW,EAAEF,WAAW,GAAG,EAAEN,kBAAkBQ,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BA;wBACnBE,WAAW,CAACvC,aAAeoD,cAAcpD,YAAY;;oBAGxDyC,QAAQ,mBACP,KAAC3C;wBACCI,SAAS2C;wBACT5C,YAAYA;wBACZoC,mBAAmBA;wBACnBE,WAAW,CAACvC,aAAeoD,cAAcpD,YAAY;;;;;;AAMjE"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
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 * from './annotations';
|
|
13
14
|
export * from './components';
|
|
14
15
|
export * from './explore';
|
|
15
16
|
export { getPluginModule } from './getPluginModule';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 * from './components';\nexport * from './explore';\nexport { getPluginModule } from './getPluginModule';\nexport * from './model';\nexport * from './plugins';\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,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,UAAU;AACxB,cAAc,YAAY"}
|
|
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 * from './annotations';\nexport * from './components';\nexport * from './explore';\nexport { getPluginModule } from './getPluginModule';\nexport * from './model';\nexport * from './plugins';\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,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,UAAU;AACxB,cAAc,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrometheusLabelValuesVariable.d.ts","sourceRoot":"","sources":["../../../src/plugins/PrometheusLabelValuesVariable.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,cAAc,EAOf,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAAE,oCAAoC,EAA4B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"PrometheusLabelValuesVariable.d.ts","sourceRoot":"","sources":["../../../src/plugins/PrometheusLabelValuesVariable.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,cAAc,EAOf,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAAE,oCAAoC,EAA4B,MAAM,SAAS,CAAC;AAsEzF,eAAO,MAAM,6BAA6B,EAAE,cAAc,CAAC,oCAAoC,CA2D9F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/PrometheusLabelValuesVariable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n VariablePlugin,\n GetVariableOptionsContext,\n replaceVariables,\n parseVariables,\n datasourceSelectValueToSelector,\n isVariableDatasource,\n DatasourceStore,\n} from '@perses-dev/plugin-system';\nimport { DatasourceSelector, DatasourceSpec } from '@perses-dev/spec';\nimport { DEFAULT_PROM, getPrometheusTimeRange, PROM_DATASOURCE_KIND } from '../model';\nimport { stringArrayToVariableOptions, PrometheusLabelValuesVariableEditor } from './prometheus-variables';\nimport { resolvePrometheusDatasource } from './interpolation';\nimport { PrometheusLabelValuesVariableOptions, PrometheusDatasourceSpec } from './types';\n\nfunction extractDatasourceVariables(datasourceSpec: DatasourceSpec<PrometheusDatasourceSpec>): string[] {\n try {\n const spec = datasourceSpec.plugin.spec;\n\n // Pure function to extract variables from string or array values\n const extractFromValue = (value: string | string[]): string[] => {\n if (typeof value === 'string') {\n return parseVariables(value);\n } else if (Array.isArray(value)) {\n return value.flatMap((item) => {\n return typeof item === 'string' ? parseVariables(item) : [];\n });\n }\n return [];\n };\n\n const allVariables: string[] = [];\n\n // Extract variables from queryParams\n if (spec.queryParams) {\n Object.values(spec.queryParams).forEach((value) => {\n allVariables.push(...extractFromValue(value));\n });\n }\n\n // Extract variables from directUrl\n if (spec.directUrl) {\n allVariables.push(...extractFromValue(spec.directUrl));\n }\n\n // Extract variables from proxy configuration\n if (spec.proxy?.spec) {\n // Extract from proxy URL\n if (spec.proxy.spec.url) {\n allVariables.push(...extractFromValue(spec.proxy.spec.url));\n }\n\n // Extract from proxy headers\n if (spec.proxy.spec.headers) {\n Object.values(spec.proxy.spec.headers).forEach((value) => {\n if (typeof value === 'string') {\n allVariables.push(...extractFromValue(value));\n }\n });\n }\n }\n\n return Array.from(new Set(allVariables)); // Remove duplicates\n } catch {\n return [];\n }\n}\n\nfunction getDatasourceVariablesFromCache(\n datasourceSelector: DatasourceSelector,\n datasourceStore: DatasourceStore\n): string[] {\n try {\n if (!datasourceStore.getDatasourceSpecSync) return [];\n\n const datasourceSpec = datasourceStore.getDatasourceSpecSync(datasourceSelector) as\n
|
|
1
|
+
{"version":3,"sources":["../../../src/plugins/PrometheusLabelValuesVariable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n VariablePlugin,\n GetVariableOptionsContext,\n replaceVariables,\n parseVariables,\n datasourceSelectValueToSelector,\n isVariableDatasource,\n DatasourceStore,\n} from '@perses-dev/plugin-system';\nimport { DatasourceSelector, DatasourceSpec } from '@perses-dev/spec';\nimport { DEFAULT_PROM, getPrometheusTimeRange, PROM_DATASOURCE_KIND } from '../model';\nimport { stringArrayToVariableOptions, PrometheusLabelValuesVariableEditor } from './prometheus-variables';\nimport { resolvePrometheusDatasource } from './interpolation';\nimport { PrometheusLabelValuesVariableOptions, PrometheusDatasourceSpec } from './types';\n\nfunction extractDatasourceVariables(datasourceSpec: DatasourceSpec<PrometheusDatasourceSpec>): string[] {\n try {\n const spec = datasourceSpec.plugin.spec;\n\n // Pure function to extract variables from string or array values\n const extractFromValue = (value: string | string[]): string[] => {\n if (typeof value === 'string') {\n return parseVariables(value);\n } else if (Array.isArray(value)) {\n return value.flatMap((item) => {\n return typeof item === 'string' ? parseVariables(item) : [];\n });\n }\n return [];\n };\n\n const allVariables: string[] = [];\n\n // Extract variables from queryParams\n if (spec.queryParams) {\n Object.values(spec.queryParams).forEach((value) => {\n allVariables.push(...extractFromValue(value));\n });\n }\n\n // Extract variables from directUrl\n if (spec.directUrl) {\n allVariables.push(...extractFromValue(spec.directUrl));\n }\n\n // Extract variables from proxy configuration\n if (spec.proxy?.spec) {\n // Extract from proxy URL\n if (spec.proxy.spec.url) {\n allVariables.push(...extractFromValue(spec.proxy.spec.url));\n }\n\n // Extract from proxy headers\n if (spec.proxy.spec.headers) {\n Object.values(spec.proxy.spec.headers).forEach((value) => {\n if (typeof value === 'string') {\n allVariables.push(...extractFromValue(value));\n }\n });\n }\n }\n\n return Array.from(new Set(allVariables)); // Remove duplicates\n } catch {\n return [];\n }\n}\n\nfunction getDatasourceVariablesFromCache(\n datasourceSelector: DatasourceSelector,\n datasourceStore: DatasourceStore\n): string[] {\n try {\n if (!datasourceStore.getDatasourceSpecSync) return [];\n\n const datasourceSpec = datasourceStore.getDatasourceSpecSync(datasourceSelector) as\n DatasourceSpec<PrometheusDatasourceSpec> | undefined;\n return datasourceSpec ? extractDatasourceVariables(datasourceSpec) : [];\n } catch {\n return [];\n }\n}\n\nexport const PrometheusLabelValuesVariable: VariablePlugin<PrometheusLabelValuesVariableOptions> = {\n getVariableOptions: async (spec: PrometheusLabelValuesVariableOptions, ctx: GetVariableOptionsContext) => {\n const pluginDef = spec;\n const datasourceSelector =\n datasourceSelectValueToSelector(\n spec.datasource ?? DEFAULT_PROM,\n ctx.variables,\n await ctx.datasourceStore.listDatasourceSelectItems(PROM_DATASOURCE_KIND)\n ) ?? DEFAULT_PROM;\n\n const { client, requestOptions } = await resolvePrometheusDatasource(\n ctx.datasourceStore,\n datasourceSelector,\n ctx.variables\n );\n const match = pluginDef.matchers ? pluginDef.matchers.map((m) => replaceVariables(m, ctx.variables)) : undefined;\n\n const timeRange = getPrometheusTimeRange(ctx.timeRange);\n\n const { data: options } = await client.labelValues(\n {\n labelName: replaceVariables(pluginDef.labelName, ctx.variables),\n 'match[]': match,\n ...timeRange,\n },\n requestOptions\n );\n return {\n data: stringArrayToVariableOptions(options),\n };\n },\n dependsOn: (spec: PrometheusLabelValuesVariableOptions, ctx?: GetVariableOptionsContext) => {\n const matcherVariables = spec.matchers?.map((m) => parseVariables(m)).flat() || [];\n const labelVariables = parseVariables(spec.labelName);\n const datasourceVariables =\n spec.datasource && isVariableDatasource(spec.datasource) ? parseVariables(spec.datasource) : [];\n\n let datasourceVariablesFromCache: string[] = [];\n if (ctx?.datasourceStore && ctx?.variables) {\n const datasourceValue = spec.datasource ?? DEFAULT_PROM;\n const datasourceSelector: DatasourceSelector =\n typeof datasourceValue === 'string' ? { kind: PROM_DATASOURCE_KIND, name: datasourceValue } : datasourceValue;\n datasourceVariablesFromCache = getDatasourceVariablesFromCache(datasourceSelector, ctx.datasourceStore);\n }\n\n const allDependencies = [\n ...matcherVariables,\n ...labelVariables,\n ...datasourceVariables,\n ...datasourceVariablesFromCache,\n ];\n const uniqueDependencies = Array.from(new Set(allDependencies));\n\n return {\n variables: uniqueDependencies,\n };\n },\n OptionsEditorComponent: PrometheusLabelValuesVariableEditor,\n createInitialOptions: () => ({ labelName: '' }),\n};\n"],"names":["replaceVariables","parseVariables","datasourceSelectValueToSelector","isVariableDatasource","DEFAULT_PROM","getPrometheusTimeRange","PROM_DATASOURCE_KIND","stringArrayToVariableOptions","PrometheusLabelValuesVariableEditor","resolvePrometheusDatasource","extractDatasourceVariables","datasourceSpec","spec","plugin","extractFromValue","value","Array","isArray","flatMap","item","allVariables","queryParams","Object","values","forEach","push","directUrl","proxy","url","headers","from","Set","getDatasourceVariablesFromCache","datasourceSelector","datasourceStore","getDatasourceSpecSync","PrometheusLabelValuesVariable","getVariableOptions","ctx","pluginDef","datasource","variables","listDatasourceSelectItems","client","requestOptions","match","matchers","map","m","undefined","timeRange","data","options","labelValues","labelName","dependsOn","matcherVariables","flat","labelVariables","datasourceVariables","datasourceVariablesFromCache","datasourceValue","kind","name","allDependencies","uniqueDependencies","OptionsEditorComponent","createInitialOptions"],"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,SAGEA,gBAAgB,EAChBC,cAAc,EACdC,+BAA+B,EAC/BC,oBAAoB,QAEf,4BAA4B;AAEnC,SAASC,YAAY,EAAEC,sBAAsB,EAAEC,oBAAoB,QAAQ,WAAW;AACtF,SAASC,4BAA4B,EAAEC,mCAAmC,QAAQ,yBAAyB;AAC3G,SAASC,2BAA2B,QAAQ,kBAAkB;AAG9D,SAASC,2BAA2BC,cAAwD;IAC1F,IAAI;QACF,MAAMC,OAAOD,eAAeE,MAAM,CAACD,IAAI;QAEvC,iEAAi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KG,WAAW;YAC1C,MAAMoB,kBAAkBjD,KAAK4B,UAAU,IAAIpC;YAC3C,MAAM6B,qBACJ,OAAO4B,oBAAoB,WAAW;gBAAEC,MAAMxD;gBAAsByD,MAAMF;YAAgB,IAAIA;YAChGD,+BAA+B5B,gCAAgCC,oBAAoBK,IAAIJ,eAAe;QACxG;QAEA,MAAM8B,kBAAkB;eACnBR;eACAE;eACAC;eACAC;SACJ;QACD,MAAMK,qBAAqBjD,MAAMc,IAAI,CAAC,IAAIC,IAAIiC;QAE9C,OAAO;YACLvB,WAAWwB;QACb;IACF;IACAC,wBAAwB1D;IACxB2D,sBAAsB,IAAO,CAAA;YAAEb,WAAW;QAAG,CAAA;AAC/C,EAAE"}
|
package/lib/plugins/types.d.ts
CHANGED
|
@@ -23,4 +23,11 @@ export type PrometheusPromQLVariableOptions = PrometheusVariableOptionsBase & {
|
|
|
23
23
|
expr: string;
|
|
24
24
|
labelName: string;
|
|
25
25
|
};
|
|
26
|
+
export interface PrometheusPromQLAnnotationOptions {
|
|
27
|
+
datasource?: DatasourceSelectValue<PrometheusDatasourceSelector>;
|
|
28
|
+
expr: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
legend?: string;
|
|
31
|
+
tags?: string[];
|
|
32
|
+
}
|
|
26
33
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,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,E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BAA6B,GAAG;IAChF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,6BAA6B,GAAG;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,6BAA6B,GAAG;IAE5E,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,UAAU,CAAC,EAAE,qBAAqB,CAAC,4BAA4B,CAAC,CAAC;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB"}
|
package/lib/plugins/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/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 { QueryParamValues } from '@perses-dev/components';\nimport { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { DurationString, HTTPProxy } from '@perses-dev/spec';\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 queryParams?: QueryParamValues;\n}\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: DatasourceSelectValue<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,+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;AAOjC,OAAO,MAAMA,0BAA0C,KAAK"}
|
|
1
|
+
{"version":3,"sources":["../../../src/plugins/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 { QueryParamValues } from '@perses-dev/components';\nimport { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { DurationString, HTTPProxy } from '@perses-dev/spec';\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 queryParams?: QueryParamValues;\n}\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: DatasourceSelectValue<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\nexport interface PrometheusPromQLAnnotationOptions {\n datasource?: DatasourceSelectValue<PrometheusDatasourceSelector>;\n expr: string;\n title?: string;\n legend?: string;\n tags?: string[];\n}\n"],"names":["DEFAULT_SCRAPE_INTERVAL"],"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;AAOjC,OAAO,MAAMA,0BAA0C,KAAK"}
|