mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 21:24:05 -08:00
Merge pull request #13382 from prometheus/cut-2.49-rc2
Cut 2.49.0-rc.2 + cherry pick of UI fix #13371
This commit is contained in:
commit
0a88bcbae8
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
|
||||
## 2.49.0-rc.2 / 2024-01-08
|
||||
|
||||
* [BUGFIX] UI: Fix scalar and string data type issues when querying introduced by heatmap feature. #13371
|
||||
|
||||
## 2.49.0-rc.1 / 2023-12-19
|
||||
|
||||
* [BUGFIX] SD: Fix Azure VM Scale Set NIC issue. #13283
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@prometheus-io/codemirror-promql",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"description": "a CodeMirror mode for the PromQL language",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"module": "dist/esm/index.js",
|
||||
|
@ -29,7 +29,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/prometheus/prometheus/blob/main/web/ui/module/codemirror-promql/README.md",
|
||||
"dependencies": {
|
||||
"@prometheus-io/lezer-promql": "0.49.0-rc.1",
|
||||
"@prometheus-io/lezer-promql": "0.49.0-rc.2",
|
||||
"lru-cache": "^7.18.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@prometheus-io/lezer-promql",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"description": "lezer-based PromQL grammar",
|
||||
"main": "dist/index.cjs",
|
||||
"type": "module",
|
||||
|
|
18
web/ui/package-lock.json
generated
18
web/ui/package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "prometheus-io",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "prometheus-io",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"workspaces": [
|
||||
"react-app",
|
||||
"module/*"
|
||||
|
@ -30,10 +30,10 @@
|
|||
},
|
||||
"module/codemirror-promql": {
|
||||
"name": "@prometheus-io/codemirror-promql",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@prometheus-io/lezer-promql": "0.49.0-rc.1",
|
||||
"@prometheus-io/lezer-promql": "0.49.0-rc.2",
|
||||
"lru-cache": "^7.18.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -70,7 +70,7 @@
|
|||
},
|
||||
"module/lezer-promql": {
|
||||
"name": "@prometheus-io/lezer-promql",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@lezer/generator": "^1.5.1",
|
||||
|
@ -20844,7 +20844,7 @@
|
|||
},
|
||||
"react-app": {
|
||||
"name": "@prometheus-io/app",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.11.1",
|
||||
"@codemirror/commands": "^6.3.2",
|
||||
|
@ -20862,7 +20862,7 @@
|
|||
"@lezer/lr": "^1.3.14",
|
||||
"@nexucis/fuzzy": "^0.4.1",
|
||||
"@nexucis/kvsearch": "^0.8.1",
|
||||
"@prometheus-io/codemirror-promql": "0.49.0-rc.1",
|
||||
"@prometheus-io/codemirror-promql": "0.49.0-rc.2",
|
||||
"bootstrap": "^4.6.2",
|
||||
"css.escape": "^1.5.1",
|
||||
"downshift": "^7.6.2",
|
||||
|
@ -23551,7 +23551,7 @@
|
|||
"@lezer/lr": "^1.3.14",
|
||||
"@nexucis/fuzzy": "^0.4.1",
|
||||
"@nexucis/kvsearch": "^0.8.1",
|
||||
"@prometheus-io/codemirror-promql": "0.49.0-rc.1",
|
||||
"@prometheus-io/codemirror-promql": "0.49.0-rc.2",
|
||||
"@testing-library/react-hooks": "^7.0.2",
|
||||
"@types/enzyme": "^3.10.18",
|
||||
"@types/flot": "0.0.36",
|
||||
|
@ -23602,7 +23602,7 @@
|
|||
"@lezer/common": "^1.1.1",
|
||||
"@lezer/highlight": "^1.2.0",
|
||||
"@lezer/lr": "^1.3.14",
|
||||
"@prometheus-io/lezer-promql": "0.49.0-rc.1",
|
||||
"@prometheus-io/lezer-promql": "0.49.0-rc.2",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"lru-cache": "^7.18.3",
|
||||
"nock": "^13.4.0"
|
||||
|
|
|
@ -28,5 +28,5 @@
|
|||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"version": "0.49.0-rc.1"
|
||||
"version": "0.49.0-rc.2"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@prometheus-io/app",
|
||||
"version": "0.49.0-rc.1",
|
||||
"version": "0.49.0-rc.2",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.11.1",
|
||||
|
@ -19,7 +19,7 @@
|
|||
"@lezer/lr": "^1.3.14",
|
||||
"@nexucis/fuzzy": "^0.4.1",
|
||||
"@nexucis/kvsearch": "^0.8.1",
|
||||
"@prometheus-io/codemirror-promql": "0.49.0-rc.1",
|
||||
"@prometheus-io/codemirror-promql": "0.49.0-rc.2",
|
||||
"bootstrap": "^4.6.2",
|
||||
"css.escape": "^1.5.1",
|
||||
"downshift": "^7.6.2",
|
||||
|
|
|
@ -338,7 +338,7 @@ describe('DataTable', () => {
|
|||
const dataTableProps: DataTableProps = {
|
||||
data: {
|
||||
resultType: 'string',
|
||||
result: 'string',
|
||||
result: [1572098246.599, 'test'],
|
||||
},
|
||||
useLocalTime: false,
|
||||
};
|
||||
|
@ -346,7 +346,7 @@ describe('DataTable', () => {
|
|||
it('renders a string row', () => {
|
||||
const table = dataTable.find(Table);
|
||||
const rows = table.find('tr');
|
||||
expect(rows.text()).toEqual('stringt');
|
||||
expect(rows.text()).toEqual('stringtest');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ export interface DataTableProps {
|
|||
}
|
||||
| {
|
||||
resultType: 'string';
|
||||
result: string;
|
||||
result: SampleValue;
|
||||
};
|
||||
useLocalTime: boolean;
|
||||
}
|
||||
|
|
66
web/ui/react-app/src/pages/graph/GraphHeatmapHelpers.test.ts
Normal file
66
web/ui/react-app/src/pages/graph/GraphHeatmapHelpers.test.ts
Normal file
|
@ -0,0 +1,66 @@
|
|||
import { DataTableProps } from './DataTable';
|
||||
import { isHeatmapData } from './GraphHeatmapHelpers';
|
||||
|
||||
describe('GraphHeatmapHelpers', () => {
|
||||
it('isHeatmapData should return false for scalar and string resultType', () => {
|
||||
let data = {
|
||||
resultType: 'scalar',
|
||||
result: [1703091180.125, '1703091180.125'],
|
||||
} as DataTableProps['data'];
|
||||
expect(isHeatmapData(data)).toBe(false);
|
||||
|
||||
data = {
|
||||
resultType: 'string',
|
||||
result: [1704305680.332, '2504'],
|
||||
} as DataTableProps['data'];
|
||||
expect(isHeatmapData(data)).toBe(false);
|
||||
});
|
||||
|
||||
it('isHeatmapData should return false for a vector and matrix if length < 2', () => {
|
||||
let data = {
|
||||
resultType: 'vector',
|
||||
result: [
|
||||
{
|
||||
metric: {
|
||||
__name__: 'my_gauge',
|
||||
job: 'target',
|
||||
},
|
||||
value: [1703091180.683, '6'],
|
||||
},
|
||||
],
|
||||
} as DataTableProps['data'];
|
||||
expect(isHeatmapData(data)).toBe(false);
|
||||
|
||||
data = {
|
||||
resultType: 'matrix',
|
||||
result: [
|
||||
{
|
||||
metric: {},
|
||||
values: [[1703091180.683, '6']],
|
||||
},
|
||||
],
|
||||
} as DataTableProps['data'];
|
||||
expect(isHeatmapData(data)).toBe(false);
|
||||
});
|
||||
|
||||
it('isHeatmapData should return true for valid heatmap data', () => {
|
||||
const data = {
|
||||
resultType: 'matrix',
|
||||
result: [
|
||||
{
|
||||
metric: {
|
||||
le: '100',
|
||||
},
|
||||
values: [[1703091180.683, '6']],
|
||||
},
|
||||
{
|
||||
metric: {
|
||||
le: '1000',
|
||||
},
|
||||
values: [[1703091190.683, '6.1']],
|
||||
},
|
||||
],
|
||||
} as DataTableProps['data'];
|
||||
expect(isHeatmapData(data)).toBe(true);
|
||||
});
|
||||
});
|
|
@ -1,10 +1,12 @@
|
|||
import { DataTableProps } from './DataTable';
|
||||
import { GraphProps, GraphSeries } from './Graph';
|
||||
|
||||
export function isHeatmapData(data: GraphProps['data']) {
|
||||
if (!data?.result?.length || data?.result?.length < 2) {
|
||||
export function isHeatmapData(data: DataTableProps['data']) {
|
||||
if (data?.resultType === 'scalar' || data?.resultType === 'string' || !data?.result?.length || data?.result?.length < 2) {
|
||||
return false;
|
||||
}
|
||||
const result = data.result;
|
||||
// Type assertion to prevent TS2349 error.
|
||||
const result = data.result as GraphProps['data']['result'];
|
||||
const firstLabels = Object.keys(result[0].metric).filter((label) => label !== 'le');
|
||||
return result.every(({ metric }) => {
|
||||
const labels = Object.keys(metric).filter((label) => label !== 'le');
|
||||
|
|
Loading…
Reference in a new issue