Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] quick fix for traces and services indiviudal page #271

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ export function ServiceView(props: ServiceViewProps) {
const [redirect, setRedirect] = useState(false);

const refresh = () => {
const DSL = filtersToDsl(mode, props.filters, props.query, processTimeStamp(props.startTime, mode), processTimeStamp(props.endTime, mode));
const DSL = filtersToDsl(
mode,
props.filters,
props.query,
processTimeStamp(props.startTime, mode),
processTimeStamp(props.endTime, mode)
);
handleServiceViewRequest(props.serviceName, props.http, DSL, setFields, mode);
if (mode === 'data_prepper') {
handleServiceMapRequest(props.http, DSL, mode, setServiceMap, props.serviceName);
Expand All @@ -74,7 +80,7 @@ export function ServiceView(props: ServiceViewProps) {

useEffect(() => {
if (!redirect) refresh();
}, [props.startTime, props.endTime, props.serviceName]);
}, [props.startTime, props.endTime, props.serviceName, props.mode]);

const renderTitle = (
serviceName: string,
Expand Down Expand Up @@ -113,17 +119,19 @@ export function ServiceView(props: ServiceViewProps) {
{props.serviceName || '-'}
</EuiText>
</EuiFlexItem>
{ mode === 'data_prepper' ?
{mode === 'data_prepper' ? (
<EuiFlexItem grow={false}>
<EuiText className="overview-title">Number of connected services</EuiText>
<EuiText size="s" className="overview-content">
{fields.number_of_connected_services !== undefined
? fields.number_of_connected_services
: 0}
</EuiText>
</EuiFlexItem> : <EuiFlexItem/>
}
{ mode === 'data_prepper' ?
</EuiFlexItem>
) : (
<EuiFlexItem />
)}
{mode === 'data_prepper' ? (
<EuiFlexItem grow={false}>
<EuiText className="overview-title">Connected services</EuiText>
<EuiText size="s" className="overview-content">
Expand All @@ -139,8 +147,10 @@ export function ServiceView(props: ServiceViewProps) {
})
: '-'}
</EuiText>
</EuiFlexItem> : <EuiFlexItem/>
}
</EuiFlexItem>
) : (
<EuiFlexItem />
)}
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
Expand Down Expand Up @@ -234,17 +244,23 @@ export function ServiceView(props: ServiceViewProps) {
};

useEffect(() => {
const spanDSL = filtersToDsl(mode, props.filters, props.query, processTimeStamp(props.startTime, mode), processTimeStamp(props.endTime, mode));
const spanDSL = filtersToDsl(
mode,
props.filters,
props.query,
processTimeStamp(props.startTime, mode),
processTimeStamp(props.endTime, mode)
);
if (mode === 'data_prepper') {
spanDSL.query.bool.must.push({
term: {
"serviceName": props.serviceName,
serviceName: props.serviceName,
},
});
} else if (mode === 'jaeger') {
spanDSL.query.bool.must.push({
term: {
"process.serviceName": props.serviceName,
'process.serviceName': props.serviceName,
},
});
}
Expand Down Expand Up @@ -325,15 +341,17 @@ export function ServiceView(props: ServiceViewProps) {
<EuiSpacer size="xl" />
{overview}
<EuiSpacer />
{ mode === 'data_prepper' ?
{mode === 'data_prepper' ? (
<ServiceMap
serviceMap={serviceMap}
idSelected={serviceMapIdSelected}
setIdSelected={setServiceMapIdSelected}
currService={props.serviceName}
page="serviceView"
/> : <div/>
}
/>
) : (
<div />
)}
<EuiSpacer />
<EuiPanel>
<PanelTitle title="Spans" totalItems={total} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ export function TraceView(props: TraceViewProps) {
</EuiFlexGroup>
)}
</EuiFlexItem>
{ mode === 'data_prepper' ? (
{mode === 'data_prepper' ? (
<EuiFlexItem grow={false}>
<EuiText className="overview-title">Trace group name</EuiText>
<EuiText size="s" className="overview-content">
{fields.trace_group || '-'}
</EuiText>
</EuiFlexItem> ) : (<div/>)
}
</EuiFlexItem>
) : (
<div />
)}
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
Expand Down Expand Up @@ -150,10 +152,23 @@ export function TraceView(props: TraceViewProps) {
>('latency');

const refresh = async () => {
const DSL = filtersToDsl(mode, [], '', processTimeStamp('now', mode), processTimeStamp('now', mode), page);
const DSL = filtersToDsl(
mode,
[],
'',
processTimeStamp('now', mode),
processTimeStamp('now', mode),
page
);
handleTraceViewRequest(props.traceId, props.http, fields, setFields, mode);
handlePayloadRequest(props.traceId, props.http, payloadData, setPayloadData, mode);
handleServicesPieChartRequest(props.traceId, props.http, setServiceBreakdownData, setColorMap, mode);
handleServicesPieChartRequest(
props.traceId,
props.http,
setServiceBreakdownData,
setColorMap,
mode
);
handleServiceMapRequest(props.http, DSL, mode, setServiceMap);
};

Expand Down Expand Up @@ -206,7 +221,7 @@ export function TraceView(props: TraceViewProps) {
},
]);
refresh();
}, []);
}, [props.mode]);

return (
<>
Expand Down Expand Up @@ -250,15 +265,17 @@ export function TraceView(props: TraceViewProps) {
) : null}
</EuiPanel>
<EuiSpacer />
{ mode === 'data_prepper' ?
{mode === 'data_prepper' ? (
<ServiceMap
addFilter={undefined}
serviceMap={traceFilteredServiceMap}
idSelected={serviceMapIdSelected}
setIdSelected={setServiceMapIdSelected}
page={page}
/> : (<div/>)
}
/>
) : (
<div />
)}
</EuiPageBody>
</EuiPage>
</>
Expand Down