-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
Copy pathindex.ts
114 lines (107 loc) · 4.35 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { schema, TypeOf } from '@kbn/config-schema';
import {
PluginConfigDescriptor,
PluginInitializerContext,
} from 'src/core/server';
import { maxSuggestions } from '../../observability/common';
import { SearchAggregatedTransactionSetting } from '../common/aggregated_transactions';
import { APMPlugin } from './plugin';
// All options should be documented in the APM configuration settings: https://github.com/elastic/kibana/blob/master/docs/settings/apm-settings.asciidoc
// and be included on cloud allow list unless there are specific reasons not to
const configSchema = 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 }),
profilingEnabled: schema.boolean({ defaultValue: false }),
agent: schema.object({
migrations: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
}),
indices: schema.object({
transaction: schema.string({ defaultValue: 'traces-apm*,apm-*' }),
span: schema.string({ defaultValue: 'traces-apm*,apm-*' }),
error: schema.string({ defaultValue: 'logs-apm*,apm-*' }),
metric: schema.string({ defaultValue: 'metrics-apm*,apm-*' }),
sourcemap: schema.string({ defaultValue: 'apm-*' }),
onboarding: schema.string({ defaultValue: 'apm-*' }),
}),
});
// plugin config
export const config: PluginConfigDescriptor<APMConfig> = {
deprecations: ({
deprecate,
renameFromRoot,
deprecateFromRoot,
unusedFromRoot,
}) => [
deprecate('enabled', '8.0.0'),
renameFromRoot(
'apm_oss.transactionIndices',
'xpack.apm.indices.transaction'
),
renameFromRoot('apm_oss.spanIndices', 'xpack.apm.indices.span'),
renameFromRoot('apm_oss.errorIndices', 'xpack.apm.indices.error'),
renameFromRoot('apm_oss.metricsIndices', 'xpack.apm.indices.metric'),
renameFromRoot('apm_oss.sourcemapIndices', 'xpack.apm.indices.sourcemap'),
renameFromRoot('apm_oss.onboardingIndices', 'xpack.apm.indices.onboarding'),
deprecateFromRoot('apm_oss.enabled', '8.0.0'),
unusedFromRoot('apm_oss.fleetMode'),
unusedFromRoot('apm_oss.indexPattern'),
renameFromRoot(
'xpack.apm.maxServiceEnvironments',
`uiSettings.overrides[${maxSuggestions}]`
),
renameFromRoot(
'xpack.apm.maxServiceSelections',
`uiSettings.overrides[${maxSuggestions}]`
),
],
exposeToBrowser: {
serviceMapEnabled: true,
ui: true,
profilingEnabled: true,
},
schema: configSchema,
};
export type APMConfig = TypeOf<typeof configSchema>;
export type ApmIndicesConfigName = keyof APMConfig['indices'];
export const plugin = (initContext: PluginInitializerContext) =>
new APMPlugin(initContext);
export { APM_SERVER_FEATURE_ID } from '../common/alert_types';
export { APMPlugin } from './plugin';
export { APMPluginSetup } from './types';
export {
APMServerRouteRepository,
APIEndpoint,
} from './routes/get_global_apm_server_route_repository';
export { APMRouteHandlerResources } from './routes/typings';
export type { ProcessorEvent } from '../common/processor_event';