From 8748fb82f44420fe2d95f81c38a5b78a5883a3a0 Mon Sep 17 00:00:00 2001 From: Shaun Cox Date: Tue, 29 Aug 2023 16:25:37 -0500 Subject: [PATCH] use futures-util instead of futures and with no default features --- opentelemetry-contrib/Cargo.toml | 2 +- opentelemetry-datadog/Cargo.toml | 2 +- opentelemetry-dynatrace/Cargo.toml | 7 +++---- opentelemetry-dynatrace/src/metric.rs | 4 ++-- opentelemetry-dynatrace/tests/http_test.rs | 8 ++++---- opentelemetry-otlp/Cargo.toml | 2 +- opentelemetry-otlp/tests/smoke.rs | 2 +- opentelemetry-stackdriver/Cargo.toml | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/opentelemetry-contrib/Cargo.toml b/opentelemetry-contrib/Cargo.toml index 17c926ef21..65b2e2f334 100644 --- a/opentelemetry-contrib/Cargo.toml +++ b/opentelemetry-contrib/Cargo.toml @@ -40,7 +40,7 @@ tokio = { version = "1.0", features = ["fs", "io-util"], optional = true } # futures futures-core = { version = "0.3", optional = true } -futures-util = { version = "0.3", optional = true } +futures-util = { version = "0.3", optional = true, default-features = false } [dev-dependencies] base64 = "0.13" diff --git a/opentelemetry-datadog/Cargo.toml b/opentelemetry-datadog/Cargo.toml index 70682b28ae..c4fcce8faf 100644 --- a/opentelemetry-datadog/Cargo.toml +++ b/opentelemetry-datadog/Cargo.toml @@ -43,7 +43,7 @@ futures-core = "0.3" async-trait = "0.1" base64 = "0.13" bytes = "1" -futures-util = { version = "0.3", features = ["io"] } +futures-util = { version = "0.3", default-features = false, features = ["io"] } isahc = "1.4" opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["trace", "testing"] } diff --git a/opentelemetry-dynatrace/Cargo.toml b/opentelemetry-dynatrace/Cargo.toml index c693b780f8..0a7b2da14e 100644 --- a/opentelemetry-dynatrace/Cargo.toml +++ b/opentelemetry-dynatrace/Cargo.toml @@ -36,11 +36,10 @@ surf-client = ["surf", "opentelemetry-http/surf"] isahc-client = ["isahc", "opentelemetry-http/isahc"] rt-tokio = ["tokio", "opentelemetry/rt-tokio"] -rt-async-std = ["async-std"] +rt-async-std = ["async-std", "futures-channel"] wasm = [ "base64", - "futures-util", "getrandom/js", "js-sys", "wasm-bindgen", @@ -51,8 +50,7 @@ wasm = [ [dependencies] async-std = { version = "= 1.10.0", features = ["unstable"], optional = true } base64 = { version = "0.21", optional = true } -futures = "0.3" -futures-util = { version = "0.3", optional = true } +futures-channel = { version = "0.3", optional = true } getrandom = { version = "0.2", optional = true } http = "0.2" isahc = { version = "1.4", default-features = false, optional = true } @@ -82,5 +80,6 @@ optional = true [dev-dependencies] opentelemetry_sdk = { version = "0.19.0", features = ["rt-tokio"] } +futures-util = { version = "0.3", default-features = false } tokio = { version = "1.0", default-features = false, features = ["macros", "rt-multi-thread", "sync", "test-util"] } hyper = { version = "0.14", default-features = false, features = ["server", "tcp", "http1"] } diff --git a/opentelemetry-dynatrace/src/metric.rs b/opentelemetry-dynatrace/src/metric.rs index c9ed3e180f..7f9a56d8ec 100644 --- a/opentelemetry-dynatrace/src/metric.rs +++ b/opentelemetry-dynatrace/src/metric.rs @@ -233,7 +233,7 @@ pub struct MetricsExporter { sender: Arc>>, #[cfg(all(not(feature = "rt-tokio"), feature = "rt-async-std"))] - sender: Arc>>, + sender: Arc>>, endpoint: Uri, @@ -292,7 +292,7 @@ impl MetricsExporter { })); #[cfg(all(not(feature = "rt-tokio"), feature = "rt-async-std"))] - let (sender, mut receiver) = futures::channel::mpsc::channel::(2); + let (sender, mut receiver) = futures_channel::mpsc::channel::(2); #[cfg(all(not(feature = "rt-tokio"), feature = "rt-async-std"))] async_std::task::spawn(Box::pin(async move { diff --git a/opentelemetry-dynatrace/tests/http_test.rs b/opentelemetry-dynatrace/tests/http_test.rs index 92a9faf729..7baad7240f 100644 --- a/opentelemetry-dynatrace/tests/http_test.rs +++ b/opentelemetry-dynatrace/tests/http_test.rs @@ -1,6 +1,6 @@ #[cfg(all(feature = "metrics", feature = "rt-tokio"))] mod test { - use futures::future::BoxFuture; + use futures_util::future::BoxFuture; use http::header::{HeaderValue, AUTHORIZATION, USER_AGENT}; use hyper::{ body, @@ -20,18 +20,18 @@ mod test { tick_rx: tokio::sync::watch::Receiver, } impl runtime::Runtime for TestRuntime { - type Interval = futures::stream::Once>; + type Interval = futures_util::stream::Once>; type Delay = Pin>; fn interval(&self, _duration: Duration) -> Self::Interval { let mut tick_rx = self.tick_rx.clone(); - futures::stream::once(Box::pin(async move { + futures_util::stream::once(Box::pin(async move { let _ = tick_rx.changed().await.is_ok(); })) } - fn spawn(&self, future: futures::future::BoxFuture<'static, ()>) { + fn spawn(&self, future: BoxFuture<'static, ()>) { tokio::spawn(future); } diff --git a/opentelemetry-otlp/Cargo.toml b/opentelemetry-otlp/Cargo.toml index 22e20766d6..85785fb901 100644 --- a/opentelemetry-otlp/Cargo.toml +++ b/opentelemetry-otlp/Cargo.toml @@ -51,7 +51,7 @@ tokio-stream = { version = "0.1", features = ["net"] } opentelemetry_sdk = { features = ["trace", "rt-tokio", "testing"], path = "../opentelemetry-sdk" } time = { version = "0.3", features = ["macros"] } tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } -futures = { version = "0.3", default-features = false, features = ["std"] } +futures-util = { version = "0.3", default-features = false } [features] # telemetry pillars and functions diff --git a/opentelemetry-otlp/tests/smoke.rs b/opentelemetry-otlp/tests/smoke.rs index 45c3b7c45f..f7e4df0b65 100644 --- a/opentelemetry-otlp/tests/smoke.rs +++ b/opentelemetry-otlp/tests/smoke.rs @@ -1,4 +1,4 @@ -use futures::StreamExt; +use futures_util::StreamExt; use opentelemetry::global::shutdown_tracer_provider; use opentelemetry::trace::{Span, SpanKind, Tracer}; use opentelemetry_otlp::WithExportConfig; diff --git a/opentelemetry-stackdriver/Cargo.toml b/opentelemetry-stackdriver/Cargo.toml index 857121378e..14a8fbe097 100644 --- a/opentelemetry-stackdriver/Cargo.toml +++ b/opentelemetry-stackdriver/Cargo.toml @@ -42,4 +42,4 @@ tempfile = "3.3.0" tokio = "1" tonic-build = "0.9.0" walkdir = "2.3.2" -futures = "0.3" +futures-util = {version = "0.3", default-features = false }