Skip to content

Commit fd0adee

Browse files
authored
Exclude process.argv by default (#118)
It can take quite a lot of space, as it's added to each transaction, and stored even for non-sampled transactions
1 parent d765466 commit fd0adee

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

apm-agent-core/src/main/java/co/elastic/apm/report/ApmServerReporter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ public Thread newThread(Runnable r) {
105105
}, ProducerType.MULTI, PhasedBackoffWaitStrategy.withLock(1, 10, TimeUnit.MILLISECONDS));
106106
this.coreConfiguration = coreConfiguration;
107107
reportingEventHandler = new ReportingEventHandler(service, process, system, payloadSender, reporterConfiguration, processorEventHandler);
108+
if (!reporterConfiguration.isIncludeProcessArguments()) {
109+
process.getArgv().clear();
110+
}
108111
disruptor.handleEventsWith(reportingEventHandler);
109112
disruptor.start();
110113
if (reporterConfiguration.getFlushInterval() > 0) {

apm-agent-core/src/main/java/co/elastic/apm/report/ReporterConfiguration.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ public class ReporterConfiguration extends ConfigurationOptionProvider {
9191
"Blocks the requests until the transaction has been reported to the APM server.")
9292
.buildWithDefault(false);
9393

94+
private final ConfigurationOption<Boolean> includeProcessArguments = ConfigurationOption.booleanOption()
95+
.key("include_process_args")
96+
.configurationCategory(REPORTER_CATEGORY)
97+
.description("Whether each transaction should have the process arguments attached.\n" +
98+
"Disabled by default to save disk space.")
99+
.buildWithDefault(false);
100+
94101
@Nullable
95102
public String getSecretToken() {
96103
return secretToken.get();
@@ -119,4 +126,8 @@ public int getMaxQueueSize() {
119126
public boolean isReportSynchronously() {
120127
return reportSynchronously.get();
121128
}
129+
130+
public boolean isIncludeProcessArguments() {
131+
return includeProcessArguments.get();
132+
}
122133
}

docs/configuration.asciidoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,27 @@ This setting is useful to limit memory consumption if you experience a sudden sp
517517
| `elastic.apm.max_queue_size` | `ELASTIC_APM_MAX_QUEUE_SIZE`
518518
|============
519519

520+
[float]
521+
[[config-include-process-args]]
522+
==== `include_process_args`
523+
524+
Whether each transaction should have the process arguments attached.
525+
Disabled by default to save disk space.
526+
527+
528+
[options="header"]
529+
|============
530+
| Default | Type | Dynamic
531+
| `false` | Boolean | false
532+
|============
533+
534+
535+
[options="header"]
536+
|============
537+
| Java System Properties | Environment
538+
| `elastic.apm.include_process_args` | `ELASTIC_APM_INCLUDE_PROCESS_ARGS`
539+
|============
540+
520541
[[config-stacktrace]]
521542
=== Stacktrace configuration options
522543
[float]

0 commit comments

Comments
 (0)