Skip to content

Commit

Permalink
use futures-util instead of futures and with no default features
Browse files Browse the repository at this point in the history
  • Loading branch information
shaun-cox authored and djc committed Aug 30, 2023
1 parent d6f0cfc commit 8748fb8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion opentelemetry-contrib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-datadog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
7 changes: 3 additions & 4 deletions opentelemetry-dynatrace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 }
Expand Down Expand Up @@ -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"] }
4 changes: 2 additions & 2 deletions opentelemetry-dynatrace/src/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub struct MetricsExporter {
sender: Arc<Mutex<tokio::sync::mpsc::Sender<ClientMessage>>>,

#[cfg(all(not(feature = "rt-tokio"), feature = "rt-async-std"))]
sender: Arc<Mutex<futures::channel::mpsc::Sender<ClientMessage>>>,
sender: Arc<Mutex<futures_channel::mpsc::Sender<ClientMessage>>>,

endpoint: Uri,

Expand Down Expand Up @@ -292,7 +292,7 @@ impl MetricsExporter {
}));

#[cfg(all(not(feature = "rt-tokio"), feature = "rt-async-std"))]
let (sender, mut receiver) = futures::channel::mpsc::channel::<ClientMessage>(2);
let (sender, mut receiver) = futures_channel::mpsc::channel::<ClientMessage>(2);

#[cfg(all(not(feature = "rt-tokio"), feature = "rt-async-std"))]
async_std::task::spawn(Box::pin(async move {
Expand Down
8 changes: 4 additions & 4 deletions opentelemetry-dynatrace/tests/http_test.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -20,18 +20,18 @@ mod test {
tick_rx: tokio::sync::watch::Receiver<usize>,
}
impl runtime::Runtime for TestRuntime {
type Interval = futures::stream::Once<BoxFuture<'static, ()>>;
type Interval = futures_util::stream::Once<BoxFuture<'static, ()>>;

type Delay = Pin<Box<tokio::time::Sleep>>;

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);
}

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/tests/smoke.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-stackdriver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit 8748fb8

Please sign in to comment.