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)!: remove deprecated config options #18940

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Changes from 3 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
1 change: 0 additions & 1 deletion .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -199,7 +199,6 @@ scopes:
- clickhouse sink # Anything `clickhouse` sink related
- console sink # Anything `console` sink related
- databend sink # Anything `databend` sink related
- datadog_archives sink # Anything `datadog_archives` sink related
- datadog_events sink # Anything `datadog_events` sink related
- datadog_logs sink # Anything `datadog_logs` sink related
- datadog_metrics sink # Anything `datadog_metrics` sink related
32 changes: 0 additions & 32 deletions src/common/datadog.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
#![allow(dead_code)]
#![allow(unreachable_pub)]
use serde::{Deserialize, Serialize};
use vector_config::configurable_component;
use vector_lib::event::DatadogMetricOriginMetadata;

pub const DD_US_SITE: &str = "datadoghq.com";
@@ -43,37 +42,6 @@ pub(crate) enum DatadogMetricType {
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub(crate) struct DatadogPoint<T>(pub(crate) i64, pub(crate) T);

/// A Datadog region.
#[configurable_component]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum Region {
/// US region.
Us,

/// EU region.
Eu,
}

/// Gets the base domain to use for any calls to Datadog.
///
/// This is a helper function for Datadog component configs using the deprecated `region` field.
///
/// If `region` is not specified, we fallback to `site`.
///
/// TODO: This should be deleted when the deprecated `region` config option is fully removed,
/// and the callers will replace the result of this function call with just `site`.
pub(crate) const fn get_base_domain_region<'a>(site: &'a str, region: Option<&Region>) -> &'a str {
if let Some(region) = region {
match region {
Region::Eu => DD_EU_SITE,
Region::Us => DD_US_SITE,
}
} else {
site
}
}

/// Gets the base API endpoint to use for any calls to Datadog.
///
/// If `endpoint` is not specified, we fallback to `site`.
28 changes: 2 additions & 26 deletions src/config/enterprise.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ use super::{
SourceOuter, TransformOuter,
};
use crate::{
common::datadog::{get_api_base_endpoint, get_base_domain_region, Region},
common::datadog::get_api_base_endpoint,
conditions::AnyCondition,
http::{HttpClient, HttpError},
sinks::{
@@ -79,12 +79,6 @@ pub struct Options {
#[serde(default = "default_site")]
site: String,

/// The Datadog region to send data to.
///
/// This option is deprecated, and the `site` field should be used instead.
#[configurable(deprecated)]
region: Option<Region>,

/// The Datadog endpoint to send data to.
///
/// This is an advanced setting that is generally meant only for testing, and overrides both
@@ -100,12 +94,6 @@ pub struct Options {
#[serde(default)]
pub api_key: Option<String>,

/// The Datadog application key.
///
/// This is deprecated.
#[configurable(deprecated)]
pub application_key: Option<String>,

/// The configuration key for Observability Pipelines.
pub configuration_key: String,

@@ -134,10 +122,8 @@ impl Default for Options {
enabled: default_enabled(),
enable_logs_reporting: default_enable_logs_reporting(),
site: default_site(),
region: None,
endpoint: None,
api_key: None,
application_key: None,
configuration_key: "".to_owned(),
reporting_interval_secs: default_reporting_interval_secs(),
max_retries: default_max_retries(),
@@ -332,12 +318,6 @@ impl TryFrom<&Config> for EnterpriseMetadata {
},
};

if opts.application_key.is_some() {
warn!(
"Datadog application key is deprecated. You can safely remove `application_key` from the config."
);
}

info!(
"Datadog API key provided. Integration with {} is enabled.",
DATADOG_REPORTING_PRODUCT
@@ -487,7 +467,6 @@ fn setup_logs_reporting(
default_api_key: api_key.into(),
..Default::default()
},
region: datadog.region,
request: RequestConfig {
headers: IndexMap::from([(
"DD-EVP-ORIGIN".to_string(),
@@ -595,7 +574,6 @@ fn setup_metrics_reporting(
default_api_key: api_key.into(),
..Default::default()
},
region: datadog.region,
..Default::default()
};

@@ -684,7 +662,6 @@ pub(crate) fn report_configuration(
let endpoint = get_reporting_endpoint(
opts.endpoint.as_ref(),
opts.site.as_str(),
opts.region,
&opts.configuration_key,
);
// Datadog uses a JSON:API, so we'll serialize the config to a JSON
@@ -721,10 +698,9 @@ pub(crate) fn report_configuration(
fn get_reporting_endpoint(
endpoint: Option<&String>,
site: &str,
region: Option<Region>,
configuration_key: &str,
) -> String {
let base = get_base_domain_region(site, region.as_ref());
let base = site;

format!(
"{}{}/{}/versions",
12 changes: 2 additions & 10 deletions src/sinks/datadog/events/config.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ use vector_lib::schema;
use vrl::value::Kind;

use crate::{
common::datadog::{get_base_domain_region, Region},
config::{AcknowledgementsConfig, GenerateConfig, Input, SinkConfig, SinkContext},
http::HttpClient,
sinks::{
@@ -34,11 +33,6 @@ pub struct DatadogEventsConfig {
#[serde(flatten)]
pub dd_common: DatadogCommonConfig,

/// The Datadog region to send events to.
#[configurable(deprecated = "This option has been deprecated, use the `site` option instead.")]
#[serde(default)]
pub region: Option<Region>,

#[configurable(derived)]
#[serde(default)]
pub request: TowerRequestConfig,
@@ -57,7 +51,7 @@ impl DatadogEventsConfig {
fn get_api_events_endpoint(&self) -> http::Uri {
let api_base_endpoint = get_api_base_endpoint(
self.dd_common.endpoint.as_ref(),
get_base_domain_region(self.dd_common.site.as_str(), self.region.as_ref()),
self.dd_common.site.as_str(),
);

// We know this URI will be valid since we have just built it up ourselves.
@@ -96,9 +90,7 @@ impl DatadogEventsConfig {
impl SinkConfig for DatadogEventsConfig {
async fn build(&self, cx: SinkContext) -> crate::Result<(VectorSink, Healthcheck)> {
let client = self.build_client(cx.proxy())?;
let healthcheck = self
.dd_common
.build_healthcheck(client.clone(), self.region.as_ref())?;
let healthcheck = self.dd_common.build_healthcheck(client.clone())?;
let sink = self.build_sink(client)?;

Ok((sink, healthcheck))
25 changes: 6 additions & 19 deletions src/sinks/datadog/logs/config.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ use vrl::value::Kind;
use super::{service::LogApiRetry, sink::LogSinkBuilder};
use crate::{
codecs::Transformer,
common::datadog::Region,
config::{AcknowledgementsConfig, GenerateConfig, Input, SinkConfig, SinkContext},
http::HttpClient,
schema,
@@ -53,11 +52,6 @@ pub struct DatadogLogsConfig {
#[serde(flatten)]
pub dd_common: DatadogCommonConfig,

/// The Datadog region to send logs to.
#[configurable(deprecated = "This option has been deprecated, use the `site` option instead.")]
#[serde(default)]
pub region: Option<Region>,

#[configurable(derived)]
#[serde(default)]
pub compression: Option<Compression>,
@@ -91,16 +85,11 @@ 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 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(),
}
} else {
format!("https://http-intake.logs.{}", self.dd_common.site)
}
});
let base_url = self
.dd_common
.endpoint
.clone()
.unwrap_or_else(|| format!("https://http-intake.logs.{}", self.dd_common.site));

http::Uri::try_from(format!("{}/api/v2/logs", base_url)).expect("URI not valid")
}
@@ -165,9 +154,7 @@ impl SinkConfig for DatadogLogsConfig {
async fn build(&self, cx: SinkContext) -> crate::Result<(VectorSink, Healthcheck)> {
let client = self.create_client(&cx.proxy)?;

let healthcheck = self
.dd_common
.build_healthcheck(client.clone(), self.region.as_ref())?;
let healthcheck = self.dd_common.build_healthcheck(client.clone())?;

let sink = self.build_processor(client, cx.app_name_slug)?;

12 changes: 2 additions & 10 deletions src/sinks/datadog/metrics/config.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ use super::{
sink::DatadogMetricsSink,
};
use crate::{
common::datadog::{get_base_domain_region, Region},
config::{AcknowledgementsConfig, Input, SinkConfig, SinkContext},
http::HttpClient,
sinks::{
@@ -144,11 +143,6 @@ pub struct DatadogMetricsConfig {
#[serde(default)]
pub default_namespace: Option<String>,

/// The Datadog region to send metrics to.
#[configurable(deprecated = "This option has been deprecated, use the `site` option instead.")]
#[serde(default)]
pub region: Option<Region>,

#[configurable(derived)]
#[serde(default)]
pub batch: BatchConfig<DatadogMetricsDefaultBatchSettings>,
@@ -165,9 +159,7 @@ impl_generate_config_from_default!(DatadogMetricsConfig);
impl SinkConfig for DatadogMetricsConfig {
async fn build(&self, cx: SinkContext) -> crate::Result<(VectorSink, Healthcheck)> {
let client = self.build_client(&cx.proxy)?;
let healthcheck = self
.dd_common
.build_healthcheck(client.clone(), self.region.as_ref())?;
let healthcheck = self.dd_common.build_healthcheck(client.clone())?;
let sink = self.build_sink(client)?;

Ok((sink, healthcheck))
@@ -197,7 +189,7 @@ impl DatadogMetricsConfig {
format!(
"https://{}-vector.agent.{}",
version,
get_base_domain_region(self.dd_common.site.as_str(), self.region.as_ref())
self.dd_common.site.as_str()
)
})
}
14 changes: 4 additions & 10 deletions src/sinks/datadog/mod.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ use vector_lib::sensitive_string::SensitiveString;
use vector_lib::{config::AcknowledgementsConfig, tls::TlsEnableableConfig};

use crate::{
common::datadog::{get_api_base_endpoint, get_base_domain_region, Region, DD_US_SITE},
common::datadog::{get_api_base_endpoint, DD_US_SITE},
http::{HttpClient, HttpError},
sinks::HealthcheckError,
};
@@ -93,15 +93,9 @@ impl Default for DatadogCommonConfig {
impl DatadogCommonConfig {
/// Returns a `Healthcheck` which is a future that will be used to ensure the
/// `<site>/api/v1/validate` endpoint is reachable.
fn build_healthcheck(
&self,
client: HttpClient,
region: Option<&Region>,
) -> crate::Result<Healthcheck> {
let validate_endpoint = get_api_validate_endpoint(
self.endpoint.as_ref(),
get_base_domain_region(self.site.as_str(), region),
)?;
fn build_healthcheck(&self, client: HttpClient) -> crate::Result<Healthcheck> {
let validate_endpoint =
get_api_validate_endpoint(self.endpoint.as_ref(), self.site.as_str())?;

let api_key: String = self.default_api_key.clone().into();

2 changes: 1 addition & 1 deletion src/sinks/datadog/traces/config.rs
Original file line number Diff line number Diff line change
@@ -215,7 +215,7 @@ impl DatadogTracesConfig {
impl SinkConfig for DatadogTracesConfig {
async fn build(&self, cx: SinkContext) -> crate::Result<(VectorSink, Healthcheck)> {
let client = self.build_client(&cx.proxy)?;
let healthcheck = self.dd_common.build_healthcheck(client.clone(), None)?;
let healthcheck = self.dd_common.build_healthcheck(client.clone())?;
let sink = self.build_sink(client)?;

Ok((sink, healthcheck))
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
date: "2023-11-07"
title: "0.34 Upgrade Guide"
description: "An upgrade guide that addresses breaking changes in 0.34.0"
authors: ["dsmith3197"]
release: "0.34.0"
hide_on_release_notes: false
badges:
type: breaking change
---

Vector's 0.34.0 release includes **breaking changes**:

1. [Removal of Deprecated Datadog Component Config Options](#datadog-deprecated-config-options)

We cover them below to help you upgrade quickly:

## Upgrade guide

### Breaking changes

#### Removal of Deprecated Datadog Component Config Options {#datadog-deprecated-config-options}

The `region` config option has been removed from the Datadog Events, Logs,
and Metrics sinks. The `region` and `application_key` config options have
been removed from the Enterprise configuration.
dsmith3197 marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 0 additions & 10 deletions website/cue/reference/components/sinks/base/datadog_events.cue
Original file line number Diff line number Diff line change
@@ -52,16 +52,6 @@ base: components: sinks: datadog_events: configuration: {
required: false
type: string: examples: ["http://127.0.0.1:8080", "http://example.com:12345"]
}
region: {
deprecated: true
deprecated_message: "This option has been deprecated, use the `site` option instead."
description: "The Datadog region to send events to."
required: false
type: string: enum: {
eu: "EU region."
us: "US region."
}
}
request: {
description: """
Middleware settings for outbound requests.
10 changes: 0 additions & 10 deletions website/cue/reference/components/sinks/base/datadog_logs.cue
Original file line number Diff line number Diff line change
@@ -146,16 +146,6 @@ base: components: sinks: datadog_logs: configuration: {
required: false
type: string: examples: ["http://127.0.0.1:8080", "http://example.com:12345"]
}
region: {
deprecated: true
deprecated_message: "This option has been deprecated, use the `site` option instead."
description: "The Datadog region to send logs to."
required: false
type: string: enum: {
eu: "EU region."
us: "US region."
}
}
request: {
description: "Outbound HTTP request settings."
required: false
10 changes: 0 additions & 10 deletions website/cue/reference/components/sinks/base/datadog_metrics.cue
Original file line number Diff line number Diff line change
@@ -94,16 +94,6 @@ base: components: sinks: datadog_metrics: configuration: {
required: false
type: string: examples: ["http://127.0.0.1:8080", "http://example.com:12345"]
}
region: {
deprecated: true
deprecated_message: "This option has been deprecated, use the `site` option instead."
description: "The Datadog region to send metrics to."
required: false
type: string: enum: {
eu: "EU region."
us: "US region."
}
}
request: {
description: """
Middleware settings for outbound requests.
Loading