Skip to content

Commit

Permalink
chore(datadog_logs sink)!: Use endpoint config setting consistent w…
Browse files Browse the repository at this point in the history
…ith the other datadog_ sinks. (#18497)

* chore(docs): clarify endpoint path needed for datadog sinks

* restore

* modify dd logs endpoint processing

* edit upgrade guide
  • Loading branch information
neuronull authored Sep 14, 2023
1 parent 0382bc5 commit 1ac19dd
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 27 deletions.
27 changes: 11 additions & 16 deletions src/sinks/datadog/logs/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/sinks/datadog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
20 changes: 19 additions & 1 deletion website/content/en/highlights/2023-09-26-0-33-0-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
5 changes: 3 additions & 2 deletions website/cue/reference/components/sinks/base/datadog_logs.cue
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down

0 comments on commit 1ac19dd

Please sign in to comment.