Add setDaemonAddress API
- Dominant language
- Java
- Stars
- 100
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
Currently, the only way to configure the daemon address in the Java SDK is via environment variable or system property ([docs](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-configuration.html#xray-sdk-java-configuration-envvars)). You can also configure it by using the `withEmitter` [method](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/AWSXRayRecorderBuilder.java) of the recorder, however that only sets the address used for UDP calls. See [client](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/XRayClient.java#L21) used for sampling calls. In other SDKs, you can configure both programmatically.
The SDK also does not expose the daemon address once set, it is stored in a config as a [private field](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/emitters/UDPEmitter.java#L20) with no getter/setter.
## Solution
We should add a `AWSXRay.setDaemonAddress()` API that can take the same string values as the env var and sys property. We should also expose the daemon address with a getter in [UDPEmitter](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/emitters/UDPEmitter.java).
Contributor guide
Assessment
This issue has not been assessed yet.