[APM] Add APM agent config options (#84678)

This commit is contained in:
eyalkoren 2020-12-03 12:22:38 +02:00 committed by GitHub
parent bec33426eb
commit f5fb14f07a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 113 additions and 4 deletions

View file

@ -0,0 +1,17 @@
/*
* 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';
export const logLevelRt = t.union([
t.literal('trace'),
t.literal('debug'),
t.literal('info'),
t.literal('warning'),
t.literal('error'),
t.literal('critical'),
t.literal('off'),
]);

View file

@ -64,8 +64,38 @@ Array [
},
Object {
"key": "log_level",
"type": "text",
"validationName": "string",
"options": Array [
Object {
"text": "trace",
"value": "trace",
},
Object {
"text": "debug",
"value": "debug",
},
Object {
"text": "info",
"value": "info",
},
Object {
"text": "warning",
"value": "warning",
},
Object {
"text": "error",
"value": "error",
},
Object {
"text": "critical",
"value": "critical",
},
Object {
"text": "off",
"value": "off",
},
],
"type": "select",
"validationName": "(\\"trace\\" | \\"debug\\" | \\"info\\" | \\"warning\\" | \\"error\\" | \\"critical\\" | \\"off\\")",
},
Object {
"key": "profiling_inferred_spans_enabled",
@ -110,6 +140,11 @@ Array [
"type": "boolean",
"validationName": "(\\"true\\" | \\"false\\")",
},
Object {
"key": "sanitize_field_names",
"type": "text",
"validationName": "string",
},
Object {
"key": "server_timeout",
"min": "1ms",
@ -170,6 +205,11 @@ Array [
"type": "float",
"validationName": "floatRt",
},
Object {
"key": "transaction_ignore_urls",
"type": "text",
"validationName": "string",
},
Object {
"key": "transaction_max_spans",
"max": undefined,

View file

@ -6,6 +6,7 @@
import { i18n } from '@kbn/i18n';
import { captureBodyRt } from '../runtime_types/capture_body_rt';
import { logLevelRt } from '../runtime_types/log_level_rt';
import { RawSettingDefinition } from './types';
export const generalSettings: RawSettingDefinition[] = [
@ -91,7 +92,8 @@ export const generalSettings: RawSettingDefinition[] = [
// LOG_LEVEL
{
key: 'log_level',
type: 'text',
validation: logLevelRt,
type: 'select',
defaultValue: 'info',
label: i18n.translate('xpack.apm.agentConfig.logLevel.label', {
defaultMessage: 'Log level',
@ -99,7 +101,16 @@ export const generalSettings: RawSettingDefinition[] = [
description: i18n.translate('xpack.apm.agentConfig.logLevel.description', {
defaultMessage: 'Sets the logging level for the agent',
}),
includeAgents: ['dotnet', 'ruby'],
options: [
{ text: 'trace', value: 'trace' },
{ text: 'debug', value: 'debug' },
{ text: 'info', value: 'info' },
{ text: 'warning', value: 'warning' },
{ text: 'error', value: 'error' },
{ text: 'critical', value: 'critical' },
{ text: 'off', value: 'off' },
],
includeAgents: ['dotnet', 'ruby', 'java'],
},
// Recording
@ -207,4 +218,42 @@ export const generalSettings: RawSettingDefinition[] = [
}
),
},
// Sanitize field names
{
key: 'sanitize_field_names',
type: 'text',
defaultValue:
'password, passwd, pwd, secret, *key, *token*, *session*, *credit*, *card*, authorization, set-cookie',
label: i18n.translate('xpack.apm.agentConfig.sanitizeFiledNames.label', {
defaultMessage: 'Sanitize field names',
}),
description: i18n.translate(
'xpack.apm.agentConfig.sanitizeFiledNames.description',
{
defaultMessage:
'Sometimes it is necessary to sanitize, i.e., remove, sensitive data sent to Elastic APM. This config accepts a list of wildcard patterns of field names which should be sanitized. These apply to HTTP headers (including cookies) and `application/x-www-form-urlencoded` data (POST form fields). The query string and the captured request body (such as `application/json` data) will not get sanitized.',
}
),
includeAgents: ['java'],
},
// Ignore transactions based on URLs
{
key: 'transaction_ignore_urls',
type: 'text',
defaultValue:
'Agent specific - check out the documentation of this config option in the corresponding agent documentation.',
label: i18n.translate('xpack.apm.agentConfig.transactionIgnoreUrl.label', {
defaultMessage: 'Ignore transactions based on URLs',
}),
description: i18n.translate(
'xpack.apm.agentConfig.transactionIgnoreUrl.description',
{
defaultMessage:
'Used to restrict requests to certain URLs from being instrumented. This config accepts a comma-separated list of wildcard patterns of URL paths that should be ignored. When an incoming HTTP request is detected, its request path will be tested against each element in this list. For example, adding `/home/index` to this list would match and remove instrumentation from `http://localhost/home/index` as well as `http://whatever.com/home/index?value1=123`',
}
),
includeAgents: ['java'],
},
];

View file

@ -61,12 +61,14 @@ describe('filterByAgent', () => {
'capture_headers',
'circuit_breaker_enabled',
'enable_log_correlation',
'log_level',
'profiling_inferred_spans_enabled',
'profiling_inferred_spans_excluded_classes',
'profiling_inferred_spans_included_classes',
'profiling_inferred_spans_min_duration',
'profiling_inferred_spans_sampling_interval',
'recording',
'sanitize_field_names',
'server_timeout',
'span_frames_min_duration',
'stack_trace_limit',
@ -75,6 +77,7 @@ describe('filterByAgent', () => {
'stress_monitor_gc_stress_threshold',
'stress_monitor_system_cpu_relief_threshold',
'stress_monitor_system_cpu_stress_threshold',
'transaction_ignore_urls',
'transaction_max_spans',
'transaction_sample_rate',
]);