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 all 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 @@ -24,6 +24,7 @@ import { ServiceOverview } from './';
import { waitFor } from '@testing-library/dom';
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';
import {
getCallApmApiSpy,
getCreateCallApmApiSpy,
Expand Down Expand Up @@ -54,6 +55,8 @@ function Wrapper({ children }: { children?: ReactNode }) {
rangeFrom: 'now-15m',
rangeTo: 'now',
latencyAggregationType: LatencyAggregationType.avg,
comparisonType: TimeRangeComparisonType.DayBefore,
comparisonEnabled: true,
}}
>
{children}
Expand Down Expand Up @@ -94,7 +97,9 @@ describe('ServiceOverview', () => {
totalTransactionGroups: 0,
isAggregationAccurate: true,
},
'GET /api/apm/services/{serviceName}/dependencies': [],
'GET /api/apm/services/{serviceName}/dependencies': {
serviceDependencies: [],
},
'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics': [],
};
/* eslint-enable @typescript-eslint/naming-convention */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { EuiBasicTableColumn, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { getNextEnvironmentUrlParam } from '../../../../../common/environment_filter_values';
import {
asMillisecondDuration,
asPercent,
asTransactionRate,
} from '../../../../../common/utils/formatters';
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
import { px, unit } from '../../../../style/variables';
import { AgentIcon } from '../../../shared/AgentIcon';
import { SparkPlot } from '../../../shared/charts/spark_plot';
import { ImpactBar } from '../../../shared/ImpactBar';
import { ServiceOverviewLink } from '../../../shared/Links/apm/service_overview_link';
import { SpanIcon } from '../../../shared/span_icon';
import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip';

type ServiceDependencies = APIReturnType<'GET /api/apm/services/{serviceName}/dependencies'>;

export function getColumns({
environment,
comparisonEnabled,
}: {
environment?: string;
comparisonEnabled?: boolean;
}): Array<EuiBasicTableColumn<ServiceDependencies['serviceDependencies'][0]>> {
return [
{
field: 'name',
name: i18n.translate(
'xpack.apm.serviceOverview.dependenciesTableColumnBackend',
{
defaultMessage: 'Backend',
}
),
render: (_, item) => {
return (
<TruncateWithTooltip
text={item.name}
content={
<EuiFlexGroup gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>
{item.type === 'service' ? (
<AgentIcon agentName={item.agentName} />
) : (
<SpanIcon type={item.spanType} subType={item.spanSubtype} />
)}
</EuiFlexItem>
<EuiFlexItem>
{item.type === 'service' ? (
<ServiceOverviewLink
serviceName={item.serviceName}
environment={getNextEnvironmentUrlParam({
requestedEnvironment: item.environment,
currentEnvironmentUrlParam: environment,
})}
>
{item.name}
</ServiceOverviewLink>
) : (
item.name
)}
</EuiFlexItem>
</EuiFlexGroup>
}
/>
);
},
sortable: true,
},
{
field: 'latencyValue',
name: i18n.translate(
'xpack.apm.serviceOverview.dependenciesTableColumnLatency',
{
defaultMessage: 'Latency (avg.)',
}
),
width: px(unit * 10),
render: (_, item) => {
const previousPeriodLatencyTimeseries =
item.previousPeriodMetrics?.latency?.timeseries;
return (
<SparkPlot
color="euiColorVis1"
series={item.currentPeriodMetrics.latency.timeseries}
valueLabel={asMillisecondDuration(
item.currentPeriodMetrics.latency.value
)}
comparisonSeries={
comparisonEnabled ? previousPeriodLatencyTimeseries : undefined
}
/>
);
},
sortable: true,
},
{
field: 'throughputValue',
name: i18n.translate(
'xpack.apm.serviceOverview.dependenciesTableColumnThroughput',
{ defaultMessage: 'Throughput' }
),
width: px(unit * 10),
render: (_, item) => {
const previousPeriodThroughputTimeseries =
item.previousPeriodMetrics?.throughput?.timeseries;
return (
<SparkPlot
compact
color="euiColorVis0"
series={item.currentPeriodMetrics.throughput.timeseries}
valueLabel={asTransactionRate(
item.currentPeriodMetrics.throughput.value
)}
comparisonSeries={
comparisonEnabled ? previousPeriodThroughputTimeseries : undefined
}
/>
);
},
sortable: true,
},
{
field: 'errorRateValue',
name: i18n.translate(
'xpack.apm.serviceOverview.dependenciesTableColumnErrorRate',
{
defaultMessage: 'Error rate',
}
),
width: px(unit * 10),
render: (_, item) => {
const previousPeriodErrorRateTimeseries =
item.previousPeriodMetrics?.errorRate?.timeseries;
return (
<SparkPlot
compact
color="euiColorVis7"
series={item.currentPeriodMetrics.errorRate.timeseries}
valueLabel={asPercent(item.currentPeriodMetrics.errorRate.value, 1)}
comparisonSeries={
comparisonEnabled ? previousPeriodErrorRateTimeseries : undefined
}
/>
);
},
sortable: true,
},
{
field: 'impactValue',
name: i18n.translate(
'xpack.apm.serviceOverview.dependenciesTableColumnImpact',
{
defaultMessage: 'Impact',
}
),
width: px(unit * 5),
render: (_, item) => {
const previousPeriodImpact = item.previousPeriodMetrics?.impact || 0;
return (
<EuiFlexGroup gutterSize="xs" direction="column">
<EuiFlexItem>
<ImpactBar value={item.currentPeriodMetrics.impact} size="m" />
</EuiFlexItem>
{comparisonEnabled && (
<EuiFlexItem>
<ImpactBar
value={previousPeriodImpact}
size="s"
color="subdued"
/>
</EuiFlexItem>
)}
</EuiFlexGroup>
);
},
sortable: true,
},
];
}
Loading