mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 06:22:02 +08:00
fix: resource attribute is fixed trace data source (#3319)
This commit is contained in:
parent
557ebcec79
commit
87c244ccfa
@ -189,7 +189,6 @@ function Application(): JSX.Element {
|
|||||||
handleGraphClick={handleGraphClick}
|
handleGraphClick={handleGraphClick}
|
||||||
selectedTimeStamp={selectedTimeStamp}
|
selectedTimeStamp={selectedTimeStamp}
|
||||||
selectedTraceTags={selectedTraceTags}
|
selectedTraceTags={selectedTraceTags}
|
||||||
tagFilterItems={tagFilterItems}
|
|
||||||
topLevelOperationsRoute={topLevelOperationsRoute}
|
topLevelOperationsRoute={topLevelOperationsRoute}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -6,23 +6,23 @@ import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsAppli
|
|||||||
import { latency } from 'container/MetricsApplication/MetricsPageQueries/OverviewQueries';
|
import { latency } from 'container/MetricsApplication/MetricsPageQueries/OverviewQueries';
|
||||||
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
||||||
import useFeatureFlag from 'hooks/useFeatureFlag';
|
import useFeatureFlag from 'hooks/useFeatureFlag';
|
||||||
|
import useResourceAttribute from 'hooks/useResourceAttribute';
|
||||||
|
import { resourceAttributesToTagFilterItems } from 'hooks/useResourceAttribute/utils';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
|
||||||
import { EQueryType } from 'types/common/dashboard';
|
import { EQueryType } from 'types/common/dashboard';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
|
||||||
import { ClickHandlerType } from '../Overview';
|
import { ClickHandlerType } from '../Overview';
|
||||||
import { Button } from '../styles';
|
import { Button } from '../styles';
|
||||||
import { IServiceName } from '../types';
|
import { IServiceName } from '../types';
|
||||||
import { onViewTracePopupClick } from '../util';
|
import { handleNonInQueryRange, onViewTracePopupClick } from '../util';
|
||||||
|
|
||||||
function ServiceOverview({
|
function ServiceOverview({
|
||||||
onDragSelect,
|
onDragSelect,
|
||||||
handleGraphClick,
|
handleGraphClick,
|
||||||
selectedTraceTags,
|
selectedTraceTags,
|
||||||
selectedTimeStamp,
|
selectedTimeStamp,
|
||||||
tagFilterItems,
|
|
||||||
topLevelOperationsRoute,
|
topLevelOperationsRoute,
|
||||||
}: ServiceOverviewProps): JSX.Element {
|
}: ServiceOverviewProps): JSX.Element {
|
||||||
const { servicename } = useParams<IServiceName>();
|
const { servicename } = useParams<IServiceName>();
|
||||||
@ -30,6 +30,16 @@ function ServiceOverview({
|
|||||||
const isSpanMetricEnable = useFeatureFlag(FeatureKeys.USE_SPAN_METRICS)
|
const isSpanMetricEnable = useFeatureFlag(FeatureKeys.USE_SPAN_METRICS)
|
||||||
?.active;
|
?.active;
|
||||||
|
|
||||||
|
const { queries } = useResourceAttribute();
|
||||||
|
|
||||||
|
const tagFilterItems = useMemo(
|
||||||
|
() =>
|
||||||
|
handleNonInQueryRange(
|
||||||
|
resourceAttributesToTagFilterItems(queries, !isSpanMetricEnable),
|
||||||
|
) || [],
|
||||||
|
[isSpanMetricEnable, queries],
|
||||||
|
);
|
||||||
|
|
||||||
const latencyWidget = useMemo(
|
const latencyWidget = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getWidgetQueryBuilder({
|
getWidgetQueryBuilder({
|
||||||
@ -48,7 +58,7 @@ function ServiceOverview({
|
|||||||
title: GraphTitle.LATENCY,
|
title: GraphTitle.LATENCY,
|
||||||
panelTypes: PANEL_TYPES.TIME_SERIES,
|
panelTypes: PANEL_TYPES.TIME_SERIES,
|
||||||
}),
|
}),
|
||||||
[servicename, tagFilterItems, isSpanMetricEnable, topLevelOperationsRoute],
|
[servicename, isSpanMetricEnable, topLevelOperationsRoute, tagFilterItems],
|
||||||
);
|
);
|
||||||
|
|
||||||
const isQueryEnabled = topLevelOperationsRoute.length > 0;
|
const isQueryEnabled = topLevelOperationsRoute.length > 0;
|
||||||
@ -88,7 +98,6 @@ interface ServiceOverviewProps {
|
|||||||
selectedTraceTags: string;
|
selectedTraceTags: string;
|
||||||
onDragSelect: (start: number, end: number) => void;
|
onDragSelect: (start: number, end: number) => void;
|
||||||
handleGraphClick: (type: string) => ClickHandlerType;
|
handleGraphClick: (type: string) => ClickHandlerType;
|
||||||
tagFilterItems: TagFilterItem[];
|
|
||||||
topLevelOperationsRoute: string[];
|
topLevelOperationsRoute: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
} from 'api/metrics/getResourceAttributes';
|
} from 'api/metrics/getResourceAttributes';
|
||||||
import { OperatorConversions } from 'constants/resourceAttributes';
|
import { OperatorConversions } from 'constants/resourceAttributes';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
|
import { DataType, MetricsType } from 'container/MetricsApplication/constant';
|
||||||
import {
|
import {
|
||||||
IOption,
|
IOption,
|
||||||
IResourceAttribute,
|
IResourceAttribute,
|
||||||
@ -63,13 +64,29 @@ export const convertRawQueriesToTraceSelectedTags = (
|
|||||||
/* Convert resource attributes to tagFilter items for queryBuilder */
|
/* Convert resource attributes to tagFilter items for queryBuilder */
|
||||||
export const resourceAttributesToTagFilterItems = (
|
export const resourceAttributesToTagFilterItems = (
|
||||||
queries: IResourceAttribute[],
|
queries: IResourceAttribute[],
|
||||||
): TagFilterItem[] =>
|
isTraceDataSource = false,
|
||||||
queries.map((res) => ({
|
): TagFilterItem[] => {
|
||||||
|
if (isTraceDataSource) {
|
||||||
|
return convertRawQueriesToTraceSelectedTags(queries).map((e) => ({
|
||||||
|
id: e.Key,
|
||||||
|
op: e.Operator,
|
||||||
|
value: e.StringValues,
|
||||||
|
key: {
|
||||||
|
dataType: DataType.STRING,
|
||||||
|
type: MetricsType.Resource,
|
||||||
|
isColumn: false,
|
||||||
|
key: e.Key,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return queries.map((res) => ({
|
||||||
id: `${res.id}`,
|
id: `${res.id}`,
|
||||||
key: { key: res.tagKey, isColumn: false, type: null, dataType: null },
|
key: { key: res.tagKey, isColumn: false, type: null, dataType: null },
|
||||||
op: `${res.operator}`,
|
op: `${res.operator}`,
|
||||||
value: `${res.tagValue}`.split(','),
|
value: `${res.tagValue}`.split(','),
|
||||||
}));
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
export const OperatorSchema: IOption[] = OperatorConversions.map(
|
export const OperatorSchema: IOption[] = OperatorConversions.map(
|
||||||
(operator) => ({
|
(operator) => ({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user