elastic / elastic/apm-agent-java

Separate agent proxy settings from standard JVM settings

Open
#958 0 comments 1 reaction 0 assignees View on GitHub
enhancement setup technical-debt
Dominant language
Java
Stars
594
Forks
338
Avg merge
1d 13h
Merged PRs (30d)
25

Description

**Is your feature request related to a problem? Please describe.**

When agent to use a proxy to reach apm server, we advise to use standard JVM properties `http.proxyHost` and `http.proxyPort` to define the proxy that [should be used](https://www.elastic.co/guide/en/apm/agent/java/1.x/config-reporter.html#config-server-urls).

While it will definitely be fine for most cases, it will not be optimal in the following situations:

- an internal proxy is being used by the JVM, and this proxy has no access to the apm server. Changing proxy config/permissions includes extra complexity for deployment

- an internal proxy is being used by the JVM for some http connections, but agent should not use it (direct connection). It is still possible to configure `http.nonProxyHosts` but adds extra complexity.

- there is no support for proxies with authentication, thus adding support for this in the future would require dedicated properties anyway.

[Reference to the JDK network settings](https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html)

**Describe the solution you'd like**

Agent should have a distinct set of properties to support proxy configuration, for example:
- `elastic.apm.proxy_host=proxy-host` and `elastic.apm.proxy_port=proxy-host`
- a single URL with optional credentials `elastic.apm.proxy=http://user:password@proxy-host:3128/`, this one having the advantage to be a single configuration item and to provide protocol

The default values of those properties should be set with the values of the standard JVM properties (if they are available), which will make it work by default if the proxy can reach apm-server.

The expected benefits here would be multiple:
- will work with JVM settings if those are suitable
- will prevent breaking existing proxy settings, application won't be affected.
- avoids any extra operational deployment complexity: changing network or proxy configuration and security is always tedious and requires extra caution
- allow to add authenticated proxy support that is not supported with JVM settings (future-proofing).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.