mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-19 16:36:45 +00:00
* feat: added the host list view and filters (#6210) * feat: added the host list view and filters * feat: removed group by filter and added autocomplete for where clause * feat: updated the table view and added the pagination * feat: pass updated filters to api to get filtered data in the list * feat: added global time range and order by for cpu,memory,iowait,load * feat: added order by and color codes for cpu and memory usage progress bar * refactor: removed inline styles * Host lists improvement (#6366) * style: added new style changes for date time selection in host lists view * style: added padding to date time selector * style: removed unnecessary styles for host tabs * style: removed unused css * feat: added the host detail view (#6267) * Host containers (#6297) * feat: added the host detail view * feat: completed containers and processes details view * Show host metrics panels in metrics tab. (#6306) * feat: added the host detail view * feat: completed containers and processes details view * feat: added host metrics panels in metrics tabs * refactor: removed inline styles from host containers and processes tabs * style: added top and bottom margin to containers and processes tab * Metrics time selection (#6360) * feat: added the host detail view * feat: completed containers and processes details view * feat: added host metrics panels in metrics tabs * refactor: removed inline styles from host containers and processes tabs * feat: added logs and traces tab in host metrics detail view * chore: removed console statements * feat: added DateTimeSelection component in metrics tab * style: added top and bottom margin to containers and processes tab * style: removed inline styles * feat: added logs and traces tab in host metrics detail view (#6359) * feat: added the host detail view * feat: completed containers and processes details view * feat: added host metrics panels in metrics tabs * refactor: removed inline styles from host containers and processes tabs * feat: added logs and traces tab in host metrics detail view * chore: removed console statements * feat: added filters and time selection in traces tab * fix: resolved metrics,logs and traces tab issues * feat: added navigation for logs and traces to respective explorer pages * fix: added the code for logs tab and navigation to respective explorer page * fix: added fixes for date time selection custom issue * style: added styles for light mode * refactor: removed unused code and added comments * refactor: added new code for host metric attribute keys * feat: reset query data once we are on infra monitoring page * chore: remove optional parameter from get attributes and groupby interfaces * feat: update ui as per the designs * fix: logs list, time select and other ui issues * feat: update title for infra monitoring page * feat: update copies * feat: update styles for light mode * fix: reset page size on filter, open explorers in new tab, enable horizontal scroll * feat: traces tab updates * feat: move infra monitoring behind ff * fix: remove sorting from host listing page --------- Co-authored-by: Yunus M <myounis.ar@live.com> * chore: fix lint errors --------- Co-authored-by: rahulkeswani101 <rahul@signoz.io>
106 lines
3.2 KiB
TypeScript
106 lines
3.2 KiB
TypeScript
/* eslint-disable */
|
|
// @ts-ignore
|
|
// @ts-nocheck
|
|
|
|
import { getMetricsQueryRange } from 'api/metrics/getQueryRange';
|
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
|
import { timePreferenceType } from 'container/NewWidget/RightContainer/timeItems';
|
|
import { Time } from 'container/TopNav/DateTimeSelection/config';
|
|
import {
|
|
CustomTimeType,
|
|
Time as TimeV2,
|
|
} from 'container/TopNav/DateTimeSelectionV2/config';
|
|
import { Pagination } from 'hooks/queryPagination';
|
|
import { convertNewDataToOld } from 'lib/newQueryBuilder/convertNewDataToOld';
|
|
import { isEmpty } from 'lodash-es';
|
|
import { SuccessResponse } from 'types/api';
|
|
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
|
|
|
import { prepareQueryRangePayload } from './prepareQueryRangePayload';
|
|
|
|
export async function GetMetricQueryRange(
|
|
props: GetQueryResultsProps,
|
|
version: string,
|
|
signal?: AbortSignal,
|
|
headers?: Record<string, string>,
|
|
isInfraMonitoring?: boolean,
|
|
): Promise<SuccessResponse<MetricRangePayloadProps>> {
|
|
const { legendMap, queryPayload } = prepareQueryRangePayload(props);
|
|
const response = await getMetricsQueryRange(
|
|
queryPayload,
|
|
version || 'v3',
|
|
signal,
|
|
headers,
|
|
);
|
|
|
|
if (response.statusCode >= 400) {
|
|
let error = `API responded with ${response.statusCode} - ${response.error} status: ${response.message}`;
|
|
if (response.body && !isEmpty(response.body)) {
|
|
error = `${error}, errors: ${response.body}`;
|
|
}
|
|
throw new Error(error);
|
|
}
|
|
|
|
if (props.formatForWeb) {
|
|
return response;
|
|
}
|
|
|
|
if (response.payload?.data?.result) {
|
|
const v2Range = convertNewDataToOld(response.payload);
|
|
|
|
response.payload = v2Range;
|
|
|
|
response.payload.data.result = response.payload.data.result.map(
|
|
(queryData) => {
|
|
const newQueryData = queryData;
|
|
newQueryData.legend = legendMap[queryData.queryName]; // Adds the legend if it is already defined by the user.
|
|
// If metric names is an empty object
|
|
if (isEmpty(queryData.metric)) {
|
|
// If metrics list is empty && the user haven't defined a legend then add the legend equal to the name of the query.
|
|
if (!newQueryData.legend) {
|
|
newQueryData.legend = queryData.queryName;
|
|
}
|
|
// If name of the query and the legend if inserted is same then add the same to the metrics object.
|
|
if (queryData.queryName === newQueryData.legend) {
|
|
newQueryData.metric[queryData.queryName] = queryData.queryName;
|
|
}
|
|
}
|
|
|
|
return newQueryData;
|
|
},
|
|
);
|
|
}
|
|
|
|
if (response.payload?.data?.newResult?.data?.resultType === 'anomaly') {
|
|
response.payload.data.newResult.data.result = response.payload.data.newResult.data.result.map(
|
|
(queryData) => {
|
|
if (legendMap[queryData.queryName]) {
|
|
queryData.legend = legendMap[queryData.queryName];
|
|
}
|
|
|
|
return queryData;
|
|
},
|
|
);
|
|
}
|
|
|
|
return response;
|
|
}
|
|
|
|
export interface GetQueryResultsProps {
|
|
query: Query;
|
|
graphType: PANEL_TYPES;
|
|
selectedTime: timePreferenceType;
|
|
globalSelectedInterval?: Time | TimeV2 | CustomTimeType;
|
|
variables?: Record<string, unknown>;
|
|
params?: Record<string, unknown>;
|
|
fillGaps?: boolean;
|
|
formatForWeb?: boolean;
|
|
tableParams?: {
|
|
pagination?: Pagination;
|
|
selectColumns?: any;
|
|
};
|
|
start?: number;
|
|
end?: number;
|
|
}
|