diff --git a/src/sinks/datadog/logs/config.rs b/src/sinks/datadog/logs/config.rs index c6c93da795fc3..37f729b5d8d63 100644 --- a/src/sinks/datadog/logs/config.rs +++ b/src/sinks/datadog/logs/config.rs @@ -91,23 +91,18 @@ impl DatadogLogsConfig { // TODO: We should probably hoist this type of base URI generation so that all DD sinks can // utilize it, since it all follows the same pattern. fn get_uri(&self) -> http::Uri { - let endpoint = self - .dd_common - .endpoint - .clone() - .or_else(|| { - Some(format!( - "https://http-intake.logs.{}/api/v2/logs", - self.dd_common.site - )) - }) - .unwrap_or_else(|| match self.region { - Some(Region::Eu) => "https://http-intake.logs.datadoghq.eu/api/v2/logs".to_string(), - None | Some(Region::Us) => { - "https://http-intake.logs.datadoghq.com/api/v2/logs".to_string() + let base_url = self.dd_common.endpoint.clone().unwrap_or_else(|| { + if let Some(region) = self.region { + match region { + Region::Eu => "https://http-intake.logs.datadoghq.eu".to_string(), + Region::Us => "https://http-intake.logs.datadoghq.com".to_string(), } - }); - http::Uri::try_from(endpoint).expect("URI not valid") + } else { + format!("https://http-intake.logs.{}", self.dd_common.site) + } + }); + + http::Uri::try_from(format!("{}/api/v2/logs", base_url)).expect("URI not valid") } fn get_protocol(&self) -> String { diff --git a/src/sinks/datadog/mod.rs b/src/sinks/datadog/mod.rs index 3462492619301..40dbc42428ffa 100644 --- a/src/sinks/datadog/mod.rs +++ b/src/sinks/datadog/mod.rs @@ -36,8 +36,9 @@ pub(crate) fn default_site() -> String { pub struct DatadogCommonConfig { /// The endpoint to send observability data to. /// - /// The endpoint must contain an HTTP scheme, and may specify a - /// hostname or IP address and port. + /// The endpoint must contain an HTTP scheme, and may specify a hostname or IP + /// address and port. The API path should NOT be specified as this is handled by + /// the sink. /// /// If set, overrides the `site` option. #[configurable(metadata(docs::advanced))] diff --git a/website/content/en/highlights/2023-09-26-0-33-0-upgrade-guide.md b/website/content/en/highlights/2023-09-26-0-33-0-upgrade-guide.md index eadb9ecde67d1..3457ab4afaf2b 100644 --- a/website/content/en/highlights/2023-09-26-0-33-0-upgrade-guide.md +++ b/website/content/en/highlights/2023-09-26-0-33-0-upgrade-guide.md @@ -2,13 +2,17 @@ date: "2023-09-26" title: "0.33 Upgrade Guide" description: "An upgrade guide that addresses breaking changes in 0.33.0" -authors: ["spencergilbert"] +authors: ["spencergilbert", "neuronull"] release: "0.33.0" hide_on_release_notes: false badges: type: breaking change --- +Vector's 0.33.0 release includes **breaking changes**: + +1. [Behavior of the `datadog_logs` sink's `endpoint` setting](#datadog-logs-endpoint) + Vector's 0.33.0 release includes **deprecations**: 1. [Renaming the `armv7` rpm package](#armv7-rename) @@ -17,6 +21,20 @@ We cover them below to help you upgrade quickly: ## Upgrade guide +### Breaking changes + +#### Behavior of the `datadog_logs` sink's `endpoint` setting {#datadog-logs-endpoint} + +The `endpoint` configuration setting is common to each of the Datadog sinks. Before this +change, when `endpoint` was set, the logs sink took the provided endpoint as the complete +URL (including API path) to use for posting HTTP requests. This behavior is inconsistent +with the other Datadog sinks, which use the `endpoint` as a base URL that the API path +(eg. "/api/v2/logs"), is appended to. + +With this release, the `datadog_logs` sink's behavior is now consistent with the other +Datadog sinks for the `endpoint` setting. + + ### Deprecations #### Renaming the `armv7` rpm package {#armv7-rename} diff --git a/website/cue/reference/components/sinks/base/datadog_events.cue b/website/cue/reference/components/sinks/base/datadog_events.cue index 27eeab0f24410..9227419d8fe93 100644 --- a/website/cue/reference/components/sinks/base/datadog_events.cue +++ b/website/cue/reference/components/sinks/base/datadog_events.cue @@ -43,8 +43,9 @@ base: components: sinks: datadog_events: configuration: { description: """ The endpoint to send observability data to. - The endpoint must contain an HTTP scheme, and may specify a - hostname or IP address and port. + The endpoint must contain an HTTP scheme, and may specify a hostname or IP + address and port. The API path should NOT be specified as this is handled by + the sink. If set, overrides the `site` option. """ diff --git a/website/cue/reference/components/sinks/base/datadog_logs.cue b/website/cue/reference/components/sinks/base/datadog_logs.cue index 71aa7a783d344..999d71d0bd6e0 100644 --- a/website/cue/reference/components/sinks/base/datadog_logs.cue +++ b/website/cue/reference/components/sinks/base/datadog_logs.cue @@ -128,8 +128,9 @@ base: components: sinks: datadog_logs: configuration: { description: """ The endpoint to send observability data to. - The endpoint must contain an HTTP scheme, and may specify a - hostname or IP address and port. + The endpoint must contain an HTTP scheme, and may specify a hostname or IP + address and port. The API path should NOT be specified as this is handled by + the sink. If set, overrides the `site` option. """ diff --git a/website/cue/reference/components/sinks/base/datadog_metrics.cue b/website/cue/reference/components/sinks/base/datadog_metrics.cue index e79fc5d01943d..4d284a6b86bf1 100644 --- a/website/cue/reference/components/sinks/base/datadog_metrics.cue +++ b/website/cue/reference/components/sinks/base/datadog_metrics.cue @@ -85,8 +85,9 @@ base: components: sinks: datadog_metrics: configuration: { description: """ The endpoint to send observability data to. - The endpoint must contain an HTTP scheme, and may specify a - hostname or IP address and port. + The endpoint must contain an HTTP scheme, and may specify a hostname or IP + address and port. The API path should NOT be specified as this is handled by + the sink. If set, overrides the `site` option. """ diff --git a/website/cue/reference/components/sinks/base/datadog_traces.cue b/website/cue/reference/components/sinks/base/datadog_traces.cue index 8f8fd899d4121..2da62f2d49558 100644 --- a/website/cue/reference/components/sinks/base/datadog_traces.cue +++ b/website/cue/reference/components/sinks/base/datadog_traces.cue @@ -104,8 +104,9 @@ base: components: sinks: datadog_traces: configuration: { description: """ The endpoint to send observability data to. - The endpoint must contain an HTTP scheme, and may specify a - hostname or IP address and port. + The endpoint must contain an HTTP scheme, and may specify a hostname or IP + address and port. The API path should NOT be specified as this is handled by + the sink. If set, overrides the `site` option. """