From 360ab3410ad43137752f55422fa63ed1eca9b26a Mon Sep 17 00:00:00 2001 From: Doug Smith <doug.smith3197@gmail.com> Date: Wed, 25 Oct 2023 15:47:04 -0400 Subject: [PATCH 1/3] chore(datadog)!: remove deprecated config options --- .github/semantic.yml | 1 - src/common/datadog.rs | 32 ----------------------------- src/config/enterprise.rs | 28 ++----------------------- src/sinks/datadog/events/config.rs | 12 ++--------- src/sinks/datadog/logs/config.rs | 25 ++++++---------------- src/sinks/datadog/metrics/config.rs | 12 ++--------- src/sinks/datadog/mod.rs | 14 ++++--------- src/sinks/datadog/traces/config.rs | 2 +- 8 files changed, 17 insertions(+), 109 deletions(-) diff --git a/.github/semantic.yml b/.github/semantic.yml index b794afc310dbd..84340954ea7ba 100644 --- a/.github/semantic.yml +++ b/.github/semantic.yml @@ -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 diff --git a/src/common/datadog.rs b/src/common/datadog.rs index 306ff41f837b6..ce6dea0cbced4 100644 --- a/src/common/datadog.rs +++ b/src/common/datadog.rs @@ -3,7 +3,6 @@ #![allow(dead_code)] #![allow(unreachable_pub)] use serde::{Deserialize, Serialize}; -use vector_config::configurable_component; use vector_core::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`. diff --git a/src/config/enterprise.rs b/src/config/enterprise.rs index bce787aa7d183..2786a0d2b97b8 100644 --- a/src/config/enterprise.rs +++ b/src/config/enterprise.rs @@ -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", diff --git a/src/sinks/datadog/events/config.rs b/src/sinks/datadog/events/config.rs index 606d364b32ec8..d18b150f8f9ca 100644 --- a/src/sinks/datadog/events/config.rs +++ b/src/sinks/datadog/events/config.rs @@ -6,7 +6,6 @@ use vector_core::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)) diff --git a/src/sinks/datadog/logs/config.rs b/src/sinks/datadog/logs/config.rs index 13050d3a87da8..e7882444db65d 100644 --- a/src/sinks/datadog/logs/config.rs +++ b/src/sinks/datadog/logs/config.rs @@ -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)?; diff --git a/src/sinks/datadog/metrics/config.rs b/src/sinks/datadog/metrics/config.rs index bfddadd64d6d9..24fdeefd3b79a 100644 --- a/src/sinks/datadog/metrics/config.rs +++ b/src/sinks/datadog/metrics/config.rs @@ -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() ) }) } diff --git a/src/sinks/datadog/mod.rs b/src/sinks/datadog/mod.rs index 745495dcc3a16..846699f857c95 100644 --- a/src/sinks/datadog/mod.rs +++ b/src/sinks/datadog/mod.rs @@ -7,7 +7,7 @@ use vector_core::{config::AcknowledgementsConfig, tls::TlsEnableableConfig}; use vector_lib::sensitive_string::SensitiveString; 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(); diff --git a/src/sinks/datadog/traces/config.rs b/src/sinks/datadog/traces/config.rs index bb8f4d183d63d..d71e5f0b64963 100644 --- a/src/sinks/datadog/traces/config.rs +++ b/src/sinks/datadog/traces/config.rs @@ -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)) From 63de9d7413c772228b9d7e73cade8223e670b78f Mon Sep 17 00:00:00 2001 From: Doug Smith <doug.smith3197@gmail.com> Date: Wed, 25 Oct 2023 16:28:13 -0400 Subject: [PATCH 2/3] update cue and add upgrade guide --- .../2023-11-07-0-34-0-upgrade-guide.md | 26 +++++++++++++++++++ .../components/sinks/base/datadog_events.cue | 10 ------- .../components/sinks/base/datadog_logs.cue | 10 ------- .../components/sinks/base/datadog_metrics.cue | 10 ------- 4 files changed, 26 insertions(+), 30 deletions(-) create mode 100644 website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md diff --git a/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md b/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md new file mode 100644 index 0000000000000..56716fa6fe67e --- /dev/null +++ b/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md @@ -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. diff --git a/website/cue/reference/components/sinks/base/datadog_events.cue b/website/cue/reference/components/sinks/base/datadog_events.cue index 217dbd481ce38..e6ca4d22c11cf 100644 --- a/website/cue/reference/components/sinks/base/datadog_events.cue +++ b/website/cue/reference/components/sinks/base/datadog_events.cue @@ -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. diff --git a/website/cue/reference/components/sinks/base/datadog_logs.cue b/website/cue/reference/components/sinks/base/datadog_logs.cue index 6e2961f8b39af..af56186188a53 100644 --- a/website/cue/reference/components/sinks/base/datadog_logs.cue +++ b/website/cue/reference/components/sinks/base/datadog_logs.cue @@ -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 diff --git a/website/cue/reference/components/sinks/base/datadog_metrics.cue b/website/cue/reference/components/sinks/base/datadog_metrics.cue index f4cf4efa19500..77333e8c2d722 100644 --- a/website/cue/reference/components/sinks/base/datadog_metrics.cue +++ b/website/cue/reference/components/sinks/base/datadog_metrics.cue @@ -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. From 3d6900447a4d9f5ff2a35eab2a54dd114de82aba Mon Sep 17 00:00:00 2001 From: Doug Smith <dsmith3197@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:47:11 -0400 Subject: [PATCH 3/3] Update website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md Co-authored-by: Jesse Szwedko <jesse.szwedko@datadoghq.com> --- .../en/highlights/2023-11-07-0-34-0-upgrade-guide.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md b/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md index 56716fa6fe67e..318f7cf5513d0 100644 --- a/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md +++ b/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md @@ -22,5 +22,7 @@ We cover them below to help you upgrade quickly: #### 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. +and Metrics sinks. Instead the `site` option should be used. + +The `region` and `application_key` config options have +been removed from the Enterprise configuration. Instead of `region`, `site` should be used. `application_key` is no longer required.