From 97e1fb7ab5c360aae1f2ae7f97d01ca50c71d965 Mon Sep 17 00:00:00 2001 From: Doug Smith Date: Thu, 26 Oct 2023 11:01:30 -0400 Subject: [PATCH] chore(datadog)!: remove deprecated config options (#18940) * chore(datadog)!: remove deprecated config options * update cue and add upgrade guide * Update website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md Co-authored-by: Jesse Szwedko --------- Co-authored-by: Jesse Szwedko --- .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 +- .../2023-11-07-0-34-0-upgrade-guide.md | 28 ++++++++++++++++ .../components/sinks/base/datadog_events.cue | 10 ------ .../components/sinks/base/datadog_logs.cue | 10 ------ .../components/sinks/base/datadog_metrics.cue | 10 ------ 12 files changed, 45 insertions(+), 139 deletions(-) create mode 100644 website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md 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 2bdd3ee200c30..4d1129385809c 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_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(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 e5af10ee9009a..8aea56f058251 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, - /// 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, - /// The Datadog application key. - /// - /// This is deprecated. - #[configurable(deprecated)] - pub application_key: Option, - /// 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, 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 71f431d0ce9c0..979c37822bf32 100644 --- a/src/sinks/datadog/events/config.rs +++ b/src/sinks/datadog/events/config.rs @@ -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, - #[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 d58cd6b106edf..6018d568d5543 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, - #[configurable(derived)] #[serde(default)] pub compression: Option, @@ -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 81eeb48028288..ae2852c9e3fa2 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, - /// The Datadog region to send metrics to. - #[configurable(deprecated = "This option has been deprecated, use the `site` option instead.")] - #[serde(default)] - pub region: Option, - #[configurable(derived)] #[serde(default)] pub batch: BatchConfig, @@ -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 98df036b05243..3e49a8ce6f74e 100644 --- a/src/sinks/datadog/mod.rs +++ b/src/sinks/datadog/mod.rs @@ -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 /// `/api/v1/validate` endpoint is reachable. - fn build_healthcheck( - &self, - client: HttpClient, - region: Option<&Region>, - ) -> crate::Result { - 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 { + 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 08f43ba4c95c7..c5162d99ec0bc 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)) 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..318f7cf5513d0 --- /dev/null +++ b/website/content/en/highlights/2023-11-07-0-34-0-upgrade-guide.md @@ -0,0 +1,28 @@ +--- +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. 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. 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.