Make payload URLs relative - #327
Conversation
Make Forwarder::send accept relative URLs, that are resolved on top of the base URL. Base URL is provided by the ForwarderContext instance, where it is either pulled from an environment variable, or supplied by the user directly.
There was a problem hiding this comment.
💡 Codex Review
When an existing caller builds a forwarder with Forwarder.builder().build() and continues to pass absolute endpoints to send(), this now calls ForwarderContext.defaults() and throws unless DD_DOGSTATSD_HTTP_URL is set, even though URI.resolve does not need a base for absolute payload URLs. This turns the new relative-URL support into a breaking requirement for deployments that already supplied full URLs per request; please keep the base optional for absolute payload URLs or provide a non-env default path for those callers.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| * Builds the context, running detection for any value not set explicitly. | ||
| * | ||
| * @return a new context. | ||
| * @throws URISyntaxException if baseUri value is not a valid URI. |
There was a problem hiding this comment.
Should be IllegalStateException or IllegalArgumentException instead
Make Forwarder::send accept relative URLs, that are resolved on top of the base URL. Base URL is provided by the ForwarderContext instance, where it is either pulled from an environment variable, or supplied by the user directly.