Skip to content

Commit

Permalink
Remove unused ui filters endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
smith committed Jan 29, 2021
1 parent beda9a8 commit 8088f13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 160 deletions.
16 changes: 1 addition & 15 deletions x-pack/plugins/apm/server/routes/create_apm_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,8 @@ import {
transactionThroughputChatsRoute,
} from './transactions';
import {
errorGroupsLocalFiltersRoute,
metricsLocalFiltersRoute,
servicesLocalFiltersRoute,
tracesLocalFiltersRoute,
transactionGroupsLocalFiltersRoute,
transactionsLocalFiltersRoute,
serviceNodesLocalFiltersRoute,
uiFiltersEnvironmentsRoute,
rumOverviewLocalFiltersRoute,
uiFiltersEnvironmentsRoute,
} from './ui_filters';
import { serviceMapRoute, serviceMapServiceNodeRoute } from './service_map';
import {
Expand Down Expand Up @@ -174,13 +167,6 @@ const createApmApi = () => {
.add(transactionThroughputChatsRoute)

// UI filters
.add(errorGroupsLocalFiltersRoute)
.add(metricsLocalFiltersRoute)
.add(servicesLocalFiltersRoute)
.add(tracesLocalFiltersRoute)
.add(transactionGroupsLocalFiltersRoute)
.add(transactionsLocalFiltersRoute)
.add(serviceNodesLocalFiltersRoute)
.add(uiFiltersEnvironmentsRoute)

// Service map
Expand Down
154 changes: 9 additions & 145 deletions x-pack/plugins/apm/server/routes/ui_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,23 @@

import * as t from 'io-ts';
import { omit } from 'lodash';
import { jsonRt } from '../../common/runtime_types/json_rt';
import { LocalUIFilterName } from '../../common/ui_filter';
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
import { getEsFilter } from '../lib/helpers/convert_ui_filters/get_es_filter';
import {
setupRequest,
Setup,
setupRequest,
SetupTimeRange,
} from '../lib/helpers/setup_request';
import { getEnvironments } from '../lib/ui_filters/get_environments';
import { Projection } from '../projections/typings';
import { localUIFilterNames } from '../lib/ui_filters/local_ui_filters/config';
import { getEsFilter } from '../lib/helpers/convert_ui_filters/get_es_filter';
import { getLocalUIFilters } from '../lib/ui_filters/local_ui_filters';
import { getServicesProjection } from '../projections/services';
import { getTransactionGroupsProjection } from '../projections/transaction_groups';
import { getMetricsProjection } from '../projections/metrics';
import { getErrorGroupsProjection } from '../projections/errors';
import { getTransactionsProjection } from '../projections/transactions';
import { createRoute } from './create_route';
import { uiFiltersRt, rangeRt } from './default_api_types';
import { jsonRt } from '../../common/runtime_types/json_rt';
import { getServiceNodesProjection } from '../projections/service_nodes';
import { localUIFilterNames } from '../lib/ui_filters/local_ui_filters/config';
import { getRumPageLoadTransactionsProjection } from '../projections/rum_page_load_transactions';
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
import { Projection } from '../projections/typings';
import { createRoute } from './create_route';
import { rangeRt, uiFiltersRt } from './default_api_types';
import { APMRequestHandlerContext } from './typings';
import { LocalUIFilterName } from '../../common/ui_filter';

export const uiFiltersEnvironmentsRoute = createRoute({
endpoint: 'GET /api/apm/ui_filters/environments',
Expand Down Expand Up @@ -121,136 +115,6 @@ function createLocalFiltersRoute<
});
}

export const servicesLocalFiltersRoute = createLocalFiltersRoute({
endpoint: `GET /api/apm/ui_filters/local_filters/services`,
getProjection: async ({ context, setup }) => {
const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);

return getServicesProjection({ setup, searchAggregatedTransactions });
},
queryRt: t.type({}),
});

export const transactionGroupsLocalFiltersRoute = createLocalFiltersRoute({
endpoint: 'GET /api/apm/ui_filters/local_filters/transactionGroups',
getProjection: async ({ context, setup, query }) => {
const { transactionType, serviceName, transactionName } = query;

const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);

return getTransactionGroupsProjection({
setup,
options: {
type: 'top_transactions',
transactionType,
serviceName,
transactionName,
searchAggregatedTransactions,
},
});
},
queryRt: t.intersection([
t.type({
serviceName: t.string,
transactionType: t.string,
}),
t.partial({
transactionName: t.string,
}),
]),
});

export const tracesLocalFiltersRoute = createLocalFiltersRoute({
endpoint: 'GET /api/apm/ui_filters/local_filters/traces',
getProjection: async ({ setup, context }) => {
const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);

return getTransactionGroupsProjection({
setup,
options: { type: 'top_traces', searchAggregatedTransactions },
});
},
queryRt: t.type({}),
});

export const transactionsLocalFiltersRoute = createLocalFiltersRoute({
endpoint: 'GET /api/apm/ui_filters/local_filters/transactions',
getProjection: async ({ context, setup, query }) => {
const { transactionType, serviceName, transactionName } = query;

const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);

return getTransactionsProjection({
setup,
transactionType,
serviceName,
transactionName,
searchAggregatedTransactions,
});
},
queryRt: t.type({
transactionType: t.string,
transactionName: t.string,
serviceName: t.string,
}),
});

export const metricsLocalFiltersRoute = createLocalFiltersRoute({
endpoint: 'GET /api/apm/ui_filters/local_filters/metrics',
getProjection: ({ setup, query }) => {
const { serviceName, serviceNodeName } = query;
return getMetricsProjection({
setup,
serviceName,
serviceNodeName,
});
},
queryRt: t.intersection([
t.type({
serviceName: t.string,
}),
t.partial({
serviceNodeName: t.string,
}),
]),
});

export const errorGroupsLocalFiltersRoute = createLocalFiltersRoute({
endpoint: 'GET /api/apm/ui_filters/local_filters/errorGroups',
getProjection: ({ setup, query }) => {
const { serviceName } = query;
return getErrorGroupsProjection({
setup,
serviceName,
});
},
queryRt: t.type({
serviceName: t.string,
}),
});

export const serviceNodesLocalFiltersRoute = createLocalFiltersRoute({
endpoint: 'GET /api/apm/ui_filters/local_filters/serviceNodes',
getProjection: ({ setup, query }) => {
const { serviceName } = query;
return getServiceNodesProjection({
setup,
serviceName,
});
},
queryRt: t.type({
serviceName: t.string,
}),
});

export const rumOverviewLocalFiltersRoute = createLocalFiltersRoute({
endpoint: 'GET /api/apm/ui_filters/local_filters/rumOverview',
getProjection: async ({ setup }) => {
Expand Down

0 comments on commit 8088f13

Please sign in to comment.