We are using the APM in production & pre-prod. For dev services, we want to disable the APM, for this we are trying to set via Environment variables. Currently using Java agent 1.6.1.
Here are the kubernetes pod details,
Environment:
PROFILE: dev
ELASTIC_APM_ACTIVE: false
ELASTIC_APM_INSTRUMENT: false
2019-05-10 17:56:08.767 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.6.1 as super-user-service on Java 1.8.0_201 (Oracle Corporation) Linux 4.4.148-k8s
2019-05-10 17:56:09.364 [apm-server-healthcheck] WARN co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is not available (Connection refused (Connection refused))
2019-05-10 17:56:39.059 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-10 17:56:39.059 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 0 seconds (+/-10%)
How to disable via environment variable? because this way, code or other property files need not be changed
The active and instrument flags are mostly used to disable instrumentation.
In this case, the agent still tries to establish a connection with the APM server and collect and send metrics. I believe this shouldn't affect your dev env, it only writes to the log.
If you add ELASTIC_APM_METRICS_INTERVAL: 0s (see config option documentation), metrics collection will be disabled.
In addition, you can add ELASTIC_APM_LOG_LEVEL: ERROR to remove agent loggings.
This doesn't mean no agent code will run at all, for that you need to remove the agent altogether. However, it may be enough for your purpose.
2019-05-27 09:27:16.989 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:27:16.989 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:27:51.275 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:27:51.275 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:28:29.350 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:28:29.350 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:29:06.018 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:29:06.018 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:29:39.416 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:29:39.417 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:30:15.105 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:30:15.105 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:30:51.391 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:30:51.391 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:31:24.047 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:31:24.047 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2019-05-27 09:31:58.996 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type METRICS with this error: Connection refused (Connection refused)
2019-05-27 09:31:58.996 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.