chore: remove external metrics to trace nav (#2213)

This commit is contained in:
Vishal Sharma 2023-02-09 16:00:48 +05:30 committed by GitHub
parent 1151e8521e
commit aaeb579d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,11 +6,8 @@ import {
externalCallErrorPercent, externalCallErrorPercent,
externalCallRpsByAddress, externalCallRpsByAddress,
} from 'container/MetricsApplication/MetricsPageQueries/ExternalQueries'; } from 'container/MetricsApplication/MetricsPageQueries/ExternalQueries';
import { import { resourceAttributesToTagFilterItems } from 'lib/resourceAttributes';
convertRawQueriesToTraceSelectedTags, import React, { useMemo } from 'react';
resourceAttributesToTagFilterItems,
} from 'lib/resourceAttributes';
import React, { useMemo, useState } from 'react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { AppState } from 'store/reducers'; import { AppState } from 'store/reducers';
@ -18,25 +15,18 @@ import { Widgets } from 'types/api/dashboard/getAll';
import MetricReducer from 'types/reducer/metrics'; import MetricReducer from 'types/reducer/metrics';
import { Card, GraphContainer, GraphTitle, Row } from '../styles'; import { Card, GraphContainer, GraphTitle, Row } from '../styles';
import { Button } from './styles';
import { onGraphClickHandler, onViewTracePopupClick } from './util';
function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element { function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element {
const { servicename } = useParams<{ servicename?: string }>(); const { servicename } = useParams<{ servicename?: string }>();
const { resourceAttributeQueries } = useSelector<AppState, MetricReducer>( const { resourceAttributeQueries } = useSelector<AppState, MetricReducer>(
(state) => state.metrics, (state) => state.metrics,
); );
const [selectedTimeStamp, setSelectedTimeStamp] = useState<number>(0);
const tagFilterItems = useMemo( const tagFilterItems = useMemo(
() => resourceAttributesToTagFilterItems(resourceAttributeQueries) || [], () => resourceAttributesToTagFilterItems(resourceAttributeQueries) || [],
[resourceAttributeQueries], [resourceAttributeQueries],
); );
const selectedTraceTags: string = JSON.stringify(
convertRawQueriesToTraceSelectedTags(resourceAttributeQueries) || [],
);
const legend = '{{address}}'; const legend = '{{address}}';
const externalCallErrorWidget = useMemo( const externalCallErrorWidget = useMemo(
@ -102,18 +92,6 @@ function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element {
<> <>
<Row gutter={24}> <Row gutter={24}>
<Col span={12}> <Col span={12}>
<Button
type="default"
size="small"
id="external_call_error_percentage_button"
onClick={onViewTracePopupClick(
servicename,
selectedTraceTags,
selectedTimeStamp,
)}
>
View Traces
</Button>
<Card> <Card>
<GraphTitle>External Call Error Percentage</GraphTitle> <GraphTitle>External Call Error Percentage</GraphTitle>
<GraphContainer> <GraphContainer>
@ -122,33 +100,12 @@ function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element {
fullViewOptions={false} fullViewOptions={false}
widget={externalCallErrorWidget} widget={externalCallErrorWidget}
yAxisUnit="%" yAxisUnit="%"
onClickHandler={(ChartEvent, activeElements, chart, data): void => {
onGraphClickHandler(setSelectedTimeStamp)(
ChartEvent,
activeElements,
chart,
data,
'external_call_error_percentage',
);
}}
/> />
</GraphContainer> </GraphContainer>
</Card> </Card>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Button
type="default"
size="small"
id="external_call_duration_button"
onClick={onViewTracePopupClick(
servicename,
selectedTraceTags,
selectedTimeStamp,
)}
>
View Traces
</Button>
<Card> <Card>
<GraphTitle>External Call duration</GraphTitle> <GraphTitle>External Call duration</GraphTitle>
<GraphContainer> <GraphContainer>
@ -157,15 +114,6 @@ function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element {
fullViewOptions={false} fullViewOptions={false}
widget={externalCallDurationWidget} widget={externalCallDurationWidget}
yAxisUnit="ms" yAxisUnit="ms"
onClickHandler={(ChartEvent, activeElements, chart, data): void => {
onGraphClickHandler(setSelectedTimeStamp)(
ChartEvent,
activeElements,
chart,
data,
'external_call_duration',
);
}}
/> />
</GraphContainer> </GraphContainer>
</Card> </Card>
@ -174,18 +122,6 @@ function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element {
<Row gutter={24}> <Row gutter={24}>
<Col span={12}> <Col span={12}>
<Button
type="default"
size="small"
id="external_call_rps_by_address_button"
onClick={onViewTracePopupClick(
servicename,
selectedTraceTags,
selectedTimeStamp,
)}
>
View Traces
</Button>
<Card> <Card>
<GraphTitle>External Call RPS(by Address)</GraphTitle> <GraphTitle>External Call RPS(by Address)</GraphTitle>
<GraphContainer> <GraphContainer>
@ -194,33 +130,12 @@ function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element {
fullViewOptions={false} fullViewOptions={false}
widget={externalCallRPSWidget} widget={externalCallRPSWidget}
yAxisUnit="reqps" yAxisUnit="reqps"
onClickHandler={(ChartEvent, activeElements, chart, data): void => {
onGraphClickHandler(setSelectedTimeStamp)(
ChartEvent,
activeElements,
chart,
data,
'external_call_rps_by_address',
);
}}
/> />
</GraphContainer> </GraphContainer>
</Card> </Card>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Button
type="default"
size="small"
id="external_call_duration_by_address_button"
onClick={onViewTracePopupClick(
servicename,
selectedTraceTags,
selectedTimeStamp,
)}
>
View Traces
</Button>
<Card> <Card>
<GraphTitle>External Call duration(by Address)</GraphTitle> <GraphTitle>External Call duration(by Address)</GraphTitle>
<GraphContainer> <GraphContainer>
@ -229,15 +144,6 @@ function External({ getWidgetQueryBuilder }: ExternalProps): JSX.Element {
fullViewOptions={false} fullViewOptions={false}
widget={externalCallDurationAddressWidget} widget={externalCallDurationAddressWidget}
yAxisUnit="ms" yAxisUnit="ms"
onClickHandler={(ChartEvent, activeElements, chart, data): void => {
onGraphClickHandler(setSelectedTimeStamp)(
ChartEvent,
activeElements,
chart,
data,
'external_call_duration_by_address',
);
}}
/> />
</GraphContainer> </GraphContainer>
</Card> </Card>