diff --git a/crates/apollo-router/Cargo.toml b/crates/apollo-router/Cargo.toml index ae8637508dc..32b6fdaae07 100644 --- a/crates/apollo-router/Cargo.toml +++ b/crates/apollo-router/Cargo.toml @@ -10,9 +10,9 @@ name = "router" path = "src/main.rs" [features] -default = ["otlp-tonic"] +default = ["otlp-grpc"] # activates OTLP/gRPC -otlp-tonic = [ +otlp-grpc = [ "opentelemetry-otlp/tonic", "opentelemetry-otlp/tonic-build", "opentelemetry-otlp/prost", @@ -20,7 +20,7 @@ otlp-tonic = [ ] # activates OTLP/HTTP otlp-http = ["opentelemetry-otlp/http-proto"] -tls = ["opentelemetry-otlp/tls", "tonic/transport", "tonic/tls", "otlp-tonic"] +tls = ["opentelemetry-otlp/tls", "tonic/transport", "tonic/tls", "otlp-grpc"] [dependencies] anyhow = "1.0.47" diff --git a/crates/apollo-router/src/configuration/mod.rs b/crates/apollo-router/src/configuration/mod.rs index eeb184f075d..9b528babc4d 100644 --- a/crates/apollo-router/src/configuration/mod.rs +++ b/crates/apollo-router/src/configuration/mod.rs @@ -1,6 +1,6 @@ //! Logic for loading configuration in to an object model -#[cfg(any(feature = "otlp-tonic", feature = "otlp-http"))] +#[cfg(any(feature = "otlp-grpc", feature = "otlp-http"))] pub mod otlp; use apollo_router_core::prelude::*; @@ -199,7 +199,7 @@ impl Cors { #[allow(clippy::large_enum_variant)] pub enum OpenTelemetry { Jaeger(Option), - #[cfg(any(feature = "otlp-tonic", feature = "otlp-http"))] + #[cfg(any(feature = "otlp-grpc", feature = "otlp-http"))] Otlp(otlp::Otlp), } @@ -312,7 +312,7 @@ mod tests { assert_config_snapshot!("testdata/config_opentelemetry_jaeger_full.yml"); } - #[cfg(any(feature = "otlp-tonic", feature = "otlp-http"))] + #[cfg(any(feature = "otlp-grpc", feature = "otlp-http"))] #[test] fn ensure_configuration_api_does_not_change_common() { // NOTE: don't take a snapshot here because the optional fields appear with ~ and they vary @@ -324,14 +324,14 @@ mod tests { )) .unwrap(); - #[cfg(feature = "otlp-tonic")] + #[cfg(feature = "otlp-grpc")] serde_yaml::from_str::(include_str!( "testdata/config_opentelemetry_otlp_tracing_tonic_common.yml" )) .unwrap(); } - #[cfg(feature = "otlp-tonic")] + #[cfg(feature = "otlp-grpc")] #[test] fn ensure_configuration_api_does_not_change_tonic() { assert_config_snapshot!("testdata/config_opentelemetry_otlp_tracing_tonic_basic.yml"); @@ -345,7 +345,7 @@ mod tests { assert_config_snapshot!("testdata/config_opentelemetry_otlp_tracing_http_full.yml"); } - #[cfg(all(feature = "tls", feature = "otlp-tonic"))] + #[cfg(all(feature = "tls", feature = "otlp-grpc"))] #[test] fn ensure_configuration_api_does_not_change_tls_config() { assert_config_snapshot!("testdata/config_opentelemetry_otlp_tracing_tonic_tls.yml"); diff --git a/crates/apollo-router/src/configuration/otlp/mod.rs b/crates/apollo-router/src/configuration/otlp/mod.rs index 17d73822846..8e5cc4d98cd 100644 --- a/crates/apollo-router/src/configuration/otlp/mod.rs +++ b/crates/apollo-router/src/configuration/otlp/mod.rs @@ -1,11 +1,11 @@ #[cfg(feature = "otlp-http")] mod http; -#[cfg(feature = "otlp-tonic")] +#[cfg(feature = "otlp-grpc")] mod tonic; #[cfg(feature = "otlp-http")] pub use self::http::*; -#[cfg(feature = "otlp-tonic")] +#[cfg(feature = "otlp-grpc")] pub use self::tonic::*; use crate::configuration::ConfigurationError; use opentelemetry::sdk::resource::Resource; @@ -32,7 +32,7 @@ pub struct Tracing { #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(deny_unknown_fields, rename_all = "snake_case")] pub enum Exporter { - #[cfg(feature = "otlp-tonic")] + #[cfg(feature = "otlp-grpc")] Grpc(TonicExporter), #[cfg(feature = "otlp-http")] Http(HttpExporter), @@ -41,7 +41,7 @@ pub enum Exporter { impl Exporter { pub fn exporter(&self) -> Result { match &self { - #[cfg(feature = "otlp-tonic")] + #[cfg(feature = "otlp-grpc")] Exporter::Grpc(exporter) => Ok(exporter.exporter()?.into()), #[cfg(feature = "otlp-http")] Exporter::Http(exporter) => Ok(exporter.exporter()?.into()), @@ -53,7 +53,7 @@ impl Exporter { match std::env::var("ROUTER_TRACING").as_deref() { #[cfg(feature = "otlp-http")] Ok("http") => Ok(HttpExporter::exporter_from_env().into()), - #[cfg(feature = "otlp-tonic")] + #[cfg(feature = "otlp-grpc")] Ok("tonic") => Ok(TonicExporter::exporter_from_env().into()), Ok(val) => Err(ConfigurationError::InvalidEnvironmentVariable(format!( "unrecognized value for ROUTER_TRACING: {}", diff --git a/crates/apollo-router/src/lib.rs b/crates/apollo-router/src/lib.rs index b2cd09e7598..5e0b4197dc4 100644 --- a/crates/apollo-router/src/lib.rs +++ b/crates/apollo-router/src/lib.rs @@ -306,7 +306,7 @@ fn try_initialize_subscriber( opentelemetry::global::set_error_handler(handle_error)?; return Ok(Some(Arc::new(subscriber.with(telemetry)))); } - #[cfg(any(feature = "otlp-tonic", feature = "otlp-http"))] + #[cfg(any(feature = "otlp-grpc", feature = "otlp-http"))] Some(OpenTelemetry::Otlp(configuration::otlp::Otlp::Tracing(tracing))) => { let tracer = if let Some(tracing) = tracing.as_ref() { tracing.tracer()? diff --git a/xtask/src/commands/test.rs b/xtask/src/commands/test.rs index 47c0d9f5c1d..b84fcf17e59 100644 --- a/xtask/src/commands/test.rs +++ b/xtask/src/commands/test.rs @@ -2,7 +2,7 @@ use anyhow::{ensure, Result}; use structopt::StructOpt; use xtask::*; -const FEATURE_SETS: &[&[&str]] = &[&[], &["otlp-http"], &["otlp-tonic"], &["otlp-tonic", "tls"]]; +const FEATURE_SETS: &[&[&str]] = &[&[], &["otlp-http"], &["otlp-grpc"], &["otlp-grpc", "tls"]]; #[derive(Debug, StructOpt)] pub struct Test {