Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(datadog_logs sink)!: Use endpoint config setting consistent with the other datadog_ sinks. #18497

Merged
merged 5 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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