mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-20 00:46:46 +00:00
* feat: created a component for apdex * refactor: added get and set apDexSetting API support * refactor: done with ApDexSetting * feat: done with the traces graph for ApDex * refactor: separated traces using feature flag * refactor: restucture the component level * feat: done with metrics ApDex application * refactor: removed unwanted logs * fix: some css part * refactor: handle error state * refactor: made use of constants and handleGraphClick for apDex * refactor: shifted type to type.ts * chore: css fixes * refactor: handle error and loading state * refactor: one on one mapping * refactor: according to review comments * refactor: removed unwanted color from local theme colors * refactor: one on one mapping for queryKey * refactor: updated css for view traces button issue * chore: commented out the ExcludeStatusCode feature * refactor: updated some css part of ApDexSetting popover * test: added test case for ApDexApplication and ApDexSettings * refactor: test cases * refactor: review comments * refactor: remove the checked for threshold size upto 1 * refactor: changed some text part of ApDex * refactor: only ApDexMetrics inuse * refactor: changes due to merge conflicts * fix: build pipeline * chore: change the type of the threshold * feat: widget header as ReactNode * chore: error for the title is updated * refactor: widget header as Reactnode * refactor: show tooltip when hover over the question icon * refactor: review changes * refactor: convert threadhold to ReactNode * refactor: updated test cases * refactor: move allow threshold a level up * fix: build pipeline * fix: input number issue for value 0 --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
116 lines
3.1 KiB
TypeScript
116 lines
3.1 KiB
TypeScript
import Spinner from 'components/Spinner';
|
|
import { FeatureKeys } from 'constants/features';
|
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
|
import Graph from 'container/GridGraphLayout/Graph/';
|
|
import { GraphTitle } from 'container/MetricsApplication/constant';
|
|
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
|
|
import { latency } from 'container/MetricsApplication/MetricsPageQueries/OverviewQueries';
|
|
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
|
import useFeatureFlag from 'hooks/useFeatureFlag';
|
|
import useResourceAttribute from 'hooks/useResourceAttribute';
|
|
import { resourceAttributesToTagFilterItems } from 'hooks/useResourceAttribute/utils';
|
|
import { useMemo } from 'react';
|
|
import { useParams } from 'react-router-dom';
|
|
import { EQueryType } from 'types/common/dashboard';
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
import { ClickHandlerType } from '../Overview';
|
|
import { Button } from '../styles';
|
|
import { IServiceName } from '../types';
|
|
import { handleNonInQueryRange, onViewTracePopupClick } from '../util';
|
|
|
|
function ServiceOverview({
|
|
onDragSelect,
|
|
handleGraphClick,
|
|
selectedTraceTags,
|
|
selectedTimeStamp,
|
|
topLevelOperationsRoute,
|
|
topLevelOperationsLoading,
|
|
}: ServiceOverviewProps): JSX.Element {
|
|
const { servicename } = useParams<IServiceName>();
|
|
|
|
const isSpanMetricEnable = useFeatureFlag(FeatureKeys.USE_SPAN_METRICS)
|
|
?.active;
|
|
|
|
const { queries } = useResourceAttribute();
|
|
|
|
const tagFilterItems = useMemo(
|
|
() =>
|
|
handleNonInQueryRange(
|
|
resourceAttributesToTagFilterItems(queries, !isSpanMetricEnable),
|
|
) || [],
|
|
[isSpanMetricEnable, queries],
|
|
);
|
|
|
|
const latencyWidget = useMemo(
|
|
() =>
|
|
getWidgetQueryBuilder({
|
|
query: {
|
|
queryType: EQueryType.QUERY_BUILDER,
|
|
promql: [],
|
|
builder: latency({
|
|
servicename,
|
|
tagFilterItems,
|
|
isSpanMetricEnable,
|
|
topLevelOperationsRoute,
|
|
}),
|
|
clickhouse_sql: [],
|
|
id: uuid(),
|
|
},
|
|
title: GraphTitle.LATENCY,
|
|
panelTypes: PANEL_TYPES.TIME_SERIES,
|
|
}),
|
|
[servicename, isSpanMetricEnable, topLevelOperationsRoute, tagFilterItems],
|
|
);
|
|
|
|
const isQueryEnabled = topLevelOperationsRoute.length > 0;
|
|
|
|
if (topLevelOperationsLoading) {
|
|
return (
|
|
<Card>
|
|
<Spinner height="40vh" tip="Loading..." />
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
type="default"
|
|
size="small"
|
|
id="Service_button"
|
|
onClick={onViewTracePopupClick({
|
|
servicename,
|
|
selectedTraceTags,
|
|
timestamp: selectedTimeStamp,
|
|
})}
|
|
>
|
|
View Traces
|
|
</Button>
|
|
<Card>
|
|
<GraphContainer>
|
|
<Graph
|
|
name="service_latency"
|
|
onDragSelect={onDragSelect}
|
|
widget={latencyWidget}
|
|
yAxisUnit="ns"
|
|
onClickHandler={handleGraphClick('Service')}
|
|
isQueryEnabled={isQueryEnabled}
|
|
/>
|
|
</GraphContainer>
|
|
</Card>
|
|
</>
|
|
);
|
|
}
|
|
|
|
interface ServiceOverviewProps {
|
|
selectedTimeStamp: number;
|
|
selectedTraceTags: string;
|
|
onDragSelect: (start: number, end: number) => void;
|
|
handleGraphClick: (type: string) => ClickHandlerType;
|
|
topLevelOperationsRoute: string[];
|
|
topLevelOperationsLoading: boolean;
|
|
}
|
|
|
|
export default ServiceOverview;
|