mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-17 02:12:56 +00:00
add support for tokio-console & make deps opt-in via feature
This commit is contained in:
45
Cargo.lock
generated
45
Cargo.lock
generated
@@ -1323,6 +1323,45 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console-api"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8030735ecb0d128428b64cd379809817e620a40e5001c54465b99ec5feec2857"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"prost",
|
||||
"prost-types",
|
||||
"tonic",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console-subscriber"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6539aa9c6a4cd31f4b1c040f860a1eac9aa80e7df6b05d506a6e7179936d6a01"
|
||||
dependencies = [
|
||||
"console-api",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-utils",
|
||||
"futures-task",
|
||||
"hdrhistogram",
|
||||
"humantime",
|
||||
"hyper-util",
|
||||
"prost",
|
||||
"prost-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thread_local",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tonic",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
@@ -6652,6 +6691,7 @@ dependencies = [
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"tracing",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
@@ -6985,9 +7025,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-chrome"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "496b3cd5447f7ff527bbbf19b071ad542a000adf297d4127078b4dfdb931f41a"
|
||||
checksum = "bf0a738ed5d6450a9fb96e86a23ad808de2b727fd1394585da5cdd6788ffe724"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
"tracing-core",
|
||||
@@ -7281,6 +7321,7 @@ dependencies = [
|
||||
"camino",
|
||||
"camino-tempfile",
|
||||
"chrono",
|
||||
"console-subscriber",
|
||||
"const_format",
|
||||
"criterion",
|
||||
"diatomic-waker",
|
||||
|
||||
@@ -78,6 +78,7 @@ cfg-if = "1.0.0"
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock"] }
|
||||
clap = { version = "4.0", features = ["derive", "env"] }
|
||||
comfy-table = "7.1"
|
||||
console-subscriber = "0.4.1"
|
||||
const_format = "0.2"
|
||||
crc32c = "0.6"
|
||||
dashmap = { version = "5.5.0", features = ["raw-api"] }
|
||||
@@ -189,7 +190,9 @@ toml_edit = "0.22"
|
||||
tonic = {version = "0.12.3", features = ["tls", "tls-roots"]}
|
||||
tower-service = "0.3.2"
|
||||
tracing = "0.1"
|
||||
tracing-chrome = "0.7.2"
|
||||
tracing-error = "0.2"
|
||||
tracing-flame = "0.2.0"
|
||||
tracing-opentelemetry = "0.27"
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["smallvec", "fmt", "tracing-log", "std", "env-filter", "json"] }
|
||||
try-lock = "0.2.5"
|
||||
|
||||
@@ -10,6 +10,10 @@ default = []
|
||||
# which adds some runtime cost to run tests on outage conditions
|
||||
testing = ["fail/failpoints"]
|
||||
|
||||
# Enables debugging functionality that's based on the `tracing` crate,
|
||||
# e.g., tokio-console or tracing-chrome.
|
||||
tracing-based-debugging = [ "console-subscriber", "tracing-chrome", "tracing-flame", "tokio/tracing" ]
|
||||
|
||||
[dependencies]
|
||||
arc-swap.workspace = true
|
||||
sentry.workspace = true
|
||||
@@ -20,6 +24,7 @@ bincode.workspace = true
|
||||
bytes.workspace = true
|
||||
camino.workspace = true
|
||||
chrono.workspace = true
|
||||
console-subscriber = {workspace = true, optional = true}
|
||||
diatomic-waker.workspace = true
|
||||
flate2.workspace = true
|
||||
git-version.workspace = true
|
||||
@@ -47,7 +52,9 @@ tokio-tar.workspace = true
|
||||
tokio-util.workspace = true
|
||||
toml_edit = { workspace = true, features = ["serde"] }
|
||||
tracing.workspace = true
|
||||
tracing-chrome = { workspace = true, optional = true }
|
||||
tracing-error.workspace = true
|
||||
tracing-flame = { workspace = true, optional = true }
|
||||
tracing-subscriber = { workspace = true, features = ["json", "registry"] }
|
||||
rand.workspace = true
|
||||
scopeguard.workspace = true
|
||||
@@ -66,8 +73,6 @@ const_format.workspace = true
|
||||
# to use tokio channels as streams, this is faster to compile than async_stream
|
||||
# why is it only here? no other crate should use it, streams are rarely needed.
|
||||
tokio-stream = { version = "0.1.14" }
|
||||
tracing-chrome = "0.7.1"
|
||||
tracing-flame = "0.2.0"
|
||||
|
||||
serde_path_to_error.workspace = true
|
||||
|
||||
@@ -80,6 +85,9 @@ camino-tempfile.workspace = true
|
||||
serde_assert.workspace = true
|
||||
tokio = { workspace = true, features = ["test-util"] }
|
||||
|
||||
[lints.rust]
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
|
||||
|
||||
[[bench]]
|
||||
name = "benchmarks"
|
||||
harness = false
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use std::{
|
||||
io::BufWriter,
|
||||
num::NonZeroUsize,
|
||||
str::FromStr,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
@@ -189,6 +190,36 @@ pub fn init(
|
||||
},
|
||||
);
|
||||
|
||||
let r = {
|
||||
let varname = "NEON_UTILS_LOGGING_ENABLE_TOKIO_CONSOLE";
|
||||
let console_subscriber_config: Option<NonZeroUsize> = crate::env::var(varname);
|
||||
#[cfg(tokio_unstable)]
|
||||
{
|
||||
r.with(match console_subscriber_config {
|
||||
Some(n) => {
|
||||
use console_subscriber::ConsoleLayer;
|
||||
Some(
|
||||
console_subscriber::Builder::default()
|
||||
.event_buffer_capacity(
|
||||
n.get() * ConsoleLayer::DEFAULT_EVENT_BUFFER_CAPACITY,
|
||||
)
|
||||
.client_buffer_capacity(
|
||||
n.get() * ConsoleLayer::DEFAULT_CLIENT_BUFFER_CAPACITY,
|
||||
)
|
||||
.spawn(),
|
||||
)
|
||||
}
|
||||
None => None,
|
||||
})
|
||||
}
|
||||
#[cfg(not(tokio_unstable))]
|
||||
if console_subscriber_config.is_some() {
|
||||
panic!("recompile with --cfg tokio_unstable to enable {varname}");
|
||||
} else {
|
||||
r
|
||||
}
|
||||
};
|
||||
|
||||
let r = r.with(match tracing_error_layer_enablement {
|
||||
TracingErrorLayerEnablement::EnableWithRustLogFilter => {
|
||||
Some(tracing_error::ErrorLayer::default().with_filter(rust_log_env_filter()))
|
||||
|
||||
Reference in New Issue
Block a user