1
src/main/resources/elasticapm.properties
server_url=${PROJECT_ELASTICAPM_URL}

Environment variables within elasticapm.properties are not resolved in runtime, when server url is passed as an ENV parameter to the service launched by docker. The following error is thrown instead

ch.client.WIRE       : [7f640f1e] Received raw response: 200 OK
2021-04-05 12:51:42,242 [elastic-apm-configuration-reloader] WARN  co.elastic.apm.agent.shaded.stagemonitor.configuration.ConfigurationOption - Error in Attachment configuration: no protocol: ${PROJECT_ELASTICAPM_URL} Default value 'http://localhost:8200' for 'server_url' will be applied.
Rpj
  • 5,348
  • 16
  • 62
  • 122

1 Answers1

0

You can provide the value of the server_url via environment variables by providing a value for the variable ELASTIC_APM_SERVER_URL directly. For example:

environment:
  - ELASTIC_APM_SERVICE_NAME=backend-java
  - ELASTIC_APM_SERVER_URL=http://apm-server:8200
  - ELASTIC_APM_APPLICATION_PACKAGES=com.riferrei.backend.*

For more information about the configuration of the Java agent for Elastic APM:

https://www.elastic.co/guide/en/apm/agent/java/current/configuration.html

Ricardo Ferreira
  • 1,236
  • 3
  • 6