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

[APM] Split dependencies API adding a new API to return comparison statistics #95407

Closed
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
515c1d3
adding comparison to dependencies table
cauemarcondes Mar 25, 2021
f22c24d
adding should to query
cauemarcondes Mar 25, 2021
e005e38
refactoring
cauemarcondes Mar 25, 2021
254142d
Merge branch 'master' of github.com:elastic/kibana into apm-compariso…
cauemarcondes Mar 29, 2021
60a80b0
Merge branch 'master' of github.com:elastic/kibana into apm-compariso…
cauemarcondes Apr 1, 2021
ed18506
addressing PR comments
cauemarcondes Apr 1, 2021
f1be0d4
addressing PR comments
cauemarcondes Apr 1, 2021
61f0c84
fixing test
cauemarcondes Apr 1, 2021
64043d6
fixing ts issue
cauemarcondes Apr 2, 2021
672c9a1
Merge branch 'master' into apm-comparison-dependencies
kibanamachine Apr 5, 2021
e21f3d5
Merge branch 'master' of github.com:elastic/kibana into apm-compariso…
cauemarcondes Apr 12, 2021
dd5c277
refactoring comparison
cauemarcondes Apr 14, 2021
c71162d
Merge branch 'master' of github.com:elastic/kibana into apm-compariso…
cauemarcondes Apr 14, 2021
2edeb25
refactoring comparison
cauemarcondes Apr 14, 2021
b21fe38
Merge branch 'master' into apm-comparison-dependencies
kibanamachine Apr 15, 2021
129390c
Merge branch 'master' into apm-comparison-dependencies
kibanamachine Apr 19, 2021
d383b38
addressing PR comments
cauemarcondes Apr 19, 2021
0a08d5b
fixing api test
cauemarcondes Apr 19, 2021
c0f9831
Merge branch 'master' of github.com:elastic/kibana into apm-compariso…
cauemarcondes Apr 19, 2021
cedc8de
stop fetching comparison data when it is disabled
cauemarcondes Apr 19, 2021
6588d43
fixing unit test
cauemarcondes Apr 20, 2021
d09f35c
Merge branch 'master' of github.com:elastic/kibana into apm-compariso…
cauemarcondes Apr 20, 2021
a1acc7e
fixing TS issue
cauemarcondes Apr 20, 2021
53380ae
Merge branch 'master' of github.com:elastic/kibana into apm-compariso…
cauemarcondes Apr 21, 2021
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 @@ -25,6 +25,7 @@ import { waitFor } from '@testing-library/dom';
import * as callApmApiModule from '../../../services/rest/createCallApmApi';
import * as useApmServiceContextHooks from '../../../context/apm_service/use_apm_service_context';
import { LatencyAggregationType } from '../../../../common/latency_aggregation_types';
import { TimeRangeComparisonType } from '../../shared/time_comparison/get_time_range_comparison';

const KibanaReactContext = createKibanaReactContext({
usageCollection: { reportUiCounter: () => {} },
Expand All @@ -51,6 +52,8 @@ function Wrapper({ children }: { children?: ReactNode }) {
rangeFrom: 'now-15m',
rangeTo: 'now',
latencyAggregationType: LatencyAggregationType.avg,
comparisonType: TimeRangeComparisonType.DayBefore,
comparisonEnabled: true,
}}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { ServiceMapLink } from '../../../shared/Links/apm/ServiceMapLink';
import { ServiceOverviewLink } from '../../../shared/Links/apm/service_overview_link';
import { SpanIcon } from '../../../shared/span_icon';
import { TableFetchWrapper } from '../../../shared/table_fetch_wrapper';
import { getTimeRangeComparison } from '../../../shared/time_comparison/get_time_range_comparison';
import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip';
import { ServiceOverviewTableContainer } from '../service_overview_table_container';

Expand All @@ -41,9 +42,15 @@ interface Props {

export function ServiceOverviewDependenciesTable({ serviceName }: Props) {
const {
urlParams: { start, end, environment },
urlParams: { start, end, environment, comparisonType, comparisonEnabled },
} = useUrlParams();

const { comparisonStart, comparisonEnd } = getTimeRangeComparison({
start,
end,
comparisonType,
});

const columns: Array<EuiBasicTableColumn<ServiceDependencyItem>> = [
{
field: 'name',
Expand Down Expand Up @@ -97,12 +104,15 @@ export function ServiceOverviewDependenciesTable({ serviceName }: Props) {
}
),
width: px(unit * 10),
render: (_, { latency }) => {
render: (_, { currentPeriod, previousPeriod }) => {
return (
<SparkPlot
color="euiColorVis1"
series={latency.timeseries}
valueLabel={asMillisecondDuration(latency.value)}
series={currentPeriod.latency.timeseries}
valueLabel={asMillisecondDuration(currentPeriod.latency.value)}
comparisonSeries={
comparisonEnabled ? previousPeriod.latency.timeseries : undefined
}
/>
);
},
Expand All @@ -115,13 +125,18 @@ export function ServiceOverviewDependenciesTable({ serviceName }: Props) {
{ defaultMessage: 'Throughput' }
),
width: px(unit * 10),
render: (_, { throughput }) => {
render: (_, { currentPeriod, previousPeriod }) => {
return (
<SparkPlot
compact
color="euiColorVis0"
series={throughput.timeseries}
valueLabel={asTransactionRate(throughput.value)}
series={currentPeriod.throughput.timeseries}
valueLabel={asTransactionRate(currentPeriod.throughput.value)}
comparisonSeries={
comparisonEnabled
? previousPeriod.throughput.timeseries
: undefined
}
/>
);
},
Expand All @@ -136,13 +151,18 @@ export function ServiceOverviewDependenciesTable({ serviceName }: Props) {
}
),
width: px(unit * 10),
render: (_, { errorRate }) => {
render: (_, { currentPeriod, previousPeriod }) => {
return (
<SparkPlot
compact
color="euiColorVis7"
series={errorRate.timeseries}
valueLabel={asPercent(errorRate.value, 1)}
series={currentPeriod.errorRate.timeseries}
valueLabel={asPercent(currentPeriod.errorRate.value, 1)}
comparisonSeries={
comparisonEnabled
? previousPeriod.errorRate.timeseries
: undefined
}
/>
);
},
Expand All @@ -157,19 +177,33 @@ export function ServiceOverviewDependenciesTable({ serviceName }: Props) {
}
),
width: px(unit * 5),
render: (_, { impact }) => {
return <ImpactBar size="m" value={impact} />;
render: (_, { currentPeriod, previousPeriod }) => {
return (
<EuiFlexGroup gutterSize="xs" direction="column">
<EuiFlexItem>
<ImpactBar value={currentPeriod.impact} size="m" />
</EuiFlexItem>
{comparisonEnabled && (
<EuiFlexItem>
<ImpactBar
value={previousPeriod.impact}
size="s"
color="subdued"
/>
</EuiFlexItem>
)}
</EuiFlexGroup>
);
},
sortable: true,
},
];

const { data, status } = useFetcher(
(callApmApi) => {
if (!start || !end) {
if (!start || !end || !comparisonStart || !comparisonEnd) {
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
return;
}

return callApmApi({
endpoint: 'GET /api/apm/services/{serviceName}/dependencies',
params: {
Expand All @@ -181,22 +215,24 @@ export function ServiceOverviewDependenciesTable({ serviceName }: Props) {
end,
environment,
numBuckets: 20,
comparisonStart,
comparisonEnd,
},
},
});
},
[start, end, serviceName, environment]
[start, end, serviceName, environment, comparisonStart, comparisonEnd]
);

const serviceDependencies = data?.serviceDependencies ?? [];

// need top-level sortable fields for the managed table
const items = serviceDependencies.map((item) => ({
...item,
errorRateValue: item.errorRate.value,
latencyValue: item.latency.value,
throughputValue: item.throughput.value,
impactValue: item.impact,
errorRateValue: item.currentPeriod.errorRate.value,
latencyValue: item.currentPeriod.latency.value,
throughputValue: item.currentPeriod.throughput.value,
impactValue: item.currentPeriod.impact,
}));

return (
Expand Down
Loading