Skip to content

Commit

Permalink
remove tls
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Jan 15, 2024
1 parent 9d3fd00 commit ceff93d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 40 deletions.
3 changes: 1 addition & 2 deletions src/middleware/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ where
type Future = ResponseFuture<S::Future>;

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.inner.poll_ready(cx).map_err(Into::into)
self.inner.poll_ready(cx)
}

fn call(&mut self, req: Request<B>) -> Self::Future {
use tracing_opentelemetry::OpenTelemetrySpanExt;
let req = req;
let span = if self.filter.map_or(true, |f| f(req.uri().path())) {
let span = otel_http::http_server::make_span_from_request(&req);
let route = http_route(&req);
Expand Down
35 changes: 1 addition & 34 deletions src/otlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use opentelemetry_sdk::{
trace::{Sampler, Tracer},
Resource,
};
// #[cfg(feature = "tls")]
// use tonic::transport::ClientTlsConfig;

#[must_use]
pub fn identity(
Expand Down Expand Up @@ -40,12 +38,6 @@ where
.with_endpoint(endpoint)
.with_headers(read_headers_from_env())
.into(),
// #[cfg(feature = "tls")]
// "grpc/tls" => opentelemetry_otlp::new_exporter()
// .tonic()
// .with_tls_config(ClientTlsConfig::new())
// .with_endpoint(endpoint)
// .into(),
_ => opentelemetry_otlp::new_exporter()
.tonic()
.with_endpoint(endpoint)
Expand Down Expand Up @@ -135,20 +127,14 @@ fn infer_protocol_and_endpoint(
maybe_protocol: Option<&str>,
maybe_endpoint: Option<&str>,
) -> (String, String) {
#[cfg_attr(not(feature = "tls"), allow(unused_mut))]
let mut protocol = maybe_protocol.unwrap_or_else(|| {
let protocol = maybe_protocol.unwrap_or_else(|| {
if maybe_endpoint.map_or(false, |e| e.contains(":4317")) {
"grpc"
} else {
"http/protobuf"
}
});

// #[cfg(feature = "tls")]
// if protocol == "grpc" && maybe_endpoint.unwrap_or("").starts_with("https") {
// protocol = "grpc/tls";
// }

let endpoint = match protocol {
"http/protobuf" => maybe_endpoint.unwrap_or("http://localhost:4318"), //Devskim: ignore DS137138
_ => maybe_endpoint.unwrap_or("http://localhost:4317"), //Devskim: ignore DS137138
Expand All @@ -169,25 +155,6 @@ mod tests {
#[case(Some("http/protobuf"), None, "http/protobuf", "http://localhost:4318")] //Devskim: ignore DS137138
#[case(Some("grpc"), None, "grpc", "http://localhost:4317")] //Devskim: ignore DS137138
#[case(None, Some("http://localhost:4317"), "grpc", "http://localhost:4317")]
//Devskim: ignore DS137138
// #[cfg_attr(
// feature = "tls",
// case(
// None,
// Some("https://localhost:4317"),
// "grpc/tls",
// "https://localhost:4317"
// )
// )]
// #[cfg_attr(
// feature = "tls",
// case(
// Some("grpc/tls"),
// Some("https://localhost:4317"),
// "grpc/tls",
// "https://localhost:4317"
// )
// )]
#[case(
Some("http/protobuf"),
Some("http://localhost:4318"), //Devskim: ignore DS137138
Expand Down
4 changes: 0 additions & 4 deletions src/propagation.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Originally retired from davidB/tracing-opentelemetry-instrumentation-sdk
// which is licensed under CC0 1.0 Universal
// https://github.com/davidB/tracing-opentelemetry-instrumentation-sdk/blob/d3609ac2cc699d3a24fbf89754053cc8e938e3bf/LICENSE

use opentelemetry::{
propagation::{
text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator,
Expand Down

0 comments on commit ceff93d

Please sign in to comment.