diff --git a/bottlecap/src/config/mod.rs b/bottlecap/src/config/mod.rs index f26c8e9b2..c79a76c8c 100644 --- a/bottlecap/src/config/mod.rs +++ b/bottlecap/src/config/mod.rs @@ -25,11 +25,16 @@ use crate::config::service_mapping::deserialize_service_mapping; #[derive(Debug, PartialEq, Deserialize, Clone, Default)] #[serde(default)] #[allow(clippy::module_name_repetitions)] +#[allow(clippy::struct_excessive_bools)] pub struct FallbackConfig { extension_version: Option, serverless_appsec_enabled: bool, appsec_enabled: bool, profiling_enabled: bool, + // otel + trace_otel_enabled: bool, + otlp_config_receiver_protocols_http_endpoint: Option, + otlp_config_receiver_protocols_grpc_endpoint: Option, } #[derive(Debug, PartialEq, Deserialize, Clone, Default)] @@ -165,6 +170,18 @@ fn fallback(figment: &Figment) -> Result<(), ConfigError> { )); } + if fallback_config.trace_otel_enabled + || fallback_config + .otlp_config_receiver_protocols_http_endpoint + .is_some() + || fallback_config + .otlp_config_receiver_protocols_grpc_endpoint + .is_some() + { + log_fallback_reason("otel"); + return Err(ConfigError::UnsupportedField("otel".to_string())); + } + Ok(()) } @@ -255,6 +272,22 @@ pub mod tests { }); } + #[test] + fn test_fallback_on_otel() { + figment::Jail::expect_with(|jail| { + jail.clear_env(); + jail.set_env("DD_EXTENSION_VERSION", "next"); + jail.set_env( + "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT", + "localhost:4138", + ); + + let config = get_config(Path::new("")).expect_err("should reject unknown fields"); + assert_eq!(config, ConfigError::UnsupportedField("otel".to_string())); + Ok(()) + }); + } + #[test] fn test_allowed_but_disabled() { figment::Jail::expect_with(|jail| {