kibana/x-pack/plugins/apm/server/routes/traces.ts

45 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-04-20 21:13:37 +02:00
/*
* 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';
[APM] Distributed Tracing (#24062) * Adds traces overview with mock data (#22628) * Updates service overview snapshots * Adds tests for ManagedTable and ImpactBar * Refactored transaction overview to use new managed table component * Removed jsconfig file in apm * [APM] Distributed tracing - Trace details (waterfall) (#22763) * [APM] Add typescript to waterfall (#23635) * [APM] Migrate get_trace and constants to Typescript (#23634) * [APM] Add types for setup_request (#23762) * [APM] Adds trace overview queries and some refactoring (#23605) * ImpactBar component to align EuiProgress usage for impact bars * Sharing some logic between transaction and trace queries * Typescript support * Quick fix ‘banana’ * [APM] Ensure backwards compatibility for v1 and v2 (#23636) * Make interfaces versioned * Rename eventType to docType * Fixes trace links on traces overview (#24089) * [APM] use react-redux-request (#24117) * Updated yarn lockfile for new yarn version * Updated dependency issues for react-router-dom types * [APM] Display transaction info on span flyout (#24189) * [APM] Display transaction info on span flyout * Brings in real location and url param data for transaction flyout * Converts flyout to TS * Adds query param state for flyouts with ts support * Updates styles and uses EuiTabs for transaction flyout * [APM] Transaction flyout * [APM] Minor docs cleanup (#24325) * [APM] Minor docs cleanup * [APM] Fix issues with v1 spans (#24332) * [APM] Add agent marks (#24361) * [APM] Typescript migration for the transaction endpoints (#24397) * [APM] DT transaction sample header (#24294) Transaction sample header completed * Fixes link target for traces overview to include trans/trace ids as query params * Converts Transaction index file to TS * Adds trace link to sample section * Refactors the trace link and applies it to two usages * Implements transaction sample action context menu * Calculates and implements duration percentage * Re-typed how transaction groups work * Fixes transaction flyout links and context menu * Removes unnecessary ms multiplication * Removes unused commented code * Finalizes infra links * Fixes some type shenanigans
2018-10-23 22:34:23 +02:00
import { setupRequest } from '../lib/helpers/setup_request';
import { getTrace } from '../lib/traces/get_trace';
import { getTransactionGroupList } from '../lib/transaction_groups';
import { createRoute } from './create_route';
import { rangeRt, uiFiltersRt } from './default_api_types';
[APM] Metrics-powered UI (#73953) * [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>
2020-09-16 19:20:08 +02:00
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
2018-04-20 21:13:37 +02:00
export const tracesRoute = createRoute(() => ({
path: '/api/apm/traces',
params: {
2020-05-22 09:08:58 +02:00
query: t.intersection([rangeRt, uiFiltersRt]),
},
handler: async ({ context, request }) => {
const setup = await setupRequest(context, request);
[APM] Metrics-powered UI (#73953) * [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>
2020-09-16 19:20:08 +02:00
const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);
return getTransactionGroupList(
{ type: 'top_traces', searchAggregatedTransactions },
setup
);
2020-05-22 09:08:58 +02:00
},
}));
2018-04-20 21:13:37 +02:00
export const tracesByIdRoute = createRoute(() => ({
path: '/api/apm/traces/{traceId}',
params: {
path: t.type({
2020-05-22 09:08:58 +02:00
traceId: t.string,
}),
2020-05-22 09:08:58 +02:00
query: rangeRt,
},
handler: async ({ context, request }) => {
const setup = await setupRequest(context, request);
return getTrace(context.params.path.traceId, setup);
2020-05-22 09:08:58 +02:00
},
}));