Skip to content

Commit

Permalink
[APM] Add APM agent config options (#84678) (#84889)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalkoren authored Dec 3, 2020
1 parent 0794246 commit b9e0552
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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'),
]);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down Expand Up @@ -91,15 +92,25 @@ 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',
}),
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
Expand Down Expand Up @@ -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'],
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
]);
Expand Down

0 comments on commit b9e0552

Please sign in to comment.