Skip to content

Commit 1ac19dd

Browse files
authored
chore(datadog_logs sink)!: Use endpoint config setting consistent with the other datadog_ sinks. (vectordotdev#18497)
* chore(docs): clarify endpoint path needed for datadog sinks * restore * modify dd logs endpoint processing * edit upgrade guide
1 parent 0382bc5 commit 1ac19dd

File tree

7 files changed

+45
-27
lines changed

7 files changed

+45
-27
lines changed

src/sinks/datadog/logs/config.rs

+11-16
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,18 @@ impl DatadogLogsConfig {
9191
// TODO: We should probably hoist this type of base URI generation so that all DD sinks can
9292
// utilize it, since it all follows the same pattern.
9393
fn get_uri(&self) -> http::Uri {
94-
let endpoint = self
95-
.dd_common
96-
.endpoint
97-
.clone()
98-
.or_else(|| {
99-
Some(format!(
100-
"https://http-intake.logs.{}/api/v2/logs",
101-
self.dd_common.site
102-
))
103-
})
104-
.unwrap_or_else(|| match self.region {
105-
Some(Region::Eu) => "https://http-intake.logs.datadoghq.eu/api/v2/logs".to_string(),
106-
None | Some(Region::Us) => {
107-
"https://http-intake.logs.datadoghq.com/api/v2/logs".to_string()
94+
let base_url = self.dd_common.endpoint.clone().unwrap_or_else(|| {
95+
if let Some(region) = self.region {
96+
match region {
97+
Region::Eu => "https://http-intake.logs.datadoghq.eu".to_string(),
98+
Region::Us => "https://http-intake.logs.datadoghq.com".to_string(),
10899
}
109-
});
110-
http::Uri::try_from(endpoint).expect("URI not valid")
100+
} else {
101+
format!("https://http-intake.logs.{}", self.dd_common.site)
102+
}
103+
});
104+
105+
http::Uri::try_from(format!("{}/api/v2/logs", base_url)).expect("URI not valid")
111106
}
112107

113108
fn get_protocol(&self) -> String {

src/sinks/datadog/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ pub(crate) fn default_site() -> String {
3636
pub struct DatadogCommonConfig {
3737
/// The endpoint to send observability data to.
3838
///
39-
/// The endpoint must contain an HTTP scheme, and may specify a
40-
/// hostname or IP address and port.
39+
/// The endpoint must contain an HTTP scheme, and may specify a hostname or IP
40+
/// address and port. The API path should NOT be specified as this is handled by
41+
/// the sink.
4142
///
4243
/// If set, overrides the `site` option.
4344
#[configurable(metadata(docs::advanced))]

website/content/en/highlights/2023-09-26-0-33-0-upgrade-guide.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
date: "2023-09-26"
33
title: "0.33 Upgrade Guide"
44
description: "An upgrade guide that addresses breaking changes in 0.33.0"
5-
authors: ["spencergilbert"]
5+
authors: ["spencergilbert", "neuronull"]
66
release: "0.33.0"
77
hide_on_release_notes: false
88
badges:
99
type: breaking change
1010
---
1111

12+
Vector's 0.33.0 release includes **breaking changes**:
13+
14+
1. [Behavior of the `datadog_logs` sink's `endpoint` setting](#datadog-logs-endpoint)
15+
1216
Vector's 0.33.0 release includes **deprecations**:
1317

1418
1. [Renaming the `armv7` rpm package](#armv7-rename)
@@ -17,6 +21,20 @@ We cover them below to help you upgrade quickly:
1721

1822
## Upgrade guide
1923

24+
### Breaking changes
25+
26+
#### Behavior of the `datadog_logs` sink's `endpoint` setting {#datadog-logs-endpoint}
27+
28+
The `endpoint` configuration setting is common to each of the Datadog sinks. Before this
29+
change, when `endpoint` was set, the logs sink took the provided endpoint as the complete
30+
URL (including API path) to use for posting HTTP requests. This behavior is inconsistent
31+
with the other Datadog sinks, which use the `endpoint` as a base URL that the API path
32+
(eg. "/api/v2/logs"), is appended to.
33+
34+
With this release, the `datadog_logs` sink's behavior is now consistent with the other
35+
Datadog sinks for the `endpoint` setting.
36+
37+
2038
### Deprecations
2139

2240
#### Renaming the `armv7` rpm package {#armv7-rename}

website/cue/reference/components/sinks/base/datadog_events.cue

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ base: components: sinks: datadog_events: configuration: {
4343
description: """
4444
The endpoint to send observability data to.
4545
46-
The endpoint must contain an HTTP scheme, and may specify a
47-
hostname or IP address and port.
46+
The endpoint must contain an HTTP scheme, and may specify a hostname or IP
47+
address and port. The API path should NOT be specified as this is handled by
48+
the sink.
4849
4950
If set, overrides the `site` option.
5051
"""

website/cue/reference/components/sinks/base/datadog_logs.cue

+3-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ base: components: sinks: datadog_logs: configuration: {
128128
description: """
129129
The endpoint to send observability data to.
130130
131-
The endpoint must contain an HTTP scheme, and may specify a
132-
hostname or IP address and port.
131+
The endpoint must contain an HTTP scheme, and may specify a hostname or IP
132+
address and port. The API path should NOT be specified as this is handled by
133+
the sink.
133134
134135
If set, overrides the `site` option.
135136
"""

website/cue/reference/components/sinks/base/datadog_metrics.cue

+3-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ base: components: sinks: datadog_metrics: configuration: {
8585
description: """
8686
The endpoint to send observability data to.
8787
88-
The endpoint must contain an HTTP scheme, and may specify a
89-
hostname or IP address and port.
88+
The endpoint must contain an HTTP scheme, and may specify a hostname or IP
89+
address and port. The API path should NOT be specified as this is handled by
90+
the sink.
9091
9192
If set, overrides the `site` option.
9293
"""

website/cue/reference/components/sinks/base/datadog_traces.cue

+3-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ base: components: sinks: datadog_traces: configuration: {
104104
description: """
105105
The endpoint to send observability data to.
106106
107-
The endpoint must contain an HTTP scheme, and may specify a
108-
hostname or IP address and port.
107+
The endpoint must contain an HTTP scheme, and may specify a hostname or IP
108+
address and port. The API path should NOT be specified as this is handled by
109+
the sink.
109110
110111
If set, overrides the `site` option.
111112
"""

0 commit comments

Comments
 (0)