-
Notifications
You must be signed in to change notification settings - Fork 327
Description
Describe the bug
Using elastic-apm-agent-1.0.1.jar (on Payara 5)
We're using a load balancer in front of apm-servers (as we do for elasticsearch), so we configure
server_urls=http://loadbalancer/apm-server/
Java agent correctly connects at startup:
[apm-server-healthcheck] INFO co.elastic.apm.report.ApmServerHealthChecker - Elastic APM server is available: {"ok":{"build_date":"2018-11-16T01:22:04Z","build_sha":"e9b22404feb418663d86f059b833bf1487d9379e","version":"6.5.1"}
An error occurs as soon as the first events have to be reported:
[apm-reporter] WARN co.elastic.apm.report.IntakeV2ReportingEventHandler - It seems like you are using a version of the APM Server which is not compatible with this agent. Please use APM Server 6.5.0 or newer.|#]
[apm-reporter] WARN co.elastic.apm.report.IntakeV2ReportingEventHandler - http://loadbalancer/intake/v2/events|#]
Please note the missing '/apm-server' as part of the reporting URL.
To Reproduce
Steps to reproduce the behavior:
- Use a loadbalancer with a path other than '/' in front of apm-servers
- Configre
server_urls=http://loadbalancer/<path> - Trigger java apm agent ro report some incident
- See error
Expected behavior
Java agent should respect full server_url for building reporting URL for intake API.
e.g. reporter should send events to http://loadbalancer/<path>/intake/v2/events and not to
http://loadbalancer/intake/v2/events
Cause seems to be in IntakeV2ReportingEventHandler.java:
public static final String INTAKE_V2_URL = "/intake/v2/events";
This causes in method HttpURLConnection startRequest() to create an absolut path for the reporting URL, not respecting the fully configured server_url:
URL url = new URL(serverUrlIterator.get(), INTAKE_V2_URL);
Otherwise the agent is working really great for far!
Thanks a lot!