mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 08:09:24 +00:00
fix: add tokio console (#3175)
Debug mode: ``` RUSTFLAGS="--cfg tokio_unstable" cargo build --features=tokio-console ``` Relase mode: ``` RUSTFLAGS="--cfg tokio_unstable" cargo build --features=tokio-console --profile=release-profiling ```
This commit is contained in:
Generated
+52
@@ -2203,6 +2203,43 @@ dependencies = [
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console-api"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd326812b3fd01da5bb1af7d340d0d555fd3d4b641e7f1dfcf5962a902952787"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"prost 0.12.3",
|
||||
"prost-types 0.12.3",
|
||||
"tonic 0.10.2",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console-subscriber"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7481d4c57092cd1c19dd541b92bdce883de840df30aa5d03fd48a3935c01842e"
|
||||
dependencies = [
|
||||
"console-api",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-utils",
|
||||
"futures-task",
|
||||
"hdrhistogram",
|
||||
"humantime",
|
||||
"prost-types 0.12.3",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thread_local",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tonic 0.10.2",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
@@ -3581,6 +3618,19 @@ dependencies = [
|
||||
"hashbrown 0.14.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hdrhistogram"
|
||||
version = "7.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d"
|
||||
dependencies = [
|
||||
"base64 0.21.7",
|
||||
"byteorder",
|
||||
"flate2",
|
||||
"nom",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
@@ -4916,6 +4966,7 @@ dependencies = [
|
||||
"clap 4.5.4",
|
||||
"cloudevents-sdk",
|
||||
"config",
|
||||
"console-subscriber",
|
||||
"cron",
|
||||
"csv",
|
||||
"dashmap",
|
||||
@@ -7534,6 +7585,7 @@ dependencies = [
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"tracing",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
|
||||
+3
-1
@@ -25,6 +25,7 @@ publish = false
|
||||
mimalloc = ["dep:mimalloc"]
|
||||
jemalloc = ["dep:tikv-jemallocator"]
|
||||
profiling = ["dep:pyroscope", "dep:pyroscope_pprofrs"]
|
||||
tokio-console = ["dep:console-subscriber"]
|
||||
|
||||
[profile.release]
|
||||
debug = false
|
||||
@@ -140,6 +141,7 @@ time.workspace = true
|
||||
tikv-jemallocator = { version = "0.5", optional = true }
|
||||
tokio.workspace = true
|
||||
tokio-stream.workspace = true
|
||||
console-subscriber = { version = "0.2", optional = true }
|
||||
tonic.workspace = true
|
||||
tracing.workspace = true
|
||||
tracing-appender.workspace = true
|
||||
@@ -197,7 +199,7 @@ byteorder = "1.4.3"
|
||||
chromiumoxide = { git = "https://github.com/mattsse/chromiumoxide", features = [
|
||||
"tokio-runtime",
|
||||
"_fetcher-rusttls-tokio",
|
||||
], default-features = false, rev = "348967500868c2b5dfcb3930fe483b2ff17b35ff"}
|
||||
], default-features = false, rev = "348967500868c2b5dfcb3930fe483b2ff17b35ff" }
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock"] }
|
||||
cityhasher = { version = "0.1", default-features = false }
|
||||
dashmap = { version = "5.5", features = ["serde"] }
|
||||
|
||||
+10
-1
@@ -92,6 +92,9 @@ use tracing_subscriber::{
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), anyhow::Error> {
|
||||
#[cfg(feature = "tokio-console")]
|
||||
console_subscriber::init();
|
||||
|
||||
// let tokio steal the thread
|
||||
let rt_handle = tokio::runtime::Handle::current();
|
||||
std::thread::spawn(move || {
|
||||
@@ -120,7 +123,13 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
}
|
||||
|
||||
// setup logs
|
||||
let _guard: Option<WorkerGuard> = if CONFIG.log.events_enabled {
|
||||
#[cfg(feature = "tokio-console")]
|
||||
let enable_tokio_console = true;
|
||||
#[cfg(not(feature = "tokio-console"))]
|
||||
let enable_tokio_console = false;
|
||||
let _guard: Option<WorkerGuard> = if enable_tokio_console {
|
||||
None
|
||||
} else if CONFIG.log.events_enabled {
|
||||
let logger = zo_logger::ZoLogger {
|
||||
sender: zo_logger::EVENT_SENDER.clone(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user