add tokio-console

This commit is contained in:
Conrad Ludgate
2024-04-19 14:54:22 +01:00
parent 1a979cd27e
commit e8a5e0b0ed
5 changed files with 125 additions and 15 deletions

View File

@@ -85,7 +85,7 @@ tokio-postgres.workspace = true
tokio-postgres-rustls.workspace = true
tokio-rustls.workspace = true
tokio-util.workspace = true
tokio = { workspace = true, features = ["signal"] }
tokio = { workspace = true, features = ["signal", "tracing"] }
tracing-opentelemetry.workspace = true
tracing-subscriber.workspace = true
tracing-utils.workspace = true
@@ -99,6 +99,8 @@ x509-parser.workspace = true
postgres-protocol.workspace = true
redis.workspace = true
console-subscriber = "0.2.0"
workspace_hack.workspace = true
[dev-dependencies]

View File

@@ -26,7 +26,12 @@ pub async fn init() -> anyhow::Result<LoggingGuard> {
.await
.map(OpenTelemetryLayer::new);
// spawn the console server in the background,
// returning a `Layer`:
let console_layer = console_subscriber::spawn();
tracing_subscriber::registry()
.with(console_layer)
.with(env_filter)
.with(otlp_layer)
.with(fmt_layer)