Skip to content

Commit

Permalink
chore: reduce dependencies on futures
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Jan 29, 2025
1 parent d9ddde1 commit a65a533
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ fastrace-jaeger = { path = "fastrace-jaeger" }
fastrace-opentelemetry = { path = "fastrace-opentelemetry" }

# crates.io dependencies
futures = { version = "0.3" }
log = { version = "0.4" }
serde = { version = "1.0", features = ["derive"] }

Expand Down
1 change: 0 additions & 1 deletion fastrace-datadog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ rmp-serde = "1.3"
serde = { workspace = true }

[dev-dependencies]
futures = { workspace = true }
6 changes: 4 additions & 2 deletions fastrace-futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ rust-version.workspace = true

[dependencies]
fastrace = { workspace = true }
futures = { workspace = true }
futures-core = { version = "0.3.31" }
futures-sink = { version = "0.3.31" }
pin-project = { version = "1.1.8" }

[dev-dependencies]
async-stream = "0.3"
async-stream = { version = "0.3" }
futures = { version = "0.3" }
tokio = { version = "1.38", features = ["rt", "time", "macros"] }
4 changes: 2 additions & 2 deletions fastrace-futures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::task::Context;
use std::task::Poll;

use fastrace::Span;
use futures::Sink;
use futures::Stream;
use futures_core::Stream;
use futures_sink::Sink;

/// An extension trait for [`Stream`] that provides tracing instrument adapters.
pub trait StreamExt: Stream + Sized {
Expand Down
1 change: 0 additions & 1 deletion fastrace-jaeger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ log = { workspace = true }
thrift_codec = "0.3"

[dev-dependencies]
futures = { workspace = true }
2 changes: 1 addition & 1 deletion fastrace-opentelemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ rust-version.workspace = true

[dependencies]
fastrace = { workspace = true }
futures = { workspace = true, features = ["executor"] }
log = { workspace = true }
opentelemetry = { version = "0.27", features = ["trace"] }
opentelemetry_sdk = { version = "0.27", features = ["trace"] }
pollster = { version = "0.4.0" }

[dev-dependencies]
opentelemetry-otlp = { version = "0.27", features = ["trace"] }
Expand Down
2 changes: 1 addition & 1 deletion fastrace-opentelemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl OpenTelemetryReporter {

fn try_report(&mut self, spans: Vec<SpanRecord>) -> Result<(), Box<dyn std::error::Error>> {
let spans = self.convert(spans);
futures::executor::block_on(self.exporter.export(spans))?;
pollster::block_on(self.exporter.export(spans))?;
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion fastrace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ fastrace-datadog = { workspace = true }
fastrace-jaeger = { workspace = true }
fastrace-opentelemetry = { workspace = true }
flume = "0.11"
futures = { workspace = true }
futures-timer = "3"
log = { workspace = true }
logcall = "0.1"
Expand All @@ -45,6 +44,7 @@ mockall = "0.13"
opentelemetry = { version = "0.27", features = ["trace"] }
opentelemetry-otlp = { version = "0.27", features = ["trace"] }
opentelemetry_sdk = { version = "0.27", features = ["trace"] }
pollster = { version = "0.4.0" }
rand = "0.9"
rustracing = "0.6"
serial_test = "3.1"
Expand Down
2 changes: 1 addition & 1 deletion fastrace/benches/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn bench_trace_future(c: &mut Criterion) {
group.bench_function(len.to_string(), |b| {
b.iter(|| {
let root = Span::root("root", SpanContext::new(TraceId(12), SpanId::default()));
futures::executor::block_on(f(*len).in_span(root));
pollster::block_on(f(*len).in_span(root));
})
});
}
Expand Down
2 changes: 1 addition & 1 deletion fastrace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
//! use fastrace::collector::Config;
//! use fastrace::collector::ConsoleReporter;
//! use fastrace::prelude::*;
//! use futures::executor::block_on;
//! use pollster::block_on;
//!
//! #[trace]
//! fn do_something(i: u64) {
Expand Down
2 changes: 1 addition & 1 deletion fastrace/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use fastrace::collector::TestReporter;
use fastrace::local::LocalCollector;
use fastrace::prelude::*;
use fastrace::util::tree::tree_str_from_span_records;
use futures::executor::block_on;
use pollster::block_on;
use serial_test::serial;
use tokio::runtime::Builder;

Expand Down

0 comments on commit a65a533

Please sign in to comment.