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

当服务器 url 作为 ENV 参数传递给 docker 启动的服务时,elasticapm.properties 中的环境变量不会在运行时解析。而是抛出以下错误

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.
4

1 回答 1

0

您可以通过直接server_url为变量提供值来提供 via 环境变量的值ELASTIC_APM_SERVER_URL。例如:

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

有关 Elastic APM 的 Java 代理配置的更多信息:

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

于 2021-04-05T13:14:47.143 回答