From d893bfe42fc08bddd9b10e67165ae014068dc9ce Mon Sep 17 00:00:00 2001 From: Felix Barnsteiner Date: Thu, 5 Jul 2018 08:50:23 +0200 Subject: [PATCH 1/2] Exclude process.argv by default It can take quite a lot of space, as it's added to each transaction, and stored even for non-sampled transactions --- .../java/co/elastic/apm/report/ApmServerReporter.java | 3 +++ .../co/elastic/apm/report/ReporterConfiguration.java | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/report/ApmServerReporter.java b/apm-agent-core/src/main/java/co/elastic/apm/report/ApmServerReporter.java index c0b9a4b9c0..8816923264 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/report/ApmServerReporter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/report/ApmServerReporter.java @@ -105,6 +105,9 @@ public Thread newThread(Runnable r) { }, ProducerType.MULTI, PhasedBackoffWaitStrategy.withLock(1, 10, TimeUnit.MILLISECONDS)); this.coreConfiguration = coreConfiguration; reportingEventHandler = new ReportingEventHandler(service, process, system, payloadSender, reporterConfiguration, processorEventHandler); + if (!reporterConfiguration.isIncludeProcessArguments()) { + process.getArgv().clear(); + } disruptor.handleEventsWith(reportingEventHandler); disruptor.start(); if (reporterConfiguration.getFlushInterval() > 0) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java index 7df310996d..d3eca84213 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java @@ -91,6 +91,12 @@ public class ReporterConfiguration extends ConfigurationOptionProvider { "Blocks the requests until the transaction has been reported to the APM server.") .buildWithDefault(false); + private final ConfigurationOption includeProcessArguments = ConfigurationOption.booleanOption() + .key("include_process_args") + .configurationCategory(REPORTER_CATEGORY) + .description("Whether each transaction should have the process arguments attached. Disabled by default to save disk space.") + .buildWithDefault(false); + @Nullable public String getSecretToken() { return secretToken.get(); @@ -119,4 +125,8 @@ public int getMaxQueueSize() { public boolean isReportSynchronously() { return reportSynchronously.get(); } + + public boolean isIncludeProcessArguments() { + return includeProcessArguments.get(); + } } From f05a7dd8ba35f3b8712ded1f546f171ecffe44f9 Mon Sep 17 00:00:00 2001 From: Felix Barnsteiner Date: Thu, 5 Jul 2018 08:52:05 +0200 Subject: [PATCH 2/2] Add docs for include_process_args config --- .../apm/report/ReporterConfiguration.java | 3 ++- docs/configuration.asciidoc | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java index d3eca84213..dbbacb9272 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java @@ -94,7 +94,8 @@ public class ReporterConfiguration extends ConfigurationOptionProvider { private final ConfigurationOption includeProcessArguments = ConfigurationOption.booleanOption() .key("include_process_args") .configurationCategory(REPORTER_CATEGORY) - .description("Whether each transaction should have the process arguments attached. Disabled by default to save disk space.") + .description("Whether each transaction should have the process arguments attached.\n" + + "Disabled by default to save disk space.") .buildWithDefault(false); @Nullable diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index fe54ce0f9c..adcc66c5f3 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -517,6 +517,27 @@ This setting is useful to limit memory consumption if you experience a sudden sp | `elastic.apm.max_queue_size` | `ELASTIC_APM_MAX_QUEUE_SIZE` |============ +[float] +[[config-include-process-args]] +==== `include_process_args` + +Whether each transaction should have the process arguments attached. +Disabled by default to save disk space. + + +[options="header"] +|============ +| Default | Type | Dynamic +| `false` | Boolean | false +|============ + + +[options="header"] +|============ +| Java System Properties | Environment +| `elastic.apm.include_process_args` | `ELASTIC_APM_INCLUDE_PROCESS_ARGS` +|============ + [[config-stacktrace]] === Stacktrace configuration options [float]