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(observability)!: remove deprecated component_name metric tag #18942

Merged
merged 7 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/vector-core/src/metrics/label_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ impl LabelFilter for VectorLabelFilter {
key == "component_id"
|| key == "component_type"
|| key == "component_kind"
|| key == "component_name"
|| key == "buffer_type"
}
}
32 changes: 0 additions & 32 deletions src/common/datadog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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`.
Expand Down
28 changes: 2 additions & 26 deletions src/config/enterprise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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
Expand All @@ -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,

Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -595,7 +574,6 @@ fn setup_metrics_reporting(
default_api_key: api_key.into(),
..Default::default()
},
region: datadog.region,
..Default::default()
};

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/config/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl SourceContext {
if config.enabled() {
warn!(
message = "Enabling `acknowledgements` on sources themselves is deprecated in favor of enabling them in the sink configuration, and will be removed in a future version.",
component_name = self.key.id(),
component_id = self.key.id(),
);
}

Expand Down
12 changes: 2 additions & 10 deletions src/sinks/datadog/events/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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))
Expand Down
25 changes: 6 additions & 19 deletions src/sinks/datadog/logs/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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>,
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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)?;

Expand Down
12 changes: 2 additions & 10 deletions src/sinks/datadog/metrics/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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>,
Expand All @@ -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))
Expand Down Expand Up @@ -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()
)
})
}
Expand Down
14 changes: 4 additions & 10 deletions src/sinks/datadog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/sinks/datadog/traces/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
10 changes: 0 additions & 10 deletions src/topology/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ impl<'a> Builder<'a> {
component_kind = "source",
component_id = %key.id(),
component_type = %source.inner.get_component_name(),
// maintained for compatibility
component_name = %key.id(),
);
let _entered_span = span.enter();

Expand Down Expand Up @@ -428,8 +426,6 @@ impl<'a> Builder<'a> {
component_kind = "transform",
component_id = %key.id(),
component_type = %transform.inner.get_component_name(),
// maintained for compatibility
component_name = %key.id(),
);

// Create a map of the outputs to the list of possible definitions from those outputs.
Expand Down Expand Up @@ -514,8 +510,6 @@ impl<'a> Builder<'a> {
component_kind = "sink",
component_id = %key.id(),
component_type = %sink.inner.get_component_name(),
// maintained for compatibility
component_name = %key.id(),
);
let _entered_span = span.enter();

Expand Down Expand Up @@ -634,8 +628,6 @@ impl<'a> Builder<'a> {
component_kind = "sink",
component_type = typetag,
component_id = %component_key.id(),
// maintained for compatibility
component_name = %component_key.id(),
);
Err(TaskError::wrapped(error))
}
Expand All @@ -645,8 +637,6 @@ impl<'a> Builder<'a> {
component_kind = "sink",
component_type = typetag,
component_id = %component_key.id(),
// maintained for compatibility
component_name = %component_key.id(),
);
Err(TaskError::wrapped(Box::new(e)))
}
Expand Down
Loading
Loading