[APM] Stop fetching previous period data when comparison is disabled (#97469)
* stopping fetching previous period data when comparison is disabled * addressing PR comments * refactoring comparison and primary API names
This commit is contained in:
parent
41d55ef2e0
commit
83824ab13a
|
@ -85,16 +85,16 @@ describe('ServiceOverview', () => {
|
|||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const calls = {
|
||||
'GET /api/apm/services/{serviceName}/error_groups/primary_statistics': {
|
||||
'GET /api/apm/services/{serviceName}/error_groups/main_statistics': {
|
||||
error_groups: [] as any[],
|
||||
},
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics': {
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics': {
|
||||
transactionGroups: [] as any[],
|
||||
totalTransactionGroups: 0,
|
||||
isAggregationAccurate: true,
|
||||
},
|
||||
'GET /api/apm/services/{serviceName}/dependencies': [],
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics': [],
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics': [],
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
|
|
|
@ -16,18 +16,18 @@ import { TimestampTooltip } from '../../../shared/TimestampTooltip';
|
|||
import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip';
|
||||
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
|
||||
|
||||
type ErrorGroupPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/primary_statistics'>;
|
||||
type ErrorGroupComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics'>;
|
||||
type ErrorGroupMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/main_statistics'>;
|
||||
type ErrorGroupDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics'>;
|
||||
|
||||
export function getColumns({
|
||||
serviceName,
|
||||
errorGroupComparisonStatistics,
|
||||
errorGroupDetailedStatistics,
|
||||
comparisonEnabled,
|
||||
}: {
|
||||
serviceName: string;
|
||||
errorGroupComparisonStatistics: ErrorGroupComparisonStatistics;
|
||||
errorGroupDetailedStatistics: ErrorGroupDetailedStatistics;
|
||||
comparisonEnabled?: boolean;
|
||||
}): Array<EuiBasicTableColumn<ErrorGroupPrimaryStatistics['error_groups'][0]>> {
|
||||
}): Array<EuiBasicTableColumn<ErrorGroupMainStatistics['error_groups'][0]>> {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
|
@ -74,10 +74,10 @@ export function getColumns({
|
|||
width: px(unit * 12),
|
||||
render: (_, { occurrences, group_id: errorGroupId }) => {
|
||||
const currentPeriodTimeseries =
|
||||
errorGroupComparisonStatistics?.currentPeriod?.[errorGroupId]
|
||||
errorGroupDetailedStatistics?.currentPeriod?.[errorGroupId]
|
||||
?.timeseries;
|
||||
const previousPeriodTimeseries =
|
||||
errorGroupComparisonStatistics?.previousPeriod?.[errorGroupId]
|
||||
errorGroupDetailedStatistics?.previousPeriod?.[errorGroupId]
|
||||
?.timeseries;
|
||||
|
||||
return (
|
||||
|
|
|
@ -28,8 +28,8 @@ import { getColumns } from './get_column';
|
|||
interface Props {
|
||||
serviceName: string;
|
||||
}
|
||||
type ErrorGroupPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/primary_statistics'>;
|
||||
type ErrorGroupComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics'>;
|
||||
type ErrorGroupMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/main_statistics'>;
|
||||
type ErrorGroupDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics'>;
|
||||
|
||||
type SortDirection = 'asc' | 'desc';
|
||||
type SortField = 'name' | 'last_seen' | 'occurrences';
|
||||
|
@ -40,8 +40,8 @@ const DEFAULT_SORT = {
|
|||
field: 'occurrences' as const,
|
||||
};
|
||||
|
||||
const INITIAL_STATE_PRIMARY_STATISTICS: {
|
||||
items: ErrorGroupPrimaryStatistics['error_groups'];
|
||||
const INITIAL_STATE_MAIN_STATISTICS: {
|
||||
items: ErrorGroupMainStatistics['error_groups'];
|
||||
totalItems: number;
|
||||
requestId?: string;
|
||||
} = {
|
||||
|
@ -50,7 +50,7 @@ const INITIAL_STATE_PRIMARY_STATISTICS: {
|
|||
requestId: undefined,
|
||||
};
|
||||
|
||||
const INITIAL_STATE_COMPARISON_STATISTICS: ErrorGroupComparisonStatistics = {
|
||||
const INITIAL_STATE_DETAILED_STATISTICS: ErrorGroupDetailedStatistics = {
|
||||
currentPeriod: {},
|
||||
previousPeriod: {},
|
||||
};
|
||||
|
@ -82,19 +82,20 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
|
|||
start,
|
||||
end,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const { pageIndex, sort } = tableOptions;
|
||||
const { direction, field } = sort;
|
||||
|
||||
const { data = INITIAL_STATE_PRIMARY_STATISTICS, status } = useFetcher(
|
||||
const { data = INITIAL_STATE_MAIN_STATISTICS, status } = useFetcher(
|
||||
(callApmApi) => {
|
||||
if (!start || !end || !transactionType) {
|
||||
return;
|
||||
}
|
||||
return callApmApi({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/error_groups/primary_statistics',
|
||||
'GET /api/apm/services/{serviceName}/error_groups/main_statistics',
|
||||
params: {
|
||||
path: { serviceName },
|
||||
query: {
|
||||
|
@ -113,13 +114,13 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
|
|||
).slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE);
|
||||
|
||||
return {
|
||||
// Everytime the main statistics is refetched, updates the requestId making the comparison API to be refetched.
|
||||
requestId: uuid(),
|
||||
items: currentPageErrorGroups,
|
||||
totalItems: response.error_groups.length,
|
||||
};
|
||||
});
|
||||
},
|
||||
// comparisonType is listed as dependency even thought it is not used. This is needed to trigger the comparison api when it is changed.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[
|
||||
environment,
|
||||
|
@ -131,21 +132,24 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
|
|||
pageIndex,
|
||||
direction,
|
||||
field,
|
||||
// not used, but needed to trigger an update when comparisonType is changed either manually by user or when time range is changed
|
||||
comparisonType,
|
||||
// not used, but needed to trigger an update when comparison feature is disabled/enabled by user
|
||||
comparisonEnabled,
|
||||
]
|
||||
);
|
||||
|
||||
const { requestId, items, totalItems } = data;
|
||||
|
||||
const {
|
||||
data: errorGroupComparisonStatistics = INITIAL_STATE_COMPARISON_STATISTICS,
|
||||
status: errorGroupComparisonStatisticsStatus,
|
||||
data: errorGroupDetailedStatistics = INITIAL_STATE_DETAILED_STATISTICS,
|
||||
status: errorGroupDetailedStatisticsStatus,
|
||||
} = useFetcher(
|
||||
(callApmApi) => {
|
||||
if (requestId && items.length && start && end && transactionType) {
|
||||
return callApmApi({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics',
|
||||
'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics',
|
||||
params: {
|
||||
path: { serviceName },
|
||||
query: {
|
||||
|
@ -173,7 +177,7 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
|
|||
|
||||
const columns = getColumns({
|
||||
serviceName,
|
||||
errorGroupComparisonStatistics,
|
||||
errorGroupDetailedStatistics,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
|
@ -218,7 +222,7 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
|
|||
}}
|
||||
loading={
|
||||
status === FETCH_STATUS.LOADING ||
|
||||
errorGroupComparisonStatisticsStatus === FETCH_STATUS.LOADING
|
||||
errorGroupDetailedStatisticsStatus === FETCH_STATUS.LOADING
|
||||
}
|
||||
onChange={(newTableOptions: {
|
||||
page?: {
|
||||
|
|
|
@ -25,7 +25,7 @@ interface ServiceOverviewInstancesChartAndTableProps {
|
|||
serviceName: string;
|
||||
}
|
||||
|
||||
export interface PrimaryStatsServiceInstanceItem {
|
||||
export interface MainStatsServiceInstanceItem {
|
||||
serviceNodeName: string;
|
||||
errorRate: number;
|
||||
throughput: number;
|
||||
|
@ -34,15 +34,15 @@ export interface PrimaryStatsServiceInstanceItem {
|
|||
memoryUsage: number;
|
||||
}
|
||||
|
||||
const INITIAL_STATE_PRIMARY_STATS = {
|
||||
primaryStatsItems: [] as PrimaryStatsServiceInstanceItem[],
|
||||
primaryStatsRequestId: undefined,
|
||||
primaryStatsItemCount: 0,
|
||||
const INITIAL_STATE_MAIN_STATS = {
|
||||
mainStatsItems: [] as MainStatsServiceInstanceItem[],
|
||||
mainStatsRequestId: undefined,
|
||||
mainStatsItemCount: 0,
|
||||
};
|
||||
|
||||
type ApiResponseComparisonStats = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>;
|
||||
type ApiResponseDetailedStats = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>;
|
||||
|
||||
const INITIAL_STATE_COMPARISON_STATISTICS: ApiResponseComparisonStats = {
|
||||
const INITIAL_STATE_DETAILED_STATISTICS: ApiResponseDetailedStats = {
|
||||
currentPeriod: {},
|
||||
previousPeriod: {},
|
||||
};
|
||||
|
@ -83,6 +83,7 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
start,
|
||||
end,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
},
|
||||
} = useUrlParams();
|
||||
|
||||
|
@ -90,11 +91,12 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
start,
|
||||
end,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const {
|
||||
data: primaryStatsData = INITIAL_STATE_PRIMARY_STATS,
|
||||
status: primaryStatsStatus,
|
||||
data: mainStatsData = INITIAL_STATE_MAIN_STATS,
|
||||
status: mainStatsStatus,
|
||||
} = useFetcher(
|
||||
(callApmApi) => {
|
||||
if (!start || !end || !transactionType || !latencyAggregationType) {
|
||||
|
@ -103,7 +105,7 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
|
||||
return callApmApi({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics',
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics',
|
||||
params: {
|
||||
path: {
|
||||
serviceName,
|
||||
|
@ -118,7 +120,7 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
},
|
||||
},
|
||||
}).then((response) => {
|
||||
const primaryStatsItems = orderBy(
|
||||
const mainStatsItems = orderBy(
|
||||
// need top-level sortable fields for the managed table
|
||||
response.serviceInstances.map((item) => ({
|
||||
...item,
|
||||
|
@ -133,13 +135,13 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
).slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE);
|
||||
|
||||
return {
|
||||
primaryStatsRequestId: uuid(),
|
||||
primaryStatsItems,
|
||||
primaryStatsItemCount: response.serviceInstances.length,
|
||||
// Everytime the main statistics is refetched, updates the requestId making the detailed API to be refetched.
|
||||
mainStatsRequestId: uuid(),
|
||||
mainStatsItems,
|
||||
mainStatsItemCount: response.serviceInstances.length,
|
||||
};
|
||||
});
|
||||
},
|
||||
// comparisonType is listed as dependency even thought it is not used. This is needed to trigger the comparison api when it is changed.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[
|
||||
environment,
|
||||
|
@ -152,19 +154,22 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
pageIndex,
|
||||
field,
|
||||
direction,
|
||||
// not used, but needed to trigger an update when comparisonType is changed either manually by user or when time range is changed
|
||||
comparisonType,
|
||||
// not used, but needed to trigger an update when comparison feature is disabled/enabled by user
|
||||
comparisonEnabled,
|
||||
]
|
||||
);
|
||||
|
||||
const {
|
||||
primaryStatsItems,
|
||||
primaryStatsRequestId,
|
||||
primaryStatsItemCount,
|
||||
} = primaryStatsData;
|
||||
mainStatsItems,
|
||||
mainStatsRequestId,
|
||||
mainStatsItemCount,
|
||||
} = mainStatsData;
|
||||
|
||||
const {
|
||||
data: comparisonStatsData = INITIAL_STATE_COMPARISON_STATISTICS,
|
||||
status: comparisonStatisticsStatus,
|
||||
data: detailedStatsData = INITIAL_STATE_DETAILED_STATISTICS,
|
||||
status: detailedStatsStatus,
|
||||
} = useFetcher(
|
||||
(callApmApi) => {
|
||||
if (
|
||||
|
@ -172,14 +177,14 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
!end ||
|
||||
!transactionType ||
|
||||
!latencyAggregationType ||
|
||||
!primaryStatsItemCount
|
||||
!mainStatsItemCount
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
return callApmApi({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics',
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics',
|
||||
params: {
|
||||
path: {
|
||||
serviceName,
|
||||
|
@ -193,7 +198,7 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
numBuckets: 20,
|
||||
transactionType,
|
||||
serviceNodeIds: JSON.stringify(
|
||||
primaryStatsItems.map((item) => item.serviceNodeName)
|
||||
mainStatsItems.map((item) => item.serviceNodeName)
|
||||
),
|
||||
comparisonStart,
|
||||
comparisonEnd,
|
||||
|
@ -201,9 +206,9 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
},
|
||||
});
|
||||
},
|
||||
// only fetches comparison statistics when requestId is invalidated by primary statistics api call
|
||||
// only fetches detailed statistics when requestId is invalidated by main statistics api call
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[primaryStatsRequestId],
|
||||
[mainStatsRequestId],
|
||||
{ preservePreviousData: false }
|
||||
);
|
||||
|
||||
|
@ -212,22 +217,22 @@ export function ServiceOverviewInstancesChartAndTable({
|
|||
<EuiFlexItem grow={3}>
|
||||
<InstancesLatencyDistributionChart
|
||||
height={chartHeight}
|
||||
items={primaryStatsItems}
|
||||
status={primaryStatsStatus}
|
||||
items={mainStatsItems}
|
||||
status={mainStatsStatus}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={7}>
|
||||
<EuiPanel>
|
||||
<ServiceOverviewInstancesTable
|
||||
primaryStatsItems={primaryStatsItems}
|
||||
primaryStatsStatus={primaryStatsStatus}
|
||||
primaryStatsItemCount={primaryStatsItemCount}
|
||||
comparisonStatsData={comparisonStatsData}
|
||||
mainStatsItems={mainStatsItems}
|
||||
mainStatsStatus={mainStatsStatus}
|
||||
mainStatsItemCount={mainStatsItemCount}
|
||||
detailedStatsData={detailedStatsData}
|
||||
serviceName={serviceName}
|
||||
tableOptions={tableOptions}
|
||||
isLoading={
|
||||
primaryStatsStatus === FETCH_STATUS.LOADING ||
|
||||
comparisonStatisticsStatus === FETCH_STATUS.LOADING
|
||||
mainStatsStatus === FETCH_STATUS.LOADING ||
|
||||
detailedStatsStatus === FETCH_STATUS.LOADING
|
||||
}
|
||||
onChangeTableOptions={(newTableOptions) => {
|
||||
setTableOptions({
|
||||
|
|
|
@ -26,23 +26,23 @@ import { MetricOverviewLink } from '../../../shared/Links/apm/MetricOverviewLink
|
|||
import { ServiceNodeMetricOverviewLink } from '../../../shared/Links/apm/ServiceNodeMetricOverviewLink';
|
||||
import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip';
|
||||
import { getLatencyColumnLabel } from '../get_latency_column_label';
|
||||
import { PrimaryStatsServiceInstanceItem } from '../service_overview_instances_chart_and_table';
|
||||
import { MainStatsServiceInstanceItem } from '../service_overview_instances_chart_and_table';
|
||||
|
||||
type ServiceInstanceComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>;
|
||||
type ServiceInstanceDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>;
|
||||
|
||||
export function getColumns({
|
||||
serviceName,
|
||||
agentName,
|
||||
latencyAggregationType,
|
||||
comparisonStatsData,
|
||||
detailedStatsData,
|
||||
comparisonEnabled,
|
||||
}: {
|
||||
serviceName: string;
|
||||
agentName?: string;
|
||||
latencyAggregationType?: LatencyAggregationType;
|
||||
comparisonStatsData?: ServiceInstanceComparisonStatistics;
|
||||
detailedStatsData?: ServiceInstanceDetailedStatistics;
|
||||
comparisonEnabled?: boolean;
|
||||
}): Array<EuiBasicTableColumn<PrimaryStatsServiceInstanceItem>> {
|
||||
}): Array<EuiBasicTableColumn<MainStatsServiceInstanceItem>> {
|
||||
return [
|
||||
{
|
||||
field: 'serviceNodeName',
|
||||
|
@ -87,9 +87,9 @@ export function getColumns({
|
|||
width: px(unit * 10),
|
||||
render: (_, { serviceNodeName, latency }) => {
|
||||
const currentPeriodTimestamp =
|
||||
comparisonStatsData?.currentPeriod?.[serviceNodeName]?.latency;
|
||||
detailedStatsData?.currentPeriod?.[serviceNodeName]?.latency;
|
||||
const previousPeriodTimestamp =
|
||||
comparisonStatsData?.previousPeriod?.[serviceNodeName]?.latency;
|
||||
detailedStatsData?.previousPeriod?.[serviceNodeName]?.latency;
|
||||
return (
|
||||
<SparkPlot
|
||||
color="euiColorVis1"
|
||||
|
@ -112,9 +112,9 @@ export function getColumns({
|
|||
width: px(unit * 10),
|
||||
render: (_, { serviceNodeName, throughput }) => {
|
||||
const currentPeriodTimestamp =
|
||||
comparisonStatsData?.currentPeriod?.[serviceNodeName]?.throughput;
|
||||
detailedStatsData?.currentPeriod?.[serviceNodeName]?.throughput;
|
||||
const previousPeriodTimestamp =
|
||||
comparisonStatsData?.previousPeriod?.[serviceNodeName]?.throughput;
|
||||
detailedStatsData?.previousPeriod?.[serviceNodeName]?.throughput;
|
||||
return (
|
||||
<SparkPlot
|
||||
compact
|
||||
|
@ -138,9 +138,9 @@ export function getColumns({
|
|||
width: px(unit * 8),
|
||||
render: (_, { serviceNodeName, errorRate }) => {
|
||||
const currentPeriodTimestamp =
|
||||
comparisonStatsData?.currentPeriod?.[serviceNodeName]?.errorRate;
|
||||
detailedStatsData?.currentPeriod?.[serviceNodeName]?.errorRate;
|
||||
const previousPeriodTimestamp =
|
||||
comparisonStatsData?.previousPeriod?.[serviceNodeName]?.errorRate;
|
||||
detailedStatsData?.previousPeriod?.[serviceNodeName]?.errorRate;
|
||||
return (
|
||||
<SparkPlot
|
||||
compact
|
||||
|
@ -164,9 +164,9 @@ export function getColumns({
|
|||
width: px(unit * 8),
|
||||
render: (_, { serviceNodeName, cpuUsage }) => {
|
||||
const currentPeriodTimestamp =
|
||||
comparisonStatsData?.currentPeriod?.[serviceNodeName]?.cpuUsage;
|
||||
detailedStatsData?.currentPeriod?.[serviceNodeName]?.cpuUsage;
|
||||
const previousPeriodTimestamp =
|
||||
comparisonStatsData?.previousPeriod?.[serviceNodeName]?.cpuUsage;
|
||||
detailedStatsData?.previousPeriod?.[serviceNodeName]?.cpuUsage;
|
||||
return (
|
||||
<SparkPlot
|
||||
compact
|
||||
|
@ -190,9 +190,9 @@ export function getColumns({
|
|||
width: px(unit * 9),
|
||||
render: (_, { serviceNodeName, memoryUsage }) => {
|
||||
const currentPeriodTimestamp =
|
||||
comparisonStatsData?.currentPeriod?.[serviceNodeName]?.memoryUsage;
|
||||
detailedStatsData?.currentPeriod?.[serviceNodeName]?.memoryUsage;
|
||||
const previousPeriodTimestamp =
|
||||
comparisonStatsData?.previousPeriod?.[serviceNodeName]?.memoryUsage;
|
||||
detailedStatsData?.previousPeriod?.[serviceNodeName]?.memoryUsage;
|
||||
return (
|
||||
<SparkPlot
|
||||
compact
|
||||
|
|
|
@ -20,14 +20,14 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi';
|
|||
import { TableFetchWrapper } from '../../../shared/table_fetch_wrapper';
|
||||
import {
|
||||
PAGE_SIZE,
|
||||
PrimaryStatsServiceInstanceItem,
|
||||
MainStatsServiceInstanceItem,
|
||||
SortDirection,
|
||||
SortField,
|
||||
} from '../service_overview_instances_chart_and_table';
|
||||
import { ServiceOverviewTableContainer } from '../service_overview_table_container';
|
||||
import { getColumns } from './get_columns';
|
||||
|
||||
type ServiceInstanceComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>;
|
||||
type ServiceInstanceDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>;
|
||||
|
||||
export interface TableOptions {
|
||||
pageIndex: number;
|
||||
|
@ -38,26 +38,26 @@ export interface TableOptions {
|
|||
}
|
||||
|
||||
interface Props {
|
||||
primaryStatsItems: PrimaryStatsServiceInstanceItem[];
|
||||
mainStatsItems: MainStatsServiceInstanceItem[];
|
||||
serviceName: string;
|
||||
primaryStatsStatus: FETCH_STATUS;
|
||||
primaryStatsItemCount: number;
|
||||
mainStatsStatus: FETCH_STATUS;
|
||||
mainStatsItemCount: number;
|
||||
tableOptions: TableOptions;
|
||||
onChangeTableOptions: (newTableOptions: {
|
||||
page?: { index: number };
|
||||
sort?: { field: string; direction: SortDirection };
|
||||
}) => void;
|
||||
comparisonStatsData?: ServiceInstanceComparisonStatistics;
|
||||
detailedStatsData?: ServiceInstanceDetailedStatistics;
|
||||
isLoading: boolean;
|
||||
}
|
||||
export function ServiceOverviewInstancesTable({
|
||||
primaryStatsItems = [],
|
||||
primaryStatsItemCount,
|
||||
mainStatsItems = [],
|
||||
mainStatsItemCount,
|
||||
serviceName,
|
||||
primaryStatsStatus: status,
|
||||
mainStatsStatus: status,
|
||||
tableOptions,
|
||||
onChangeTableOptions,
|
||||
comparisonStatsData: comparisonStatsData,
|
||||
detailedStatsData: detailedStatsData,
|
||||
isLoading,
|
||||
}: Props) {
|
||||
const { agentName } = useApmServiceContext();
|
||||
|
@ -72,14 +72,14 @@ export function ServiceOverviewInstancesTable({
|
|||
agentName,
|
||||
serviceName,
|
||||
latencyAggregationType,
|
||||
comparisonStatsData,
|
||||
detailedStatsData,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const pagination = {
|
||||
pageIndex,
|
||||
pageSize: PAGE_SIZE,
|
||||
totalItemCount: primaryStatsItemCount,
|
||||
totalItemCount: mainStatsItemCount,
|
||||
hidePerPageOptions: true,
|
||||
};
|
||||
|
||||
|
@ -97,11 +97,11 @@ export function ServiceOverviewInstancesTable({
|
|||
<EuiFlexItem>
|
||||
<TableFetchWrapper status={status}>
|
||||
<ServiceOverviewTableContainer
|
||||
isEmptyAndLoading={primaryStatsItemCount === 0 && isLoading}
|
||||
isEmptyAndLoading={mainStatsItemCount === 0 && isLoading}
|
||||
>
|
||||
<EuiBasicTable
|
||||
loading={isLoading}
|
||||
items={primaryStatsItems}
|
||||
items={mainStatsItems}
|
||||
columns={columns}
|
||||
pagination={pagination}
|
||||
sorting={{ sort: { field, direction } }}
|
||||
|
|
|
@ -48,6 +48,7 @@ export function ServiceOverviewThroughputChart({
|
|||
start,
|
||||
end,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const { data = INITIAL_STATE, status } = useFetcher(
|
||||
|
|
|
@ -23,22 +23,22 @@ import { TransactionDetailLink } from '../../../shared/Links/apm/transaction_det
|
|||
import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip';
|
||||
import { getLatencyColumnLabel } from '../get_latency_column_label';
|
||||
|
||||
type TransactionGroupPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics'>;
|
||||
type TransactionGroupMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics'>;
|
||||
|
||||
type ServiceTransactionGroupItem = ValuesType<
|
||||
TransactionGroupPrimaryStatistics['transactionGroups']
|
||||
TransactionGroupMainStatistics['transactionGroups']
|
||||
>;
|
||||
type TransactionGroupComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics'>;
|
||||
type TransactionGroupDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics'>;
|
||||
|
||||
export function getColumns({
|
||||
serviceName,
|
||||
latencyAggregationType,
|
||||
transactionGroupComparisonStatistics,
|
||||
transactionGroupDetailedStatistics,
|
||||
comparisonEnabled,
|
||||
}: {
|
||||
serviceName: string;
|
||||
latencyAggregationType?: LatencyAggregationType;
|
||||
transactionGroupComparisonStatistics?: TransactionGroupComparisonStatistics;
|
||||
transactionGroupDetailedStatistics?: TransactionGroupDetailedStatistics;
|
||||
comparisonEnabled?: boolean;
|
||||
}): Array<EuiBasicTableColumn<ServiceTransactionGroupItem>> {
|
||||
return [
|
||||
|
@ -74,9 +74,9 @@ export function getColumns({
|
|||
width: px(unit * 10),
|
||||
render: (_, { latency, name }) => {
|
||||
const currentTimeseries =
|
||||
transactionGroupComparisonStatistics?.currentPeriod?.[name]?.latency;
|
||||
transactionGroupDetailedStatistics?.currentPeriod?.[name]?.latency;
|
||||
const previousTimeseries =
|
||||
transactionGroupComparisonStatistics?.previousPeriod?.[name]?.latency;
|
||||
transactionGroupDetailedStatistics?.previousPeriod?.[name]?.latency;
|
||||
return (
|
||||
<SparkPlot
|
||||
color="euiColorVis1"
|
||||
|
@ -100,10 +100,9 @@ export function getColumns({
|
|||
width: px(unit * 10),
|
||||
render: (_, { throughput, name }) => {
|
||||
const currentTimeseries =
|
||||
transactionGroupComparisonStatistics?.currentPeriod?.[name]
|
||||
?.throughput;
|
||||
transactionGroupDetailedStatistics?.currentPeriod?.[name]?.throughput;
|
||||
const previousTimeseries =
|
||||
transactionGroupComparisonStatistics?.previousPeriod?.[name]
|
||||
transactionGroupDetailedStatistics?.previousPeriod?.[name]
|
||||
?.throughput;
|
||||
return (
|
||||
<SparkPlot
|
||||
|
@ -128,11 +127,9 @@ export function getColumns({
|
|||
width: px(unit * 8),
|
||||
render: (_, { errorRate, name }) => {
|
||||
const currentTimeseries =
|
||||
transactionGroupComparisonStatistics?.currentPeriod?.[name]
|
||||
?.errorRate;
|
||||
transactionGroupDetailedStatistics?.currentPeriod?.[name]?.errorRate;
|
||||
const previousTimeseries =
|
||||
transactionGroupComparisonStatistics?.previousPeriod?.[name]
|
||||
?.errorRate;
|
||||
transactionGroupDetailedStatistics?.previousPeriod?.[name]?.errorRate;
|
||||
return (
|
||||
<SparkPlot
|
||||
color="euiColorVis7"
|
||||
|
@ -156,10 +153,10 @@ export function getColumns({
|
|||
width: px(unit * 5),
|
||||
render: (_, { name }) => {
|
||||
const currentImpact =
|
||||
transactionGroupComparisonStatistics?.currentPeriod?.[name]?.impact ??
|
||||
transactionGroupDetailedStatistics?.currentPeriod?.[name]?.impact ??
|
||||
0;
|
||||
const previousImpact =
|
||||
transactionGroupComparisonStatistics?.previousPeriod?.[name]?.impact;
|
||||
transactionGroupDetailedStatistics?.previousPeriod?.[name]?.impact;
|
||||
return (
|
||||
<EuiFlexGroup gutterSize="xs" direction="column">
|
||||
<EuiFlexItem>
|
||||
|
|
|
@ -29,7 +29,7 @@ interface Props {
|
|||
serviceName: string;
|
||||
}
|
||||
|
||||
type ApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics'>;
|
||||
type ApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics'>;
|
||||
const INITIAL_STATE = {
|
||||
transactionGroups: [] as ApiResponse['transactionGroups'],
|
||||
isAggregationAccurate: true,
|
||||
|
@ -77,6 +77,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
|
|||
start,
|
||||
end,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const { data = INITIAL_STATE, status } = useFetcher(
|
||||
|
@ -86,7 +87,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
|
|||
}
|
||||
return callApmApi({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics',
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics',
|
||||
params: {
|
||||
path: { serviceName },
|
||||
query: {
|
||||
|
@ -107,14 +108,13 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
|
|||
|
||||
return {
|
||||
...response,
|
||||
// Everytime the primary statistics is refetched, updates the requestId making the comparison API to be refetched.
|
||||
// Everytime the main statistics is refetched, updates the requestId making the detailed API to be refetched.
|
||||
requestId: uuid(),
|
||||
transactionGroupsTotalItems: response.transactionGroups.length,
|
||||
transactionGroups: currentPageTransactionGroups,
|
||||
};
|
||||
});
|
||||
},
|
||||
// comparisonType is listed as dependency even thought it is not used. This is needed to trigger the comparison api when it is changed.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[
|
||||
environment,
|
||||
|
@ -127,15 +127,18 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
|
|||
pageIndex,
|
||||
direction,
|
||||
field,
|
||||
// not used, but needed to trigger an update when comparisonType is changed either manually by user or when time range is changed
|
||||
comparisonType,
|
||||
// not used, but needed to trigger an update when comparison feature is disabled/enabled by user
|
||||
comparisonEnabled,
|
||||
]
|
||||
);
|
||||
|
||||
const { transactionGroups, requestId, transactionGroupsTotalItems } = data;
|
||||
|
||||
const {
|
||||
data: transactionGroupComparisonStatistics,
|
||||
status: transactionGroupComparisonStatisticsStatus,
|
||||
data: transactionGroupDetailedStatistics,
|
||||
status: transactionGroupDetailedStatisticsStatus,
|
||||
} = useFetcher(
|
||||
(callApmApi) => {
|
||||
if (
|
||||
|
@ -147,7 +150,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
|
|||
) {
|
||||
return callApmApi({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics',
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics',
|
||||
params: {
|
||||
path: { serviceName },
|
||||
query: {
|
||||
|
@ -168,7 +171,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
|
|||
});
|
||||
}
|
||||
},
|
||||
// only fetches comparison statistics when requestId is invalidated by primary statistics api call
|
||||
// only fetches detailed statistics when requestId is invalidated by main statistics api call
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[requestId],
|
||||
{ preservePreviousData: false }
|
||||
|
@ -177,13 +180,13 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
|
|||
const columns = getColumns({
|
||||
serviceName,
|
||||
latencyAggregationType,
|
||||
transactionGroupComparisonStatistics,
|
||||
transactionGroupDetailedStatistics,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const isLoading =
|
||||
status === FETCH_STATUS.LOADING ||
|
||||
transactionGroupComparisonStatisticsStatus === FETCH_STATUS.LOADING;
|
||||
transactionGroupDetailedStatisticsStatus === FETCH_STATUS.LOADING;
|
||||
|
||||
const pagination = {
|
||||
pageIndex,
|
||||
|
|
|
@ -9,13 +9,13 @@ import { TooltipInfo } from '@elastic/charts';
|
|||
import React, { ComponentType } from 'react';
|
||||
import { EuiThemeProvider } from '../../../../../../../../src/plugins/kibana_react/common';
|
||||
import { getDurationFormatter } from '../../../../../common/utils/formatters';
|
||||
import { PrimaryStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table';
|
||||
import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table';
|
||||
import { CustomTooltip } from './custom_tooltip';
|
||||
|
||||
function getLatencyFormatter(props: TooltipInfo) {
|
||||
const maxLatency = Math.max(
|
||||
...props.values.map((value) => {
|
||||
const datum = (value.datum as unknown) as PrimaryStatsServiceInstanceItem;
|
||||
const datum = (value.datum as unknown) as MainStatsServiceInstanceItem;
|
||||
return datum.latency ?? 0;
|
||||
})
|
||||
);
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
TimeFormatter,
|
||||
} from '../../../../../common/utils/formatters';
|
||||
import { useTheme } from '../../../../hooks/use_theme';
|
||||
import { PrimaryStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table';
|
||||
import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table';
|
||||
|
||||
const latencyLabel = i18n.translate(
|
||||
'xpack.apm.instancesLatencyDistributionChartTooltipLatencyLabel',
|
||||
|
@ -48,7 +48,7 @@ function SingleInstanceCustomTooltip({
|
|||
}) {
|
||||
const value = values[0];
|
||||
const { color } = value;
|
||||
const datum = (value.datum as unknown) as PrimaryStatsServiceInstanceItem;
|
||||
const datum = (value.datum as unknown) as MainStatsServiceInstanceItem;
|
||||
const { latency, serviceNodeName, throughput } = datum;
|
||||
|
||||
return (
|
||||
|
@ -119,7 +119,7 @@ function MultipleInstanceCustomTooltip({
|
|||
</div>
|
||||
{values.map((value) => {
|
||||
const { color } = value;
|
||||
const datum = (value.datum as unknown) as PrimaryStatsServiceInstanceItem;
|
||||
const datum = (value.datum as unknown) as MainStatsServiceInstanceItem;
|
||||
const { latency, serviceNodeName, throughput } = datum;
|
||||
return (
|
||||
<div className="echTooltip__list" key={serviceNodeName}>
|
||||
|
|
|
@ -30,7 +30,7 @@ import {
|
|||
} from '../../../../../common/utils/formatters';
|
||||
import { FETCH_STATUS } from '../../../../hooks/use_fetcher';
|
||||
import { useTheme } from '../../../../hooks/use_theme';
|
||||
import { PrimaryStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table';
|
||||
import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table';
|
||||
import * as urlHelpers from '../../Links/url_helpers';
|
||||
import { ChartContainer } from '../chart_container';
|
||||
import { getResponseTimeTickFormatter } from '../transaction_charts/helper';
|
||||
|
@ -38,7 +38,7 @@ import { CustomTooltip } from './custom_tooltip';
|
|||
|
||||
export interface InstancesLatencyDistributionChartProps {
|
||||
height: number;
|
||||
items?: PrimaryStatsServiceInstanceItem[];
|
||||
items?: MainStatsServiceInstanceItem[];
|
||||
status: FETCH_STATUS;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ export function TransactionErrorRateChart({
|
|||
start,
|
||||
end,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const { data = INITIAL_STATE, status } = useFetcher(
|
||||
|
|
|
@ -11,12 +11,23 @@ import {
|
|||
|
||||
describe('getTimeRangeComparison', () => {
|
||||
describe('return empty object', () => {
|
||||
it('when comparison is disabled', () => {
|
||||
const end = '2021-01-28T15:00:00.000Z';
|
||||
const result = getTimeRangeComparison({
|
||||
start: undefined,
|
||||
end,
|
||||
comparisonType: TimeRangeComparisonType.DayBefore,
|
||||
comparisonEnabled: false,
|
||||
});
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
it('when start is not defined', () => {
|
||||
const end = '2021-01-28T15:00:00.000Z';
|
||||
const result = getTimeRangeComparison({
|
||||
start: undefined,
|
||||
end,
|
||||
comparisonType: TimeRangeComparisonType.DayBefore,
|
||||
comparisonEnabled: true,
|
||||
});
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
|
@ -27,6 +38,7 @@ describe('getTimeRangeComparison', () => {
|
|||
start,
|
||||
end: undefined,
|
||||
comparisonType: TimeRangeComparisonType.DayBefore,
|
||||
comparisonEnabled: true,
|
||||
});
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
|
@ -39,6 +51,7 @@ describe('getTimeRangeComparison', () => {
|
|||
const end = '2021-01-28T15:00:00.000Z';
|
||||
const result = getTimeRangeComparison({
|
||||
comparisonType: TimeRangeComparisonType.DayBefore,
|
||||
comparisonEnabled: true,
|
||||
start,
|
||||
end,
|
||||
});
|
||||
|
@ -52,6 +65,7 @@ describe('getTimeRangeComparison', () => {
|
|||
const end = '2021-01-28T15:00:00.000Z';
|
||||
const result = getTimeRangeComparison({
|
||||
comparisonType: TimeRangeComparisonType.WeekBefore,
|
||||
comparisonEnabled: true,
|
||||
start,
|
||||
end,
|
||||
});
|
||||
|
@ -67,6 +81,7 @@ describe('getTimeRangeComparison', () => {
|
|||
start,
|
||||
end,
|
||||
comparisonType: TimeRangeComparisonType.PeriodBefore,
|
||||
comparisonEnabled: true,
|
||||
});
|
||||
expect(result).toEqual({
|
||||
comparisonStart: '2021-02-09T14:24:02.174Z',
|
||||
|
@ -83,6 +98,7 @@ describe('getTimeRangeComparison', () => {
|
|||
const end = '2021-01-28T15:00:00.000Z';
|
||||
const result = getTimeRangeComparison({
|
||||
comparisonType: TimeRangeComparisonType.WeekBefore,
|
||||
comparisonEnabled: true,
|
||||
start,
|
||||
end,
|
||||
});
|
||||
|
@ -98,6 +114,7 @@ describe('getTimeRangeComparison', () => {
|
|||
const end = '2021-01-18T15:00:00.000Z';
|
||||
const result = getTimeRangeComparison({
|
||||
comparisonType: TimeRangeComparisonType.PeriodBefore,
|
||||
comparisonEnabled: true,
|
||||
start,
|
||||
end,
|
||||
});
|
||||
|
@ -110,6 +127,7 @@ describe('getTimeRangeComparison', () => {
|
|||
const end = '2021-01-31T15:00:00.000Z';
|
||||
const result = getTimeRangeComparison({
|
||||
comparisonType: TimeRangeComparisonType.PeriodBefore,
|
||||
comparisonEnabled: true,
|
||||
start,
|
||||
end,
|
||||
});
|
||||
|
|
|
@ -39,15 +39,17 @@ const oneDayInMilliseconds = moment.duration(1, 'day').asMilliseconds();
|
|||
const oneWeekInMilliseconds = moment.duration(1, 'week').asMilliseconds();
|
||||
|
||||
export function getTimeRangeComparison({
|
||||
comparisonEnabled,
|
||||
comparisonType,
|
||||
start,
|
||||
end,
|
||||
}: {
|
||||
comparisonEnabled?: boolean;
|
||||
comparisonType?: TimeRangeComparisonType;
|
||||
start?: string;
|
||||
end?: string;
|
||||
}) {
|
||||
if (!comparisonType || !start || !end) {
|
||||
if (!comparisonEnabled || !comparisonType || !start || !end) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -63,10 +63,12 @@ function getSelectOptions({
|
|||
start,
|
||||
end,
|
||||
rangeTo,
|
||||
comparisonEnabled,
|
||||
}: {
|
||||
start?: string;
|
||||
end?: string;
|
||||
rangeTo?: string;
|
||||
comparisonEnabled?: boolean;
|
||||
}) {
|
||||
const momentStart = moment(start);
|
||||
const momentEnd = moment(end);
|
||||
|
@ -112,6 +114,7 @@ function getSelectOptions({
|
|||
comparisonType: TimeRangeComparisonType.PeriodBefore,
|
||||
start,
|
||||
end,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const dateFormat = getDateFormat({
|
||||
|
@ -140,7 +143,12 @@ export function TimeComparison() {
|
|||
urlParams: { start, end, comparisonEnabled, comparisonType, rangeTo },
|
||||
} = useUrlParams();
|
||||
|
||||
const selectOptions = getSelectOptions({ start, end, rangeTo });
|
||||
const selectOptions = getSelectOptions({
|
||||
start,
|
||||
end,
|
||||
rangeTo,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
// Sets default values
|
||||
if (comparisonEnabled === undefined || comparisonType === undefined) {
|
||||
|
|
|
@ -27,6 +27,7 @@ export function useTransactionLatencyChartsFetcher() {
|
|||
transactionName,
|
||||
latencyAggregationType,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
},
|
||||
} = useUrlParams();
|
||||
|
||||
|
@ -34,6 +35,7 @@ export function useTransactionLatencyChartsFetcher() {
|
|||
start,
|
||||
end,
|
||||
comparisonType,
|
||||
comparisonEnabled,
|
||||
});
|
||||
|
||||
const { data, error, status } = useFetcher(
|
||||
|
|
|
@ -22,7 +22,7 @@ import { withApmSpan } from '../../../utils/with_apm_span';
|
|||
import { getBucketSize } from '../../helpers/get_bucket_size';
|
||||
import { Setup, SetupTimeRange } from '../../helpers/setup_request';
|
||||
|
||||
export async function getServiceErrorGroupComparisonStatistics({
|
||||
export async function getServiceErrorGroupDetailedStatistics({
|
||||
kuery,
|
||||
serviceName,
|
||||
setup,
|
||||
|
@ -44,7 +44,7 @@ export async function getServiceErrorGroupComparisonStatistics({
|
|||
end: number;
|
||||
}): Promise<Array<{ groupId: string; timeseries: Coordinate[] }>> {
|
||||
return withApmSpan(
|
||||
'get_service_error_group_comparison_statistics',
|
||||
'get_service_error_group_detailed_statistics',
|
||||
async () => {
|
||||
const { apmEventClient } = setup;
|
||||
|
||||
|
@ -147,7 +147,7 @@ export async function getServiceErrorGroupPeriods({
|
|||
groupIds,
|
||||
};
|
||||
|
||||
const currentPeriodPromise = getServiceErrorGroupComparisonStatistics({
|
||||
const currentPeriodPromise = getServiceErrorGroupDetailedStatistics({
|
||||
...commonProps,
|
||||
start,
|
||||
end,
|
||||
|
@ -155,7 +155,7 @@ export async function getServiceErrorGroupPeriods({
|
|||
|
||||
const previousPeriodPromise =
|
||||
comparisonStart && comparisonEnd
|
||||
? getServiceErrorGroupComparisonStatistics({
|
||||
? getServiceErrorGroupDetailedStatistics({
|
||||
...commonProps,
|
||||
start: comparisonStart,
|
||||
end: comparisonEnd,
|
|
@ -23,7 +23,7 @@ import { withApmSpan } from '../../../utils/with_apm_span';
|
|||
import { getErrorName } from '../../helpers/get_error_name';
|
||||
import { Setup, SetupTimeRange } from '../../helpers/setup_request';
|
||||
|
||||
export function getServiceErrorGroupPrimaryStatistics({
|
||||
export function getServiceErrorGroupMainStatistics({
|
||||
kuery,
|
||||
serviceName,
|
||||
setup,
|
||||
|
@ -36,7 +36,7 @@ export function getServiceErrorGroupPrimaryStatistics({
|
|||
transactionType: string;
|
||||
environment?: string;
|
||||
}) {
|
||||
return withApmSpan('get_service_error_group_primary_statistics', async () => {
|
||||
return withApmSpan('get_service_error_group_main_statistics', async () => {
|
||||
const { apmEventClient, start, end } = setup;
|
||||
|
||||
const response = await apmEventClient.search({
|
|
@ -15,7 +15,7 @@ import { Setup, SetupTimeRange } from '../../helpers/setup_request';
|
|||
import { getServiceInstancesSystemMetricStatistics } from './get_service_instances_system_metric_statistics';
|
||||
import { getServiceInstancesTransactionStatistics } from './get_service_instances_transaction_statistics';
|
||||
|
||||
interface ServiceInstanceComparisonStatisticsParams {
|
||||
interface ServiceInstanceDetailedStatisticsParams {
|
||||
environment?: string;
|
||||
kuery?: string;
|
||||
latencyAggregationType: LatencyAggregationType;
|
||||
|
@ -29,8 +29,8 @@ interface ServiceInstanceComparisonStatisticsParams {
|
|||
serviceNodeIds: string[];
|
||||
}
|
||||
|
||||
async function getServiceInstancesComparisonStatistics(
|
||||
params: ServiceInstanceComparisonStatisticsParams
|
||||
async function getServiceInstancesDetailedStatistics(
|
||||
params: ServiceInstanceDetailedStatisticsParams
|
||||
): Promise<
|
||||
Array<{
|
||||
serviceNodeName: string;
|
||||
|
@ -41,31 +41,28 @@ async function getServiceInstancesComparisonStatistics(
|
|||
memoryUsage?: Coordinate[];
|
||||
}>
|
||||
> {
|
||||
return withApmSpan(
|
||||
'get_service_instances_comparison_statistics',
|
||||
async () => {
|
||||
const [transactionStats, systemMetricStats = []] = await Promise.all([
|
||||
getServiceInstancesTransactionStatistics({
|
||||
...params,
|
||||
isComparisonSearch: true,
|
||||
}),
|
||||
getServiceInstancesSystemMetricStatistics({
|
||||
...params,
|
||||
isComparisonSearch: true,
|
||||
}),
|
||||
]);
|
||||
return withApmSpan('get_service_instances_detailed_statistics', async () => {
|
||||
const [transactionStats, systemMetricStats = []] = await Promise.all([
|
||||
getServiceInstancesTransactionStatistics({
|
||||
...params,
|
||||
isComparisonSearch: true,
|
||||
}),
|
||||
getServiceInstancesSystemMetricStatistics({
|
||||
...params,
|
||||
isComparisonSearch: true,
|
||||
}),
|
||||
]);
|
||||
|
||||
const stats = joinByKey(
|
||||
[...transactionStats, ...systemMetricStats],
|
||||
'serviceNodeName'
|
||||
);
|
||||
const stats = joinByKey(
|
||||
[...transactionStats, ...systemMetricStats],
|
||||
'serviceNodeName'
|
||||
);
|
||||
|
||||
return stats;
|
||||
}
|
||||
);
|
||||
return stats;
|
||||
});
|
||||
}
|
||||
|
||||
export async function getServiceInstancesComparisonStatisticsPeriods({
|
||||
export async function getServiceInstancesDetailedStatisticsPeriods({
|
||||
environment,
|
||||
kuery,
|
||||
latencyAggregationType,
|
||||
|
@ -91,7 +88,7 @@ export async function getServiceInstancesComparisonStatisticsPeriods({
|
|||
comparisonEnd?: number;
|
||||
}) {
|
||||
return withApmSpan(
|
||||
'get_service_instances_comparison_statistics_periods',
|
||||
'get_service_instances_detailed_statistics_periods',
|
||||
async () => {
|
||||
const { start, end } = setup;
|
||||
|
||||
|
@ -107,7 +104,7 @@ export async function getServiceInstancesComparisonStatisticsPeriods({
|
|||
serviceNodeIds,
|
||||
};
|
||||
|
||||
const currentPeriodPromise = getServiceInstancesComparisonStatistics({
|
||||
const currentPeriodPromise = getServiceInstancesDetailedStatistics({
|
||||
...commonParams,
|
||||
start,
|
||||
end,
|
||||
|
@ -115,7 +112,7 @@ export async function getServiceInstancesComparisonStatisticsPeriods({
|
|||
|
||||
const previousPeriodPromise =
|
||||
comparisonStart && comparisonEnd
|
||||
? getServiceInstancesComparisonStatistics({
|
||||
? getServiceInstancesDetailedStatistics({
|
||||
...commonParams,
|
||||
start: comparisonStart,
|
||||
end: comparisonEnd,
|
|
@ -12,7 +12,7 @@ import { Setup, SetupTimeRange } from '../../helpers/setup_request';
|
|||
import { getServiceInstancesSystemMetricStatistics } from './get_service_instances_system_metric_statistics';
|
||||
import { getServiceInstancesTransactionStatistics } from './get_service_instances_transaction_statistics';
|
||||
|
||||
interface ServiceInstancePrimaryStatisticsParams {
|
||||
interface ServiceInstanceMainStatisticsParams {
|
||||
environment?: string;
|
||||
kuery?: string;
|
||||
latencyAggregationType: LatencyAggregationType;
|
||||
|
@ -25,8 +25,8 @@ interface ServiceInstancePrimaryStatisticsParams {
|
|||
end: number;
|
||||
}
|
||||
|
||||
export async function getServiceInstancesPrimaryStatistics(
|
||||
params: Omit<ServiceInstancePrimaryStatisticsParams, 'size'>
|
||||
export async function getServiceInstancesMainStatistics(
|
||||
params: Omit<ServiceInstanceMainStatisticsParams, 'size'>
|
||||
): Promise<
|
||||
Array<{
|
||||
serviceNodeName: string;
|
||||
|
@ -37,7 +37,7 @@ export async function getServiceInstancesPrimaryStatistics(
|
|||
memoryUsage?: number | null;
|
||||
}>
|
||||
> {
|
||||
return withApmSpan('get_service_instances_primary_statistics', async () => {
|
||||
return withApmSpan('get_service_instances_main_statistics', async () => {
|
||||
const paramsForSubQueries = {
|
||||
...params,
|
||||
size: 50,
|
|
@ -35,7 +35,7 @@ import {
|
|||
import { Setup, SetupTimeRange } from '../helpers/setup_request';
|
||||
import { calculateTransactionErrorPercentage } from '../helpers/transaction_error_rate';
|
||||
|
||||
export async function getServiceTransactionGroupComparisonStatistics({
|
||||
export async function getServiceTransactionGroupDetailedStatistics({
|
||||
environment,
|
||||
kuery,
|
||||
serviceName,
|
||||
|
@ -69,7 +69,7 @@ export async function getServiceTransactionGroupComparisonStatistics({
|
|||
}>
|
||||
> {
|
||||
return withApmSpan(
|
||||
'get_service_transaction_group_comparison_statistics',
|
||||
'get_service_transaction_group_detailed_statistics',
|
||||
async () => {
|
||||
const { apmEventClient } = setup;
|
||||
const { intervalString } = getBucketSize({ start, end, numBuckets });
|
||||
|
@ -185,7 +185,7 @@ export async function getServiceTransactionGroupComparisonStatistics({
|
|||
);
|
||||
}
|
||||
|
||||
export async function getServiceTransactionGroupComparisonStatisticsPeriods({
|
||||
export async function getServiceTransactionGroupDetailedStatisticsPeriods({
|
||||
serviceName,
|
||||
transactionNames,
|
||||
setup,
|
||||
|
@ -224,7 +224,7 @@ export async function getServiceTransactionGroupComparisonStatisticsPeriods({
|
|||
kuery,
|
||||
};
|
||||
|
||||
const currentPeriodPromise = getServiceTransactionGroupComparisonStatistics({
|
||||
const currentPeriodPromise = getServiceTransactionGroupDetailedStatistics({
|
||||
...commonProps,
|
||||
start,
|
||||
end,
|
||||
|
@ -232,7 +232,7 @@ export async function getServiceTransactionGroupComparisonStatisticsPeriods({
|
|||
|
||||
const previousPeriodPromise =
|
||||
comparisonStart && comparisonEnd
|
||||
? getServiceTransactionGroupComparisonStatistics({
|
||||
? getServiceTransactionGroupDetailedStatistics({
|
||||
...commonProps,
|
||||
start: comparisonStart,
|
||||
end: comparisonEnd,
|
|
@ -17,10 +17,10 @@ import { getServiceAnnotations } from '../lib/services/annotations';
|
|||
import { getServices } from '../lib/services/get_services';
|
||||
import { getServiceAgentName } from '../lib/services/get_service_agent_name';
|
||||
import { getServiceDependencies } from '../lib/services/get_service_dependencies';
|
||||
import { getServiceErrorGroupPeriods } from '../lib/services/get_service_error_groups/get_service_error_group_comparison_statistics';
|
||||
import { getServiceErrorGroupPrimaryStatistics } from '../lib/services/get_service_error_groups/get_service_error_group_primary_statistics';
|
||||
import { getServiceInstancesComparisonStatisticsPeriods } from '../lib/services/get_service_instances/comparison_statistics';
|
||||
import { getServiceInstancesPrimaryStatistics } from '../lib/services/get_service_instances/primary_statistics';
|
||||
import { getServiceErrorGroupPeriods } from '../lib/services/get_service_error_groups/get_service_error_group_detailed_statistics';
|
||||
import { getServiceErrorGroupMainStatistics } from '../lib/services/get_service_error_groups/get_service_error_group_main_statistics';
|
||||
import { getServiceInstancesDetailedStatisticsPeriods } from '../lib/services/get_service_instances/detailed_statistics';
|
||||
import { getServiceInstancesMainStatistics } from '../lib/services/get_service_instances/main_statistics';
|
||||
import { getServiceMetadataDetails } from '../lib/services/get_service_metadata_details';
|
||||
import { getServiceMetadataIcons } from '../lib/services/get_service_metadata_icons';
|
||||
import { getServiceNodeMetadata } from '../lib/services/get_service_node_metadata';
|
||||
|
@ -292,9 +292,8 @@ const serviceAnnotationsCreateRoute = createApmServerRoute({
|
|||
},
|
||||
});
|
||||
|
||||
const serviceErrorGroupsPrimaryStatisticsRoute = createApmServerRoute({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/error_groups/primary_statistics',
|
||||
const serviceErrorGroupsMainStatisticsRoute = createApmServerRoute({
|
||||
endpoint: 'GET /api/apm/services/{serviceName}/error_groups/main_statistics',
|
||||
params: t.type({
|
||||
path: t.type({
|
||||
serviceName: t.string,
|
||||
|
@ -317,7 +316,7 @@ const serviceErrorGroupsPrimaryStatisticsRoute = createApmServerRoute({
|
|||
path: { serviceName },
|
||||
query: { kuery, transactionType, environment },
|
||||
} = params;
|
||||
return getServiceErrorGroupPrimaryStatistics({
|
||||
return getServiceErrorGroupMainStatistics({
|
||||
kuery,
|
||||
serviceName,
|
||||
setup,
|
||||
|
@ -327,9 +326,9 @@ const serviceErrorGroupsPrimaryStatisticsRoute = createApmServerRoute({
|
|||
},
|
||||
});
|
||||
|
||||
const serviceErrorGroupsComparisonStatisticsRoute = createApmServerRoute({
|
||||
const serviceErrorGroupsDetailedStatisticsRoute = createApmServerRoute({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics',
|
||||
'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics',
|
||||
params: t.type({
|
||||
path: t.type({
|
||||
serviceName: t.string,
|
||||
|
@ -444,9 +443,9 @@ const serviceThroughputRoute = createApmServerRoute({
|
|||
},
|
||||
});
|
||||
|
||||
const serviceInstancesPrimaryStatisticsRoute = createApmServerRoute({
|
||||
const serviceInstancesMainStatisticsRoute = createApmServerRoute({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics',
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics',
|
||||
params: t.type({
|
||||
path: t.type({
|
||||
serviceName: t.string,
|
||||
|
@ -479,7 +478,7 @@ const serviceInstancesPrimaryStatisticsRoute = createApmServerRoute({
|
|||
|
||||
const { start, end } = setup;
|
||||
|
||||
const serviceInstances = await getServiceInstancesPrimaryStatistics({
|
||||
const serviceInstances = await getServiceInstancesMainStatistics({
|
||||
environment,
|
||||
kuery,
|
||||
latencyAggregationType,
|
||||
|
@ -495,9 +494,9 @@ const serviceInstancesPrimaryStatisticsRoute = createApmServerRoute({
|
|||
},
|
||||
});
|
||||
|
||||
const serviceInstancesComparisonStatisticsRoute = createApmServerRoute({
|
||||
const serviceInstancesDetailedStatisticsRoute = createApmServerRoute({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics',
|
||||
'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics',
|
||||
params: t.type({
|
||||
path: t.type({
|
||||
serviceName: t.string,
|
||||
|
@ -535,7 +534,7 @@ const serviceInstancesComparisonStatisticsRoute = createApmServerRoute({
|
|||
setup
|
||||
);
|
||||
|
||||
return getServiceInstancesComparisonStatisticsPeriods({
|
||||
return getServiceInstancesDetailedStatisticsPeriods({
|
||||
environment,
|
||||
kuery,
|
||||
latencyAggregationType,
|
||||
|
@ -671,11 +670,11 @@ export const serviceRouteRepository = createApmServerRouteRepository()
|
|||
.add(serviceNodeMetadataRoute)
|
||||
.add(serviceAnnotationsRoute)
|
||||
.add(serviceAnnotationsCreateRoute)
|
||||
.add(serviceErrorGroupsPrimaryStatisticsRoute)
|
||||
.add(serviceErrorGroupsComparisonStatisticsRoute)
|
||||
.add(serviceErrorGroupsMainStatisticsRoute)
|
||||
.add(serviceErrorGroupsDetailedStatisticsRoute)
|
||||
.add(serviceThroughputRoute)
|
||||
.add(serviceInstancesPrimaryStatisticsRoute)
|
||||
.add(serviceInstancesComparisonStatisticsRoute)
|
||||
.add(serviceInstancesMainStatisticsRoute)
|
||||
.add(serviceInstancesDetailedStatisticsRoute)
|
||||
.add(serviceDependenciesRoute)
|
||||
.add(serviceProfilingTimelineRoute)
|
||||
.add(serviceProfilingStatisticsRoute);
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
|
||||
import { setupRequest } from '../lib/helpers/setup_request';
|
||||
import { getServiceTransactionGroups } from '../lib/services/get_service_transaction_groups';
|
||||
import { getServiceTransactionGroupComparisonStatisticsPeriods } from '../lib/services/get_service_transaction_group_comparison_statistics';
|
||||
import { getServiceTransactionGroupDetailedStatisticsPeriods } from '../lib/services/get_service_transaction_group_detailed_statistics';
|
||||
import { getTransactionBreakdown } from '../lib/transactions/breakdown';
|
||||
import { getTransactionDistribution } from '../lib/transactions/distribution';
|
||||
import { getAnomalySeries } from '../lib/transactions/get_anomaly_data';
|
||||
|
@ -34,7 +34,7 @@ import {
|
|||
|
||||
/**
|
||||
* Returns a list of transactions grouped by name
|
||||
* //TODO: delete this once we moved away from the old table in the transaction overview page. It should be replaced by /transactions/groups/primary_statistics/
|
||||
* //TODO: delete this once we moved away from the old table in the transaction overview page. It should be replaced by /transactions/groups/main_statistics/
|
||||
*/
|
||||
const transactionGroupsRoute = createApmServerRoute({
|
||||
endpoint: 'GET /api/apm/services/{serviceName}/transactions/groups',
|
||||
|
@ -74,9 +74,9 @@ const transactionGroupsRoute = createApmServerRoute({
|
|||
},
|
||||
});
|
||||
|
||||
const transactionGroupsPrimaryStatisticsRoute = createApmServerRoute({
|
||||
const transactionGroupsMainStatisticsRoute = createApmServerRoute({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics',
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics',
|
||||
params: t.type({
|
||||
path: t.type({ serviceName: t.string }),
|
||||
query: t.intersection([
|
||||
|
@ -117,9 +117,9 @@ const transactionGroupsPrimaryStatisticsRoute = createApmServerRoute({
|
|||
},
|
||||
});
|
||||
|
||||
const transactionGroupsComparisonStatisticsRoute = createApmServerRoute({
|
||||
const transactionGroupsDetailedStatisticsRoute = createApmServerRoute({
|
||||
endpoint:
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics',
|
||||
'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics',
|
||||
params: t.type({
|
||||
path: t.type({ serviceName: t.string }),
|
||||
query: t.intersection([
|
||||
|
@ -161,7 +161,7 @@ const transactionGroupsComparisonStatisticsRoute = createApmServerRoute({
|
|||
},
|
||||
} = params;
|
||||
|
||||
return await getServiceTransactionGroupComparisonStatisticsPeriods({
|
||||
return await getServiceTransactionGroupDetailedStatisticsPeriods({
|
||||
environment,
|
||||
kuery,
|
||||
setup,
|
||||
|
@ -431,8 +431,8 @@ const transactionChartsErrorRateRoute = createApmServerRoute({
|
|||
|
||||
export const transactionRouteRepository = createApmServerRouteRepository()
|
||||
.add(transactionGroupsRoute)
|
||||
.add(transactionGroupsPrimaryStatisticsRoute)
|
||||
.add(transactionGroupsComparisonStatisticsRoute)
|
||||
.add(transactionGroupsMainStatisticsRoute)
|
||||
.add(transactionGroupsDetailedStatisticsRoute)
|
||||
.add(transactionLatencyChartsRoute)
|
||||
.add(transactionThroughputChartsRoute)
|
||||
.add(transactionChartsDistributionRoute)
|
||||
|
|
|
@ -65,12 +65,12 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte
|
|||
loadTestFile(require.resolve('./service_overview/dependencies'));
|
||||
});
|
||||
|
||||
describe('service_overview/instances_primary_statistics', function () {
|
||||
loadTestFile(require.resolve('./service_overview/instances_primary_statistics'));
|
||||
describe('service_overview/instances_main_statistics', function () {
|
||||
loadTestFile(require.resolve('./service_overview/instances_main_statistics'));
|
||||
});
|
||||
|
||||
describe('service_overview/instances_comparison_statistics', function () {
|
||||
loadTestFile(require.resolve('./service_overview/instances_comparison_statistics'));
|
||||
describe('service_overview/instances_detailed_statistics', function () {
|
||||
loadTestFile(require.resolve('./service_overview/instances_detailed_statistics'));
|
||||
});
|
||||
|
||||
// Services
|
||||
|
@ -102,12 +102,12 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte
|
|||
loadTestFile(require.resolve('./services/transaction_types'));
|
||||
});
|
||||
|
||||
describe('services/error_groups_primary_statistics', function () {
|
||||
loadTestFile(require.resolve('./services/error_groups_primary_statistics'));
|
||||
describe('services/error_groups_main_statistics', function () {
|
||||
loadTestFile(require.resolve('./services/error_groups_main_statistics'));
|
||||
});
|
||||
|
||||
describe('services/error_groups_comparison_statistics', function () {
|
||||
loadTestFile(require.resolve('./services/error_groups_comparison_statistics'));
|
||||
describe('services/error_groups_detailed_statistics', function () {
|
||||
loadTestFile(require.resolve('./services/error_groups_detailed_statistics'));
|
||||
});
|
||||
|
||||
// Settinges
|
||||
|
@ -165,12 +165,12 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte
|
|||
loadTestFile(require.resolve('./transactions/top_transaction_groups'));
|
||||
});
|
||||
|
||||
describe('transactions/transactions_groups_primary_statistics', function () {
|
||||
loadTestFile(require.resolve('./transactions/transactions_groups_primary_statistics'));
|
||||
describe('transactions/transactions_groups_main_statistics', function () {
|
||||
loadTestFile(require.resolve('./transactions/transactions_groups_main_statistics'));
|
||||
});
|
||||
|
||||
describe('transactions/transactions_groups_comparison_statistics', function () {
|
||||
loadTestFile(require.resolve('./transactions/transactions_groups_comparison_statistics'));
|
||||
describe('transactions/transactions_groups_detailed_statistics', function () {
|
||||
loadTestFile(require.resolve('./transactions/transactions_groups_detailed_statistics'));
|
||||
});
|
||||
|
||||
// feature control
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Service overview instances comparison statistics when data is loaded fetching data with comparison returns the right data for current and previous periods 5`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data with comparison returns the right data for current and previous periods 5`] = `
|
||||
Object {
|
||||
"currentPeriod": Object {
|
||||
"02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c": Object {
|
||||
|
@ -675,7 +675,7 @@ Object {
|
|||
}
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Service overview instances comparison statistics when data is loaded fetching data without comparison returns the right data 3`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data without comparison returns the right data 3`] = `
|
||||
Object {
|
||||
"currentPeriod": Object {
|
||||
"02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c": Object {
|
|
@ -24,18 +24,18 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
|
||||
interface Response {
|
||||
status: number;
|
||||
body: APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>;
|
||||
body: APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>;
|
||||
}
|
||||
|
||||
registry.when(
|
||||
'Service overview instances comparison statistics when data is not loaded',
|
||||
'Service overview instances detailed statistics when data is not loaded',
|
||||
{ config: 'basic', archives: [] },
|
||||
() => {
|
||||
describe('when data is not loaded', () => {
|
||||
it('handles the empty state', async () => {
|
||||
const response: Response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/service_overview_instances/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/service_overview_instances/detailed_statistics`,
|
||||
query: {
|
||||
latencyAggregationType: 'avg',
|
||||
start,
|
||||
|
@ -55,7 +55,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
registry.when(
|
||||
'Service overview instances comparison statistics when data is loaded',
|
||||
'Service overview instances detailed statistics when data is loaded',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
describe('fetching data without comparison', () => {
|
||||
|
@ -64,7 +64,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
beforeEach(async () => {
|
||||
response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/service_overview_instances/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/service_overview_instances/detailed_statistics`,
|
||||
query: {
|
||||
latencyAggregationType: 'avg',
|
||||
start,
|
||||
|
@ -111,7 +111,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
beforeEach(async () => {
|
||||
response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/service_overview_instances/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/service_overview_instances/detailed_statistics`,
|
||||
query: {
|
||||
latencyAggregationType: 'avg',
|
||||
numBuckets: 20,
|
|
@ -22,13 +22,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const { start, end } = archives[archiveName];
|
||||
|
||||
registry.when(
|
||||
'Service overview instances primary statistics when data is not loaded',
|
||||
'Service overview instances main statistics when data is not loaded',
|
||||
{ config: 'basic', archives: [] },
|
||||
() => {
|
||||
describe('when data is not loaded', () => {
|
||||
it('handles the empty state', async () => {
|
||||
const response = await apmApiSupertest({
|
||||
endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`,
|
||||
endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`,
|
||||
params: {
|
||||
path: { serviceName: 'opbeans-java' },
|
||||
query: {
|
||||
|
@ -48,17 +48,17 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
registry.when(
|
||||
'Service overview instances primary statistics when data is loaded',
|
||||
'Service overview instances main statistics when data is loaded',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
describe('fetching java data', () => {
|
||||
let response: {
|
||||
body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`>;
|
||||
body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`>;
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
response = await apmApiSupertest({
|
||||
endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`,
|
||||
endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`,
|
||||
params: {
|
||||
path: { serviceName: 'opbeans-java' },
|
||||
query: {
|
||||
|
@ -122,12 +122,12 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
|
||||
describe('fetching non-java data', () => {
|
||||
let response: {
|
||||
body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`>;
|
||||
body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`>;
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
response = await apmApiSupertest({
|
||||
endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`,
|
||||
endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`,
|
||||
params: {
|
||||
path: { serviceName: 'opbeans-ruby' },
|
||||
query: {
|
|
@ -1,6 +1,6 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Error groups comparison statistics when data is loaded returns the correct data 1`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Error groups detailed statistics when data is loaded returns the correct data 1`] = `
|
||||
Object {
|
||||
"groupId": "051f95eabf120ebe2f8b0399fe3e54c5",
|
||||
"timeseries": Array [
|
||||
|
@ -132,7 +132,7 @@ Object {
|
|||
}
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Error groups comparison statistics when data is loaded with previous data returns the correct data returns correct timeseries 1`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Error groups detailed statistics when data is loaded with previous data returns the correct data returns correct timeseries 1`] = `
|
||||
Object {
|
||||
"groupId": "051f95eabf120ebe2f8b0399fe3e54c5",
|
||||
"timeseries": Array [
|
|
@ -13,7 +13,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context';
|
|||
import { registry } from '../../common/registry';
|
||||
import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi';
|
||||
|
||||
type ErrorGroupsComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics'>;
|
||||
type ErrorGroupsDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics'>;
|
||||
|
||||
export default function ApiTest({ getService }: FtrProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
|
@ -30,13 +30,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
];
|
||||
|
||||
registry.when(
|
||||
'Error groups comparison statistics when data is not loaded',
|
||||
'Error groups detailed statistics when data is not loaded',
|
||||
{ config: 'basic', archives: [] },
|
||||
() => {
|
||||
it('handles empty state', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -54,13 +54,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
registry.when(
|
||||
'Error groups comparison statistics when data is loaded',
|
||||
'Error groups detailed statistics when data is loaded',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
it('returns the correct data', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -73,7 +73,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
|
||||
expect(response.status).to.be(200);
|
||||
|
||||
const errorGroupsComparisonStatistics = response.body as ErrorGroupsComparisonStatistics;
|
||||
const errorGroupsComparisonStatistics = response.body as ErrorGroupsDetailedStatistics;
|
||||
expect(Object.keys(errorGroupsComparisonStatistics.currentPeriod).sort()).to.eql(
|
||||
groupIds.sort()
|
||||
);
|
||||
|
@ -93,7 +93,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
it('returns an empty state when requested groupIds are not available in the given time range', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -111,18 +111,18 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
registry.when(
|
||||
'Error groups comparison statistics when data is loaded with previous data',
|
||||
'Error groups detailed statistics when data is loaded with previous data',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
describe('returns the correct data', async () => {
|
||||
let response: {
|
||||
status: number;
|
||||
body: ErrorGroupsComparisonStatistics;
|
||||
body: ErrorGroupsDetailedStatistics;
|
||||
};
|
||||
before(async () => {
|
||||
response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`,
|
||||
query: {
|
||||
numBuckets: 20,
|
||||
transactionType: 'request',
|
||||
|
@ -139,7 +139,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
it('returns correct timeseries', () => {
|
||||
const errorGroupsComparisonStatistics = response.body as ErrorGroupsComparisonStatistics;
|
||||
const errorGroupsComparisonStatistics = response.body as ErrorGroupsDetailedStatistics;
|
||||
const errorgroupsComparisonStatistics =
|
||||
errorGroupsComparisonStatistics.currentPeriod[groupIds[0]];
|
||||
expect(
|
||||
|
@ -149,7 +149,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
it('matches x-axis on current period and previous period', () => {
|
||||
const errorGroupsComparisonStatistics = response.body as ErrorGroupsComparisonStatistics;
|
||||
const errorGroupsComparisonStatistics = response.body as ErrorGroupsDetailedStatistics;
|
||||
|
||||
const currentPeriodItems = Object.values(errorGroupsComparisonStatistics.currentPeriod);
|
||||
const previousPeriodItems = Object.values(errorGroupsComparisonStatistics.previousPeriod);
|
||||
|
@ -166,7 +166,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
it('returns an empty state when requested groupIds are not available in the given time range', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`,
|
||||
query: {
|
||||
numBuckets: 20,
|
||||
transactionType: 'request',
|
|
@ -12,7 +12,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context';
|
|||
import { registry } from '../../common/registry';
|
||||
import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi';
|
||||
|
||||
type ErrorGroupsPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/primary_statistics'>;
|
||||
type ErrorGroupsMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/main_statistics'>;
|
||||
|
||||
export default function ApiTest({ getService }: FtrProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
|
@ -22,13 +22,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const { start, end } = metadata;
|
||||
|
||||
registry.when(
|
||||
'Error groups primary statistics when data is not loaded',
|
||||
'Error groups main statistics when data is not loaded',
|
||||
{ config: 'basic', archives: [] },
|
||||
() => {
|
||||
it('handles empty state', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/primary_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/main_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -47,13 +47,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
registry.when(
|
||||
'Error groups primary statistics when data is loaded',
|
||||
'Error groups main statistics when data is loaded',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
it('returns the correct data', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/primary_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/error_groups/main_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -65,12 +65,12 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
|
||||
expect(response.status).to.be(200);
|
||||
|
||||
const errorGroupPrimaryStatistics = response.body as ErrorGroupsPrimaryStatistics;
|
||||
const errorGroupMainStatistics = response.body as ErrorGroupsMainStatistics;
|
||||
|
||||
expect(errorGroupPrimaryStatistics.is_aggregation_accurate).to.eql(true);
|
||||
expect(errorGroupPrimaryStatistics.error_groups.length).to.be.greaterThan(0);
|
||||
expect(errorGroupMainStatistics.is_aggregation_accurate).to.eql(true);
|
||||
expect(errorGroupMainStatistics.error_groups.length).to.be.greaterThan(0);
|
||||
|
||||
expectSnapshot(errorGroupPrimaryStatistics.error_groups.map(({ name }) => name))
|
||||
expectSnapshot(errorGroupMainStatistics.error_groups.map(({ name }) => name))
|
||||
.toMatchInline(`
|
||||
Array [
|
||||
"Could not write JSON: Null return value from advice does not match primitive return type for: public abstract double co.elastic.apm.opbeans.repositories.Numbers.getRevenue(); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Null return value from advice does not match primitive return type for: public abstract double co.elastic.apm.opbeans.repositories.Numbers.getRevenue() (through reference chain: co.elastic.apm.opbeans.repositories.Stats[\\"numbers\\"]->com.sun.proxy.$Proxy132[\\"revenue\\"])",
|
||||
|
@ -81,7 +81,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
]
|
||||
`);
|
||||
|
||||
const occurences = errorGroupPrimaryStatistics.error_groups.map(
|
||||
const occurences = errorGroupMainStatistics.error_groups.map(
|
||||
({ occurrences }) => occurrences
|
||||
);
|
||||
|
||||
|
@ -97,7 +97,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
]
|
||||
`);
|
||||
|
||||
const firstItem = errorGroupPrimaryStatistics.error_groups[0];
|
||||
const firstItem = errorGroupMainStatistics.error_groups[0];
|
||||
|
||||
expectSnapshot(firstItem).toMatchInline(`
|
||||
Object {
|
|
@ -1,6 +1,6 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct error rate data 1`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct error rate data 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607436720000,
|
||||
|
@ -69,7 +69,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct error rate data 2`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct error rate data 2`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607436720000,
|
||||
|
@ -138,7 +138,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct latency data 1`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct latency data 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607436720000,
|
||||
|
@ -207,7 +207,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct latency data 2`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct latency data 2`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607436720000,
|
||||
|
@ -276,7 +276,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct throughput data 1`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct throughput data 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607436720000,
|
||||
|
@ -345,7 +345,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct throughput data 2`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct throughput data 2`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607436720000,
|
||||
|
@ -414,7 +414,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data 1`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607435820000,
|
||||
|
@ -543,7 +543,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data 2`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 2`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607435820000,
|
||||
|
@ -672,7 +672,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data 3`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 3`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607435820000,
|
||||
|
@ -801,7 +801,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data for latency aggregation 99th percentile 1`] = `
|
||||
exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data for latency aggregation 99th percentile 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"x": 1607435820000,
|
|
@ -15,7 +15,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context';
|
|||
import { registry } from '../../common/registry';
|
||||
import { removeEmptyCoordinates, roundNumber } from '../../utils';
|
||||
|
||||
type TransactionsGroupsComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics'>;
|
||||
type TransactionsGroupsDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics'>;
|
||||
|
||||
export default function ApiTest({ getService }: FtrProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
|
@ -25,13 +25,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const transactionNames = ['DispatcherServlet#doGet', 'APIRestController#customers'];
|
||||
|
||||
registry.when(
|
||||
'Transaction groups comparison statistics when data is not loaded',
|
||||
'Transaction groups detailed statistics when data is not loaded',
|
||||
{ config: 'basic', archives: [] },
|
||||
() => {
|
||||
it('handles the empty state', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -50,13 +50,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
registry.when(
|
||||
'Transaction groups comparison statistics when data is loaded',
|
||||
'Transaction groups detailed statistics when data is loaded',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
it('returns the correct data', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -73,7 +73,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const {
|
||||
currentPeriod,
|
||||
previousPeriod,
|
||||
} = response.body as TransactionsGroupsComparisonStatistics;
|
||||
} = response.body as TransactionsGroupsDetailedStatistics;
|
||||
|
||||
expect(Object.keys(currentPeriod).sort()).to.be.eql(transactionNames.sort());
|
||||
|
||||
|
@ -110,7 +110,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
it('returns the correct data for latency aggregation 99th percentile', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -127,7 +127,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const {
|
||||
currentPeriod,
|
||||
previousPeriod,
|
||||
} = response.body as TransactionsGroupsComparisonStatistics;
|
||||
} = response.body as TransactionsGroupsDetailedStatistics;
|
||||
|
||||
expect(Object.keys(currentPeriod).sort()).to.be.eql(transactionNames.sort());
|
||||
|
||||
|
@ -158,7 +158,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
it('returns empty when transaction name is not found', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -175,12 +175,12 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
describe('returns data with previous period', async () => {
|
||||
let currentPeriod: TransactionsGroupsComparisonStatistics['currentPeriod'];
|
||||
let previousPeriod: TransactionsGroupsComparisonStatistics['previousPeriod'];
|
||||
let currentPeriod: TransactionsGroupsDetailedStatistics['currentPeriod'];
|
||||
let previousPeriod: TransactionsGroupsDetailedStatistics['previousPeriod'];
|
||||
before(async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`,
|
||||
query: {
|
||||
numBuckets: 20,
|
||||
transactionType: 'request',
|
|
@ -13,7 +13,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context';
|
|||
import archives from '../../common/fixtures/es_archiver/archives_metadata';
|
||||
import { registry } from '../../common/registry';
|
||||
|
||||
type TransactionsGroupsPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics'>;
|
||||
type TransactionsGroupsPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics'>;
|
||||
|
||||
export default function ApiTest({ getService }: FtrProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
|
@ -22,13 +22,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const { start, end } = archives[archiveName];
|
||||
|
||||
registry.when(
|
||||
'Transaction groups primary statistics when data is not loaded',
|
||||
'Transaction groups main statistics when data is not loaded',
|
||||
{ config: 'basic', archives: [] },
|
||||
() => {
|
||||
it('handles the empty state', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/primary_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/main_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -47,13 +47,13 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
registry.when(
|
||||
'Transaction groups primary statistics when data is loaded',
|
||||
'Transaction groups main statistics when data is loaded',
|
||||
{ config: 'basic', archives: [archiveName] },
|
||||
() => {
|
||||
it('returns the correct data', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/primary_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/main_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
||||
|
@ -125,7 +125,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
it('returns the correct data for latency aggregation 99th percentile', async () => {
|
||||
const response = await supertest.get(
|
||||
url.format({
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/primary_statistics`,
|
||||
pathname: `/api/apm/services/opbeans-java/transactions/groups/main_statistics`,
|
||||
query: {
|
||||
start,
|
||||
end,
|
Loading…
Reference in a new issue