kibana/x-pack/plugins/apm/server/index.ts
Dario Gieselaar 8169ed173b
[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

94 lines
3.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 { schema, TypeOf } from '@kbn/config-schema';
import { PluginInitializerContext } from 'src/core/server';
import { APMOSSConfig } from 'src/plugins/apm_oss/server';
import { APMPlugin } from './plugin';
import { SearchAggregatedTransactionSetting } from '../common/aggregated_transactions';
export const config = {
exposeToBrowser: {
serviceMapEnabled: true,
ui: true,
},
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
serviceMapEnabled: schema.boolean({ defaultValue: true }),
serviceMapFingerprintBucketSize: schema.number({ defaultValue: 100 }),
serviceMapTraceIdBucketSize: schema.number({ defaultValue: 65 }),
serviceMapFingerprintGlobalBucketSize: schema.number({
defaultValue: 1000,
}),
serviceMapTraceIdGlobalBucketSize: schema.number({ defaultValue: 6 }),
serviceMapMaxTracesPerRequest: schema.number({ defaultValue: 50 }),
autocreateApmIndexPattern: schema.boolean({ defaultValue: true }),
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
transactionGroupBucketSize: schema.number({ defaultValue: 1000 }),
maxTraceItems: schema.number({ defaultValue: 1000 }),
}),
searchAggregatedTransactions: schema.oneOf(
[
schema.literal(SearchAggregatedTransactionSetting.auto),
schema.literal(SearchAggregatedTransactionSetting.always),
schema.literal(SearchAggregatedTransactionSetting.never),
],
{
defaultValue: SearchAggregatedTransactionSetting.never,
}
),
telemetryCollectionEnabled: schema.boolean({ defaultValue: true }),
metricsInterval: schema.number({ defaultValue: 30 }),
}),
};
export type APMXPackConfig = TypeOf<typeof config.schema>;
export function mergeConfigs(
apmOssConfig: APMOSSConfig,
apmConfig: APMXPackConfig
) {
return {
/* eslint-disable @typescript-eslint/naming-convention */
'apm_oss.transactionIndices': apmOssConfig.transactionIndices,
'apm_oss.spanIndices': apmOssConfig.spanIndices,
'apm_oss.errorIndices': apmOssConfig.errorIndices,
'apm_oss.metricsIndices': apmOssConfig.metricsIndices,
'apm_oss.sourcemapIndices': apmOssConfig.sourcemapIndices,
'apm_oss.onboardingIndices': apmOssConfig.onboardingIndices,
'apm_oss.indexPattern': apmOssConfig.indexPattern,
/* eslint-enable @typescript-eslint/naming-convention */
'xpack.apm.serviceMapEnabled': apmConfig.serviceMapEnabled,
'xpack.apm.serviceMapFingerprintBucketSize':
apmConfig.serviceMapFingerprintBucketSize,
'xpack.apm.serviceMapTraceIdBucketSize':
apmConfig.serviceMapTraceIdBucketSize,
'xpack.apm.serviceMapFingerprintGlobalBucketSize':
apmConfig.serviceMapFingerprintGlobalBucketSize,
'xpack.apm.serviceMapTraceIdGlobalBucketSize':
apmConfig.serviceMapTraceIdGlobalBucketSize,
'xpack.apm.serviceMapMaxTracesPerRequest':
apmConfig.serviceMapMaxTracesPerRequest,
'xpack.apm.ui.enabled': apmConfig.ui.enabled,
'xpack.apm.ui.maxTraceItems': apmConfig.ui.maxTraceItems,
'xpack.apm.ui.transactionGroupBucketSize':
apmConfig.ui.transactionGroupBucketSize,
'xpack.apm.autocreateApmIndexPattern': apmConfig.autocreateApmIndexPattern,
'xpack.apm.telemetryCollectionEnabled':
apmConfig.telemetryCollectionEnabled,
'xpack.apm.searchAggregatedTransactions':
apmConfig.searchAggregatedTransactions,
'xpack.apm.metricsInterval': apmConfig.metricsInterval,
};
}
export type APMConfig = ReturnType<typeof mergeConfigs>;
export const plugin = (initContext: PluginInitializerContext) =>
new APMPlugin(initContext);
export { APMPlugin, APMPluginSetup } from './plugin';