[APM] Adds new configuration 'xpack.apm.maxServiceEnvironments' (#82090) (#82903)

* Closes #77695.
Adds new configuration 'xpack.apm.ui.maxServiceEnvironments' to set the
max number of service environments visible in APM UI.

* renamed config 'xpack.apm.ui.maxServiceEnvironments' -> 'xpack.apm.maxServiceEnvironments'

* Renames 'xpack.apm.ui.maxServiceEnvironments' -> 'xpack.apm.maxServiceEnvironments' in the docs.

* removed incorrect size param on the composite terms sub-agg

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Oliver Gupte 2020-11-09 16:43:08 -08:00 committed by GitHub
parent 04cfe46406
commit 25b73fb95a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 31 additions and 7 deletions

View file

@ -48,6 +48,9 @@ Changing these settings may disable features of the APM App.
| `xpack.apm.enabled`
| Set to `false` to disable the APM app. Defaults to `true`.
| `xpack.apm.maxServiceEnvironments`
| Maximum number of unique service environments recognized by the UI. Defaults to `100`.
| `xpack.apm.serviceMapFingerprintBucketSize`
| Maximum number of unique transaction combinations sampled for generating service map focused on a specific service. Defaults to `100`.

View file

@ -43,6 +43,7 @@ export const config = {
),
telemetryCollectionEnabled: schema.boolean({ defaultValue: true }),
metricsInterval: schema.number({ defaultValue: 30 }),
maxServiceEnvironments: schema.number({ defaultValue: 100 }),
}),
};
@ -74,6 +75,7 @@ export function mergeConfigs(
'xpack.apm.serviceMapMaxTracesPerRequest':
apmConfig.serviceMapMaxTracesPerRequest,
'xpack.apm.ui.enabled': apmConfig.ui.enabled,
'xpack.apm.maxServiceEnvironments': apmConfig.maxServiceEnvironments,
'xpack.apm.ui.maxTraceItems': apmConfig.ui.maxTraceItems,
'xpack.apm.ui.transactionGroupBucketSize':
apmConfig.ui.transactionGroupBucketSize,

View file

@ -66,6 +66,7 @@ export function registerErrorCountAlertType({
config,
savedObjectsClient: services.savedObjectsClient,
});
const maxServiceEnvironments = config['xpack.apm.maxServiceEnvironments'];
const searchParams = {
index: indices['apm_oss.errorIndices'],
@ -100,6 +101,7 @@ export function registerErrorCountAlertType({
environments: {
terms: {
field: SERVICE_ENVIRONMENT,
size: maxServiceEnvironments,
},
},
},

View file

@ -75,6 +75,7 @@ export function registerTransactionDurationAlertType({
config,
savedObjectsClient: services.savedObjectsClient,
});
const maxServiceEnvironments = config['xpack.apm.maxServiceEnvironments'];
const searchParams = {
index: indices['apm_oss.transactionIndices'],
@ -112,6 +113,7 @@ export function registerTransactionDurationAlertType({
environments: {
terms: {
field: SERVICE_ENVIRONMENT,
size: maxServiceEnvironments,
},
},
},

View file

@ -71,6 +71,7 @@ export function registerTransactionErrorRateAlertType({
config,
savedObjectsClient: services.savedObjectsClient,
});
const maxServiceEnvironments = config['xpack.apm.maxServiceEnvironments'];
const searchParams = {
index: indices['apm_oss.transactionIndices'],
@ -120,6 +121,7 @@ export function registerTransactionErrorRateAlertType({
environments: {
terms: {
field: SERVICE_ENVIRONMENT,
size: maxServiceEnvironments,
},
},
},

View file

@ -24,7 +24,8 @@ export async function getAllEnvironments({
searchAggregatedTransactions: boolean;
includeMissing?: boolean;
}) {
const { apmEventClient } = setup;
const { apmEventClient, config } = setup;
const maxServiceEnvironments = config['xpack.apm.maxServiceEnvironments'];
// omit filter for service.name if "All" option is selected
const serviceNameFilter = serviceName
@ -55,7 +56,7 @@ export async function getAllEnvironments({
environments: {
terms: {
field: SERVICE_ENVIRONMENT,
size: 100,
size: maxServiceEnvironments,
...(!serviceName ? { min_doc_count: 0 } : {}),
missing: includeMissing ? ENVIRONMENT_NOT_DEFINED.value : undefined,
},

View file

@ -366,6 +366,7 @@ Array [
"environments": Object {
"terms": Object {
"field": "service.environment",
"size": 100,
},
},
},

View file

@ -337,7 +337,8 @@ export const getEnvironments = async ({
setup,
projection,
}: AggregationParams) => {
const { apmEventClient } = setup;
const { apmEventClient, config } = setup;
const maxServiceEnvironments = config['xpack.apm.maxServiceEnvironments'];
const response = await apmEventClient.search(
mergeProjection(projection, {
body: {
@ -352,6 +353,7 @@ export const getEnvironments = async ({
environments: {
terms: {
field: SERVICE_ENVIRONMENT,
size: maxServiceEnvironments,
},
},
},

View file

@ -127,7 +127,7 @@ Object {
"terms": Object {
"field": "service.environment",
"missing": "ALL_OPTION_VALUE",
"size": 50,
"size": 100,
},
},
},

View file

@ -18,7 +18,8 @@ export async function getExistingEnvironmentsForService({
serviceName: string | undefined;
setup: Setup;
}) {
const { internalClient, indices } = setup;
const { internalClient, indices, config } = setup;
const maxServiceEnvironments = config['xpack.apm.maxServiceEnvironments'];
const bool = serviceName
? { filter: [{ term: { [SERVICE_NAME]: serviceName } }] }
@ -34,7 +35,7 @@ export async function getExistingEnvironmentsForService({
terms: {
field: SERVICE_ENVIRONMENT,
missing: ALL_OPTION_VALUE,
size: 50,
size: maxServiceEnvironments,
},
},
},

View file

@ -15,6 +15,7 @@ Object {
"terms": Object {
"field": "service.environment",
"missing": "ENVIRONMENT_NOT_DEFINED",
"size": 100,
},
},
},
@ -58,6 +59,7 @@ Object {
"terms": Object {
"field": "service.environment",
"missing": "ENVIRONMENT_NOT_DEFINED",
"size": 100,
},
},
},

View file

@ -24,7 +24,7 @@ export async function getEnvironments({
serviceName?: string;
searchAggregatedTransactions: boolean;
}) {
const { start, end, apmEventClient } = setup;
const { start, end, apmEventClient, config } = setup;
const filter: ESFilter[] = [{ range: rangeFilter(start, end) }];
@ -34,6 +34,8 @@ export async function getEnvironments({
});
}
const maxServiceEnvironments = config['xpack.apm.maxServiceEnvironments'];
const params = {
apm: {
events: [
@ -56,6 +58,7 @@ export async function getEnvironments({
terms: {
field: SERVICE_ENVIRONMENT,
missing: ENVIRONMENT_NOT_DEFINED.value,
size: maxServiceEnvironments,
},
},
},

View file

@ -76,6 +76,9 @@ export async function inspectSearchParams(
case 'xpack.apm.metricsInterval':
return 30;
case 'xpack.apm.maxServiceEnvironments':
return 100;
}
},
}