deps: update to tokio 0.3

This uses a git dependency on Hyper for now.
This commit is contained in:
Henry de Valence 2020-11-19 12:31:37 -08:00
parent 7ef47304ed
commit 971133128e
3 changed files with 11 additions and 5 deletions

View File

@ -9,3 +9,7 @@ members = [
"metrics-tracing-context", "metrics-tracing-context",
] ]
exclude = ["metrics-observer"] exclude = ["metrics-observer"]
[patch.crates-io]
hyper = { git = "https://github.com/hyperium/hyper/", rev = "ed2b22a7f66899d338691552fbcb6c0f2f4e06b9" }

View File

@ -27,8 +27,8 @@ parking_lot = "0.11"
thiserror = "1.0" thiserror = "1.0"
# Optional # Optional
hyper = { version = "0.13", default-features = false, features = ["tcp"], optional = true } hyper = { version = "0.14.0-dev", default-features = false, features = ["tcp", "server", "http1", "http2"], optional = true }
tokio = { version = "0.2", features = ["rt-core", "tcp", "time", "macros"], optional = true } tokio = { version = "0.3", features = ["rt", "net", "time", "macros"], optional = true }
[dev-dependencies] [dev-dependencies]
quanta = "0.6" quanta = "0.6"

View File

@ -443,12 +443,14 @@ impl PrometheusBuilder {
/// installing the recorder as the global recorder. /// installing the recorder as the global recorder.
#[cfg(feature = "tokio-exporter")] #[cfg(feature = "tokio-exporter")]
pub fn install(self) -> Result<(), Error> { pub fn install(self) -> Result<(), Error> {
let mut runtime = runtime::Builder::new() let runtime = runtime::Builder::new_current_thread()
.basic_scheduler()
.enable_all() .enable_all()
.build()?; .build()?;
let (recorder, exporter) = runtime.enter(|| self.build_with_exporter())?; let (recorder, exporter) = {
let _guard = runtime.enter();
self.build_with_exporter()
}?;
metrics::set_boxed_recorder(Box::new(recorder))?; metrics::set_boxed_recorder(Box::new(recorder))?;
thread::Builder::new() thread::Builder::new()