* [APM] Optimize service overview queries * Review feedback * Use correct indices/filters for service overview metrics * [APM] Optimize traces overview * Separate queries into separate file * Support union types for aggregations * [APM] Don't fetch dynamic index pattern in setupRequest We don't need a dynamic index pattern for parsing the filters from the query bar. Additionally, instead of fetching uiIndices in `getParamsForSearchRequest`, we can use `indices` that we already fetched in `setupRequest`. * use join utility function to merge requests * Correct path for UI_SETTINGS import * Query transaction indices in getEnvironments() * [APM] Introduce apm.types Instead of using a combination of index + terms filters on processor.event, add a top-level setting that allows you to define a type, which can be a processor event type, agent configuration or custom link. This allows us to more easily compose queries. * Set size of terms agg on error rate aggregation * Metrics * Use separate clients for apm events and other uses * Separate function for calculating relative impact * use UIProcessorEvent type in IURLParams type * Remove unused import * Split out strategy in helper functions * Use cloneDeep in apmEventClient.search * Consistent usage of getUseAggregatedTransactions * Update traces functional test * Update API tests * Update responses for functional tests * Review feedback * Fix type for filter/filters aggregation * Review feedback * Rename useAggregatedTransactions > searchAggregatedTransactions * Use correct route name for transaction redirect page * Closes #67744. * Review feedback; offer other strategies than 'auto' * Fix functional tests * [APM] Always load esarchives from common Instead of requiring every test suite to store its archives under {suite}/fixtures/es_archiver, always load them from common/fixtures/es_archiver. * Update script * Make sure tests pass * Update snapshots for API tests * Filter for transaction.root when fetching top traces * Make sure must_not clause is formatted correctly Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
import * as t from 'io-ts';
|
|
import { setupRequest } from '../lib/helpers/setup_request';
|
|
import { getServiceCount } from '../lib/observability_overview/get_service_count';
|
|
import { getTransactionCoordinates } from '../lib/observability_overview/get_transaction_coordinates';
|
|
import { hasData } from '../lib/observability_overview/has_data';
|
|
import { createRoute } from './create_route';
|
|
import { rangeRt } from './default_api_types';
|
|
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
|
|
|
|
export const observabilityOverviewHasDataRoute = createRoute(() => ({
|
|
path: '/api/apm/observability_overview/has_data',
|
|
handler: async ({ context, request }) => {
|
|
const setup = await setupRequest(context, request);
|
|
return await hasData({ setup });
|
|
},
|
|
}));
|
|
|
|
export const observabilityOverviewRoute = createRoute(() => ({
|
|
path: '/api/apm/observability_overview',
|
|
params: {
|
|
query: t.intersection([rangeRt, t.type({ bucketSize: t.string })]),
|
|
},
|
|
handler: async ({ context, request }) => {
|
|
const setup = await setupRequest(context, request);
|
|
const { bucketSize } = context.params.query;
|
|
const searchAggregatedTransactions = await getSearchAggregatedTransactions(
|
|
setup
|
|
);
|
|
|
|
const serviceCountPromise = getServiceCount({
|
|
setup,
|
|
searchAggregatedTransactions,
|
|
});
|
|
const transactionCoordinatesPromise = getTransactionCoordinates({
|
|
setup,
|
|
bucketSize,
|
|
searchAggregatedTransactions,
|
|
});
|
|
|
|
const [serviceCount, transactionCoordinates] = await Promise.all([
|
|
serviceCountPromise,
|
|
transactionCoordinatesPromise,
|
|
]);
|
|
return { serviceCount, transactionCoordinates };
|
|
},
|
|
}));
|