Skip to content

Commit f01d21c

Browse files
authored
feat: implement inspect feature for metrics explorer (#7549)
1 parent 3688613 commit f01d21c

30 files changed

+4072
-18
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import axios from 'api';
2+
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
3+
import { AxiosError } from 'axios';
4+
import { ErrorResponse, SuccessResponse } from 'types/api';
5+
import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';
6+
7+
export interface InspectMetricsRequest {
8+
metricName: string;
9+
start: number;
10+
end: number;
11+
filters: TagFilter;
12+
}
13+
14+
export interface InspectMetricsResponse {
15+
status: string;
16+
data: {
17+
series: InspectMetricsSeries[];
18+
};
19+
}
20+
21+
export interface InspectMetricsSeries {
22+
title?: string;
23+
strokeColor?: string;
24+
labels: Record<string, string>;
25+
labelsArray: Array<Record<string, string>>;
26+
values: InspectMetricsTimestampValue[];
27+
}
28+
29+
interface InspectMetricsTimestampValue {
30+
timestamp: number;
31+
value: string;
32+
}
33+
34+
export const getInspectMetricsDetails = async (
35+
request: InspectMetricsRequest,
36+
signal?: AbortSignal,
37+
headers?: Record<string, string>,
38+
): Promise<SuccessResponse<InspectMetricsResponse> | ErrorResponse> => {
39+
try {
40+
const response = await axios.post(`/metrics/inspect`, request, {
41+
signal,
42+
headers,
43+
});
44+
45+
return {
46+
statusCode: 200,
47+
error: null,
48+
message: 'Success',
49+
payload: response.data,
50+
};
51+
} catch (error) {
52+
return ErrorResponseHandler(error as AxiosError);
53+
}
54+
};

frontend/src/components/ResizeTable/styles.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import React from 'react';
12
import styled from 'styled-components';
23

3-
export const SpanStyle = styled.span`
4+
type SpanProps = React.HTMLAttributes<HTMLSpanElement>;
5+
6+
export const SpanStyle = styled.span<SpanProps>`
47
position: absolute;
58
right: -0.313rem;
69
bottom: 0;
@@ -12,7 +15,7 @@ export const SpanStyle = styled.span`
1215
margin-right: 4px;
1316
`;
1417

15-
export const DragSpanStyle = styled.span`
18+
export const DragSpanStyle = styled.span<SpanProps>`
1619
display: flex;
1720
margin: -1rem;
1821
padding: 1rem;

frontend/src/constants/reactQueryKeys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const REACT_QUERY_KEY = {
5151
GET_METRICS_LIST_FILTER_VALUES: 'GET_METRICS_LIST_FILTER_VALUES',
5252
GET_METRIC_DETAILS: 'GET_METRIC_DETAILS',
5353
GET_RELATED_METRICS: 'GET_RELATED_METRICS',
54+
GET_INSPECT_METRICS_DETAILS: 'GET_INSPECT_METRICS_DETAILS',
5455

5556
// API Monitoring Query Keys
5657
GET_DOMAINS_LIST: 'GET_DOMAINS_LIST',

0 commit comments

Comments
 (0)