mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 08:39:01 +08:00
chore: metrics explorer fixes (#7362)
This commit is contained in:
parent
097e4ca948
commit
3d3dd98549
@ -12,12 +12,22 @@ export interface MetricsListFilterKeysResponse {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetMetricsListFilterKeysParams {
|
||||||
|
searchText: string;
|
||||||
|
limit?: number;
|
||||||
|
}
|
||||||
|
|
||||||
export const getMetricsListFilterKeys = async (
|
export const getMetricsListFilterKeys = async (
|
||||||
|
params: GetMetricsListFilterKeysParams,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
headers?: Record<string, string>,
|
headers?: Record<string, string>,
|
||||||
): Promise<SuccessResponse<MetricsListFilterKeysResponse> | ErrorResponse> => {
|
): Promise<SuccessResponse<MetricsListFilterKeysResponse> | ErrorResponse> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get('/metrics/filters/keys', {
|
const response = await axios.get('/metrics/filters/keys', {
|
||||||
|
params: {
|
||||||
|
searchText: params.searchText,
|
||||||
|
limit: params.limit,
|
||||||
|
},
|
||||||
signal,
|
signal,
|
||||||
headers,
|
headers,
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import { Typography } from 'antd';
|
||||||
|
import { Empty } from 'antd/lib';
|
||||||
|
|
||||||
|
export default function EmptyMetricsSearch(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<div className="empty-metrics-search">
|
||||||
|
<Empty
|
||||||
|
description={
|
||||||
|
<Typography.Title level={5}>
|
||||||
|
Please build and run query to see the result
|
||||||
|
</Typography.Title>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -22,7 +22,11 @@
|
|||||||
|
|
||||||
.query-section {
|
.query-section {
|
||||||
max-height: 450px;
|
max-height: 450px;
|
||||||
overflow-y: scroll;
|
overflow-y: auto;
|
||||||
|
|
||||||
|
.rc-virtual-list-holder {
|
||||||
|
height: 150px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.explore-tabs {
|
.explore-tabs {
|
||||||
@ -51,18 +55,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.explore-content {
|
.explore-content {
|
||||||
|
.ant-space {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-metrics-search {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.time-series-container {
|
.time-series-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
.time-series-view {
|
.time-series-view {
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.related-metrics-container {
|
.related-metrics-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -23,7 +23,6 @@ import { generateExportToDashboardLink } from 'utils/dashboard/generateExportToD
|
|||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
|
||||||
import QuerySection from './QuerySection';
|
import QuerySection from './QuerySection';
|
||||||
import RelatedMetrics from './RelatedMetrics';
|
|
||||||
import TimeSeries from './TimeSeries';
|
import TimeSeries from './TimeSeries';
|
||||||
import { ExplorerTabs } from './types';
|
import { ExplorerTabs } from './types';
|
||||||
|
|
||||||
@ -51,15 +50,6 @@ function Explorer(): JSX.Element {
|
|||||||
const handleToggleShowOneChartPerQuery = (): void =>
|
const handleToggleShowOneChartPerQuery = (): void =>
|
||||||
toggleShowOneChartPerQuery(!showOneChartPerQuery);
|
toggleShowOneChartPerQuery(!showOneChartPerQuery);
|
||||||
|
|
||||||
const metricNames = useMemo(() => {
|
|
||||||
if (!stagedQuery || stagedQuery.builder.queryData.length === 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return stagedQuery.builder.queryData.map(
|
|
||||||
(query) => query.aggregateAttribute.key,
|
|
||||||
);
|
|
||||||
}, [stagedQuery]);
|
|
||||||
|
|
||||||
const exportDefaultQuery = useMemo(
|
const exportDefaultQuery = useMemo(
|
||||||
() =>
|
() =>
|
||||||
updateAllQueriesOperators(
|
updateAllQueriesOperators(
|
||||||
@ -159,7 +149,8 @@ function Explorer(): JSX.Element {
|
|||||||
>
|
>
|
||||||
<Typography.Text>Time series</Typography.Text>
|
<Typography.Text>Time series</Typography.Text>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
{/* TODO: Enable once we have resolved all related metrics issues */}
|
||||||
|
{/* <Button
|
||||||
value={ExplorerTabs.RELATED_METRICS}
|
value={ExplorerTabs.RELATED_METRICS}
|
||||||
className={classNames('tab', {
|
className={classNames('tab', {
|
||||||
'selected-view': selectedTab === ExplorerTabs.RELATED_METRICS,
|
'selected-view': selectedTab === ExplorerTabs.RELATED_METRICS,
|
||||||
@ -167,15 +158,16 @@ function Explorer(): JSX.Element {
|
|||||||
onClick={(): void => setSelectedTab(ExplorerTabs.RELATED_METRICS)}
|
onClick={(): void => setSelectedTab(ExplorerTabs.RELATED_METRICS)}
|
||||||
>
|
>
|
||||||
<Typography.Text>Related</Typography.Text>
|
<Typography.Text>Related</Typography.Text>
|
||||||
</Button>
|
</Button> */}
|
||||||
</Button.Group>
|
</Button.Group>
|
||||||
<div className="explore-content">
|
<div className="explore-content">
|
||||||
{selectedTab === ExplorerTabs.TIME_SERIES && (
|
{selectedTab === ExplorerTabs.TIME_SERIES && (
|
||||||
<TimeSeries showOneChartPerQuery={showOneChartPerQuery} />
|
<TimeSeries showOneChartPerQuery={showOneChartPerQuery} />
|
||||||
)}
|
)}
|
||||||
{selectedTab === ExplorerTabs.RELATED_METRICS && (
|
{/* TODO: Enable once we have resolved all related metrics issues */}
|
||||||
|
{/* {selectedTab === ExplorerTabs.RELATED_METRICS && (
|
||||||
<RelatedMetrics metricNames={metricNames} />
|
<RelatedMetrics metricNames={metricNames} />
|
||||||
)}
|
)} */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ExplorerOptionWrapper
|
<ExplorerOptionWrapper
|
||||||
|
@ -2,11 +2,12 @@ import classNames from 'classnames';
|
|||||||
import { ENTITY_VERSION_V4 } from 'constants/app';
|
import { ENTITY_VERSION_V4 } from 'constants/app';
|
||||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||||
|
import { BuilderUnitsFilter } from 'container/QueryBuilder/filters/BuilderUnitsFilter/BuilderUnits';
|
||||||
import TimeSeriesView from 'container/TimeSeriesView/TimeSeriesView';
|
import TimeSeriesView from 'container/TimeSeriesView/TimeSeriesView';
|
||||||
import { convertDataValueToMs } from 'container/TimeSeriesView/utils';
|
import { convertDataValueToMs } from 'container/TimeSeriesView/utils';
|
||||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||||
import { useMemo } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { useQueries } from 'react-query';
|
import { useQueries } from 'react-query';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
@ -55,6 +56,8 @@ function TimeSeries({ showOneChartPerQuery }: TimeSeriesProps): JSX.Element {
|
|||||||
[showOneChartPerQuery, stagedQuery],
|
[showOneChartPerQuery, stagedQuery],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [yAxisUnit, setYAxisUnit] = useState<string>('');
|
||||||
|
|
||||||
const queries = useQueries(
|
const queries = useQueries(
|
||||||
queryPayloads.map((payload, index) => ({
|
queryPayloads.map((payload, index) => ({
|
||||||
queryKey: [
|
queryKey: [
|
||||||
@ -98,12 +101,17 @@ function TimeSeries({ showOneChartPerQuery }: TimeSeriesProps): JSX.Element {
|
|||||||
[showOneChartPerQuery, queries],
|
[showOneChartPerQuery, queries],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onUnitChangeHandler = (value: string): void => {
|
||||||
|
setYAxisUnit(value);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames({
|
className={classNames({
|
||||||
'time-series-container': changeLayoutForOneChartPerQuery,
|
'time-series-container': changeLayoutForOneChartPerQuery,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
<BuilderUnitsFilter onChange={onUnitChangeHandler} yAxisUnit={yAxisUnit} />
|
||||||
{responseData.map((datapoint, index) => (
|
{responseData.map((datapoint, index) => (
|
||||||
<div
|
<div
|
||||||
className="time-series-view"
|
className="time-series-view"
|
||||||
@ -115,7 +123,7 @@ function TimeSeries({ showOneChartPerQuery }: TimeSeriesProps): JSX.Element {
|
|||||||
isError={queries[index].isError}
|
isError={queries[index].isError}
|
||||||
isLoading={queries[index].isLoading}
|
isLoading={queries[index].isLoading}
|
||||||
data={datapoint}
|
data={datapoint}
|
||||||
yAxisUnit={isValidToConvertToMs ? 'ms' : 'short'}
|
yAxisUnit={yAxisUnit}
|
||||||
dataSource={DataSource.METRICS}
|
dataSource={DataSource.METRICS}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,36 +1,30 @@
|
|||||||
import { Button, Collapse, Input, Typography } from 'antd';
|
import { Button, Collapse, Input, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/es/table';
|
import { ColumnsType } from 'antd/es/table';
|
||||||
import { ResizeTable } from 'components/ResizeTable';
|
import { ResizeTable } from 'components/ResizeTable';
|
||||||
import ROUTES from 'constants/routes';
|
|
||||||
import { DataType } from 'container/LogDetailedView/TableView';
|
import { DataType } from 'container/LogDetailedView/TableView';
|
||||||
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
|
||||||
import { Search } from 'lucide-react';
|
import { Search } from 'lucide-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { AllAttributesProps } from './types';
|
import { AllAttributesProps } from './types';
|
||||||
import { getMetricDetailsQuery } from './utils';
|
|
||||||
|
|
||||||
function AllAttributes({
|
function AllAttributes({ attributes }: AllAttributesProps): JSX.Element {
|
||||||
attributes,
|
|
||||||
metricName,
|
|
||||||
}: AllAttributesProps): JSX.Element {
|
|
||||||
const [searchString, setSearchString] = useState('');
|
const [searchString, setSearchString] = useState('');
|
||||||
const [activeKey, setActiveKey] = useState<string | string[]>(
|
const [activeKey, setActiveKey] = useState<string | string[]>(
|
||||||
'all-attributes',
|
'all-attributes',
|
||||||
);
|
);
|
||||||
|
|
||||||
const { safeNavigate } = useSafeNavigate();
|
// const { safeNavigate } = useSafeNavigate();
|
||||||
|
|
||||||
const goToMetricsExploreWithAppliedAttribute = useCallback(
|
// const goToMetricsExploreWithAppliedAttribute = useCallback(
|
||||||
(key: string, value: string) => {
|
// (key: string, value: string) => {
|
||||||
const compositeQuery = getMetricDetailsQuery(metricName, { key, value });
|
// const compositeQuery = getMetricDetailsQuery(metricName, { key, value });
|
||||||
const encodedCompositeQuery = JSON.stringify(compositeQuery);
|
// const encodedCompositeQuery = JSON.stringify(compositeQuery);
|
||||||
safeNavigate(
|
// safeNavigate(
|
||||||
`${ROUTES.METRICS_EXPLORER_EXPLORER}?compositeQuery=${encodedCompositeQuery}`,
|
// `${ROUTES.METRICS_EXPLORER_EXPLORER}?compositeQuery=${encodedCompositeQuery}`,
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
[metricName, safeNavigate],
|
// [metricName, safeNavigate],
|
||||||
);
|
// );
|
||||||
|
|
||||||
const filteredAttributes = useMemo(
|
const filteredAttributes = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@ -87,9 +81,10 @@ function AllAttributes({
|
|||||||
<Button
|
<Button
|
||||||
key={attribute}
|
key={attribute}
|
||||||
type="text"
|
type="text"
|
||||||
onClick={(): void => {
|
// TODO: Enable this once we have fixed the redirect issue
|
||||||
goToMetricsExploreWithAppliedAttribute(field.key, attribute);
|
// onClick={(): void => {
|
||||||
}}
|
// goToMetricsExploreWithAppliedAttribute(field.key, attribute);
|
||||||
|
// }}
|
||||||
>
|
>
|
||||||
<Typography.Text>{attribute}</Typography.Text>
|
<Typography.Text>{attribute}</Typography.Text>
|
||||||
</Button>
|
</Button>
|
||||||
@ -98,7 +93,7 @@ function AllAttributes({
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[goToMetricsExploreWithAppliedAttribute],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
|
@ -2,21 +2,11 @@ import './MetricDetails.styles.scss';
|
|||||||
import '../Summary/Summary.styles.scss';
|
import '../Summary/Summary.styles.scss';
|
||||||
|
|
||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import {
|
import { Divider, Drawer, Empty, Skeleton, Tooltip, Typography } from 'antd';
|
||||||
Button,
|
|
||||||
Divider,
|
|
||||||
Drawer,
|
|
||||||
Empty,
|
|
||||||
Skeleton,
|
|
||||||
Tooltip,
|
|
||||||
Typography,
|
|
||||||
} from 'antd';
|
|
||||||
import ROUTES from 'constants/routes';
|
|
||||||
import { useGetMetricDetails } from 'hooks/metricsExplorer/useGetMetricDetails';
|
import { useGetMetricDetails } from 'hooks/metricsExplorer/useGetMetricDetails';
|
||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
import { X } from 'lucide-react';
|
||||||
import { Compass, X } from 'lucide-react';
|
import { useMemo } from 'react';
|
||||||
import { useCallback, useMemo } from 'react';
|
|
||||||
|
|
||||||
import { formatNumberIntoHumanReadableFormat } from '../Summary/utils';
|
import { formatNumberIntoHumanReadableFormat } from '../Summary/utils';
|
||||||
import AllAttributes from './AllAttributes';
|
import AllAttributes from './AllAttributes';
|
||||||
@ -26,7 +16,6 @@ import { MetricDetailsProps } from './types';
|
|||||||
import {
|
import {
|
||||||
formatNumberToCompactFormat,
|
formatNumberToCompactFormat,
|
||||||
formatTimestampToReadableDate,
|
formatTimestampToReadableDate,
|
||||||
getMetricDetailsQuery,
|
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
function MetricDetails({
|
function MetricDetails({
|
||||||
@ -35,7 +24,7 @@ function MetricDetails({
|
|||||||
metricName,
|
metricName,
|
||||||
}: MetricDetailsProps): JSX.Element {
|
}: MetricDetailsProps): JSX.Element {
|
||||||
const isDarkMode = useIsDarkMode();
|
const isDarkMode = useIsDarkMode();
|
||||||
const { safeNavigate } = useSafeNavigate();
|
// const { safeNavigate } = useSafeNavigate();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
@ -72,15 +61,15 @@ function MetricDetails({
|
|||||||
);
|
);
|
||||||
}, [metric]);
|
}, [metric]);
|
||||||
|
|
||||||
const goToMetricsExplorerwithSelectedMetric = useCallback(() => {
|
// const goToMetricsExplorerwithSelectedMetric = useCallback(() => {
|
||||||
if (metricName) {
|
// if (metricName) {
|
||||||
const compositeQuery = getMetricDetailsQuery(metricName);
|
// const compositeQuery = getMetricDetailsQuery(metricName);
|
||||||
const encodedCompositeQuery = JSON.stringify(compositeQuery);
|
// const encodedCompositeQuery = JSON.stringify(compositeQuery);
|
||||||
safeNavigate(
|
// safeNavigate(
|
||||||
`${ROUTES.METRICS_EXPLORER_EXPLORER}?compositeQuery=${encodedCompositeQuery}`,
|
// `${ROUTES.METRICS_EXPLORER_EXPLORER}?compositeQuery=${encodedCompositeQuery}`,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}, [metricName, safeNavigate]);
|
// }, [metricName, safeNavigate]);
|
||||||
|
|
||||||
const isMetricDetailsError = metricDetailsError || !metric;
|
const isMetricDetailsError = metricDetailsError || !metric;
|
||||||
|
|
||||||
@ -93,7 +82,8 @@ function MetricDetails({
|
|||||||
<Divider type="vertical" />
|
<Divider type="vertical" />
|
||||||
<Typography.Text>{metric?.name}</Typography.Text>
|
<Typography.Text>{metric?.name}</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
{/* TODO: Enable this once we have fixed the redirect issue */}
|
||||||
|
{/* <Button
|
||||||
onClick={goToMetricsExplorerwithSelectedMetric}
|
onClick={goToMetricsExplorerwithSelectedMetric}
|
||||||
icon={<Compass size={16} />}
|
icon={<Compass size={16} />}
|
||||||
disabled={!metricName}
|
disabled={!metricName}
|
||||||
@ -101,7 +91,7 @@ function MetricDetails({
|
|||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
Open in Explorer
|
Open in Explorer
|
||||||
</Button>
|
</Button> */}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
placement="right"
|
placement="right"
|
||||||
|
@ -16,6 +16,7 @@ import { metricsTableColumns } from './utils';
|
|||||||
|
|
||||||
function MetricsTable({
|
function MetricsTable({
|
||||||
isLoading,
|
isLoading,
|
||||||
|
isError,
|
||||||
data,
|
data,
|
||||||
pageSize,
|
pageSize,
|
||||||
currentPage,
|
currentPage,
|
||||||
@ -76,7 +77,9 @@ function MetricsTable({
|
|||||||
className="empty-state-svg"
|
className="empty-state-svg"
|
||||||
/>
|
/>
|
||||||
<Typography.Text className="no-metrics-message">
|
<Typography.Text className="no-metrics-message">
|
||||||
This query had no results. Edit your query and try again!
|
{isError
|
||||||
|
? 'Error fetching metrics. If the problem persists, please contact support.'
|
||||||
|
: 'This query had no results. Edit your query and try again!'}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
@ -22,6 +22,7 @@ function MetricsTreemap({
|
|||||||
viewType,
|
viewType,
|
||||||
data,
|
data,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
isError,
|
||||||
openMetricDetails,
|
openMetricDetails,
|
||||||
}: MetricsTreemapProps): JSX.Element {
|
}: MetricsTreemapProps): JSX.Element {
|
||||||
const { width: windowWidth } = useWindowSize();
|
const { width: windowWidth } = useWindowSize();
|
||||||
@ -60,7 +61,6 @@ function MetricsTreemap({
|
|||||||
if (
|
if (
|
||||||
!data ||
|
!data ||
|
||||||
!data.data ||
|
!data.data ||
|
||||||
data?.status === 'error' ||
|
|
||||||
(data?.status === 'success' && !data?.data?.[viewType])
|
(data?.status === 'success' && !data?.data?.[viewType])
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
@ -71,6 +71,15 @@ function MetricsTreemap({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data?.status === 'error' || isError) {
|
||||||
|
return (
|
||||||
|
<Empty
|
||||||
|
description="Error fetching metrics. If the problem persists, please contact support."
|
||||||
|
style={{ width: treemapWidth, height: TREEMAP_HEIGHT, paddingTop: 30 }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="metrics-treemap-container">
|
<div className="metrics-treemap-container">
|
||||||
<div className="metrics-treemap-title">
|
<div className="metrics-treemap-title">
|
||||||
|
@ -87,6 +87,7 @@ function Summary(): JSX.Element {
|
|||||||
data: metricsData,
|
data: metricsData,
|
||||||
isLoading: isMetricsLoading,
|
isLoading: isMetricsLoading,
|
||||||
isFetching: isMetricsFetching,
|
isFetching: isMetricsFetching,
|
||||||
|
isError: isMetricsError,
|
||||||
} = useGetMetricsList(metricsListQuery, {
|
} = useGetMetricsList(metricsListQuery, {
|
||||||
enabled: !!metricsListQuery,
|
enabled: !!metricsListQuery,
|
||||||
});
|
});
|
||||||
@ -95,6 +96,7 @@ function Summary(): JSX.Element {
|
|||||||
data: treeMapData,
|
data: treeMapData,
|
||||||
isLoading: isTreeMapLoading,
|
isLoading: isTreeMapLoading,
|
||||||
isFetching: isTreeMapFetching,
|
isFetching: isTreeMapFetching,
|
||||||
|
isError: isTreeMapError,
|
||||||
} = useGetMetricsTreeMap(metricsTreemapQuery, {
|
} = useGetMetricsTreeMap(metricsTreemapQuery, {
|
||||||
enabled: !!metricsTreemapQuery,
|
enabled: !!metricsTreemapQuery,
|
||||||
});
|
});
|
||||||
@ -160,11 +162,13 @@ function Summary(): JSX.Element {
|
|||||||
<MetricsTreemap
|
<MetricsTreemap
|
||||||
data={treeMapData?.payload}
|
data={treeMapData?.payload}
|
||||||
isLoading={isTreeMapLoading || isTreeMapFetching}
|
isLoading={isTreeMapLoading || isTreeMapFetching}
|
||||||
|
isError={isTreeMapError}
|
||||||
viewType={heatmapView}
|
viewType={heatmapView}
|
||||||
openMetricDetails={openMetricDetails}
|
openMetricDetails={openMetricDetails}
|
||||||
/>
|
/>
|
||||||
<MetricsTable
|
<MetricsTable
|
||||||
isLoading={isMetricsLoading || isMetricsFetching}
|
isLoading={isMetricsLoading || isMetricsFetching}
|
||||||
|
isError={isMetricsError}
|
||||||
data={formattedMetricsData}
|
data={formattedMetricsData}
|
||||||
pageSize={pageSize}
|
pageSize={pageSize}
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
|
|
||||||
export interface MetricsTableProps {
|
export interface MetricsTableProps {
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
|
isError: boolean;
|
||||||
data: MetricsListItemRowData[];
|
data: MetricsListItemRowData[];
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
@ -26,6 +27,7 @@ export interface MetricsSearchProps {
|
|||||||
export interface MetricsTreemapProps {
|
export interface MetricsTreemapProps {
|
||||||
data: MetricsTreeMapResponse | null | undefined;
|
data: MetricsTreeMapResponse | null | undefined;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
|
isError: boolean;
|
||||||
viewType: TreemapViewType;
|
viewType: TreemapViewType;
|
||||||
openMetricDetails: (metricName: string) => void;
|
openMetricDetails: (metricName: string) => void;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
Cloudy,
|
Cloudy,
|
||||||
DraftingCompass,
|
DraftingCompass,
|
||||||
FileKey2,
|
FileKey2,
|
||||||
|
HardDrive,
|
||||||
Home,
|
Home,
|
||||||
Layers2,
|
Layers2,
|
||||||
LayoutGrid,
|
LayoutGrid,
|
||||||
@ -88,7 +89,7 @@ const menuItems: SidebarItem[] = [
|
|||||||
{
|
{
|
||||||
key: ROUTES.APPLICATION,
|
key: ROUTES.APPLICATION,
|
||||||
label: 'Services',
|
label: 'Services',
|
||||||
icon: <BarChart2 size={16} />,
|
icon: <HardDrive size={16} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: ROUTES.TRACES_EXPLORER,
|
key: ROUTES.TRACES_EXPLORER,
|
||||||
|
@ -6,6 +6,7 @@ import { QueryParams } from 'constants/query';
|
|||||||
import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
|
import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
|
||||||
import LogsError from 'container/LogsError/LogsError';
|
import LogsError from 'container/LogsError/LogsError';
|
||||||
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
|
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
|
||||||
|
import EmptyMetricsSearch from 'container/MetricsExplorer/Explorer/EmptyMetricsSearch';
|
||||||
import { MetricsLoading } from 'container/MetricsExplorer/MetricsLoading/MetricsLoading';
|
import { MetricsLoading } from 'container/MetricsExplorer/MetricsLoading/MetricsLoading';
|
||||||
import NoLogs from 'container/NoLogs/NoLogs';
|
import NoLogs from 'container/NoLogs/NoLogs';
|
||||||
import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/config';
|
import { CustomTimeType } from 'container/TopNav/DateTimeSelectionV2/config';
|
||||||
@ -187,7 +188,15 @@ function TimeSeriesView({
|
|||||||
chartData[0]?.length === 0 &&
|
chartData[0]?.length === 0 &&
|
||||||
!isLoading &&
|
!isLoading &&
|
||||||
!isError &&
|
!isError &&
|
||||||
!isFilterApplied && <NoLogs dataSource={dataSource} />}
|
!isFilterApplied &&
|
||||||
|
dataSource !== DataSource.METRICS && <NoLogs dataSource={dataSource} />}
|
||||||
|
|
||||||
|
{chartData &&
|
||||||
|
chartData[0] &&
|
||||||
|
chartData[0]?.length === 0 &&
|
||||||
|
!isLoading &&
|
||||||
|
!isError &&
|
||||||
|
dataSource === DataSource.METRICS && <EmptyMetricsSearch />}
|
||||||
|
|
||||||
{!isLoading &&
|
{!isLoading &&
|
||||||
!isError &&
|
!isError &&
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
getMetricsListFilterKeys,
|
getMetricsListFilterKeys,
|
||||||
|
GetMetricsListFilterKeysParams,
|
||||||
MetricsListFilterKeysResponse,
|
MetricsListFilterKeysResponse,
|
||||||
} from 'api/metricsExplorer/getMetricsListFilterKeys';
|
} from 'api/metricsExplorer/getMetricsListFilterKeys';
|
||||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||||
@ -8,6 +9,7 @@ import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query';
|
|||||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||||
|
|
||||||
type UseGetMetricsListFilterKeys = (
|
type UseGetMetricsListFilterKeys = (
|
||||||
|
params: GetMetricsListFilterKeysParams,
|
||||||
options?: UseQueryOptions<
|
options?: UseQueryOptions<
|
||||||
SuccessResponse<MetricsListFilterKeysResponse> | ErrorResponse,
|
SuccessResponse<MetricsListFilterKeysResponse> | ErrorResponse,
|
||||||
Error
|
Error
|
||||||
@ -19,6 +21,7 @@ type UseGetMetricsListFilterKeys = (
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
export const useGetMetricsListFilterKeys: UseGetMetricsListFilterKeys = (
|
export const useGetMetricsListFilterKeys: UseGetMetricsListFilterKeys = (
|
||||||
|
params,
|
||||||
options,
|
options,
|
||||||
headers,
|
headers,
|
||||||
) => {
|
) => {
|
||||||
@ -38,7 +41,7 @@ export const useGetMetricsListFilterKeys: UseGetMetricsListFilterKeys = (
|
|||||||
SuccessResponse<MetricsListFilterKeysResponse> | ErrorResponse,
|
SuccessResponse<MetricsListFilterKeysResponse> | ErrorResponse,
|
||||||
Error
|
Error
|
||||||
>({
|
>({
|
||||||
queryFn: ({ signal }) => getMetricsListFilterKeys(signal, headers),
|
queryFn: ({ signal }) => getMetricsListFilterKeys(params, signal, headers),
|
||||||
...options,
|
...options,
|
||||||
queryKey,
|
queryKey,
|
||||||
});
|
});
|
||||||
|
@ -129,7 +129,7 @@ export const useFetchKeysAndValues = (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
queryKey: [searchParams],
|
queryKey: [searchParams],
|
||||||
enabled: isQueryEnabled && !shouldUseSuggestions,
|
enabled: isMetricsExplorer ? false : isQueryEnabled && !shouldUseSuggestions,
|
||||||
},
|
},
|
||||||
isInfraMonitoring, // isInfraMonitoring
|
isInfraMonitoring, // isInfraMonitoring
|
||||||
entity, // infraMonitoringEntity
|
entity, // infraMonitoringEntity
|
||||||
@ -155,9 +155,15 @@ export const useFetchKeysAndValues = (
|
|||||||
data: metricsListFilterKeysData,
|
data: metricsListFilterKeysData,
|
||||||
isFetching: isFetchingMetricsListFilterKeys,
|
isFetching: isFetchingMetricsListFilterKeys,
|
||||||
status: fetchingMetricsListFilterKeysStatus,
|
status: fetchingMetricsListFilterKeysStatus,
|
||||||
} = useGetMetricsListFilterKeys({
|
} = useGetMetricsListFilterKeys(
|
||||||
|
{
|
||||||
|
searchText: searchKey,
|
||||||
|
},
|
||||||
|
{
|
||||||
enabled: isMetricsExplorer && isQueryEnabled && !shouldUseSuggestions,
|
enabled: isMetricsExplorer && isQueryEnabled && !shouldUseSuggestions,
|
||||||
});
|
queryKey: [searchKey],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
function isAttributeValuesResponse(
|
function isAttributeValuesResponse(
|
||||||
payload: any,
|
payload: any,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user