[Rust Frontend] Extract shared tracing setup logic into vllm-tracing (#50129)

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
Bugen Zhao
2026-07-28 19:31:15 +00:00
committed by GitHub
parent 118bcde449
commit d552a68645
8 changed files with 35 additions and 21 deletions
+11 -3
View File
@@ -5503,9 +5503,9 @@ dependencies = [
"tokio",
"tokio-stream",
"tracing",
"tracing-subscriber",
"url",
"uuid",
"vllm-tracing",
]
[[package]]
@@ -5570,17 +5570,16 @@ dependencies = [
"serde_json",
"serde_with",
"thiserror-ext",
"time",
"tokio",
"tokio-util",
"tracing",
"tracing-subscriber",
"uuid",
"vllm-bench",
"vllm-chat",
"vllm-engine-core-client",
"vllm-managed-engine",
"vllm-server",
"vllm-tracing",
]
[[package]]
@@ -5827,6 +5826,15 @@ dependencies = [
"vllm-parser",
]
[[package]]
name = "vllm-tracing"
version = "0.1.0"
dependencies = [
"time",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "walkdir"
version = "2.5.0"
+2
View File
@@ -13,6 +13,7 @@ members = [
"src/server",
"src/text",
"src/tokenizer",
"src/tracing",
]
resolver = "3"
@@ -143,6 +144,7 @@ vllm-parser = { path = "src/parser" }
vllm-server = { path = "src/server" }
vllm-text = { path = "src/text" }
vllm-tokenizer = { path = "src/tokenizer" }
vllm-tracing = { path = "src/tracing" }
winnow = { version = "1.0.2", features = ["simd"] }
xgrammar-structural-tag = "0.2.0"
zeromq = { version = "0.6.0", default-features = false, features = [
+1 -1
View File
@@ -32,9 +32,9 @@ tokenizers.workspace = true
tokio.workspace = true
tokio-stream.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
url.workspace = true
uuid.workspace = true
vllm-tracing.workspace = true
[lints]
workspace = true
+1 -11
View File
@@ -19,18 +19,8 @@ struct Cli {
args: vllm_bench::BenchServeArgs,
}
// TODO: unify the tracing subscriber used by different binaries.
fn init_tracing() {
let filter = tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info"));
let _ = tracing_subscriber::fmt()
.with_env_filter(filter)
.with_writer(std::io::stderr)
.try_init();
}
fn main() -> anyhow::Result<()> {
init_tracing();
vllm_tracing::init_tracing("Bench");
let cli = Cli::parse();
vllm_bench::prepare_process();
+1 -2
View File
@@ -23,17 +23,16 @@ serde.workspace = true
serde_json.workspace = true
serde_with.workspace = true
thiserror-ext.workspace = true
time.workspace = true
tokio = { workspace = true, features = ["signal"] }
tokio-util.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
uuid.workspace = true
vllm-bench.workspace = true
vllm-chat.workspace = true
vllm-engine-core-client.workspace = true
vllm-managed-engine.workspace = true
vllm-server.workspace = true
vllm-tracing.workspace = true
[dev-dependencies]
expect-test.workspace = true
+1 -2
View File
@@ -2,7 +2,6 @@
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
mod cli;
mod logging;
use std::env;
use std::ffi::OsStr;
@@ -89,7 +88,7 @@ fn main() -> Result<()> {
"serve" | "frontend" => "RustFrontend",
_ => "Rust",
};
logging::init_tracing(process_label);
vllm_tracing::init_tracing(process_label);
let cli = Cli::parse();
+14
View File
@@ -0,0 +1,14 @@
[package]
name = "vllm-tracing"
version.workspace = true
edition.workspace = true
description = "Shared tracing subscriber and log formatting for vLLM Rust binaries"
license.workspace = true
[dependencies]
time.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
[lints]
workspace = true
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
//! Shared tracing subscriber and log formatting for vLLM Rust binaries.
use std::{env, fmt, process};
use time::UtcOffset;
@@ -26,8 +28,8 @@ const RESET: &str = "\x1b[0m";
const VLLM_TIME_FORMAT: &[time::format_description::FormatItem<'static>] =
format_description!("[month]-[day] [hour]:[minute]:[second]");
/// Install the process-wide vLLM-style tracing subscriber for the CLI binary.
pub(crate) fn init_tracing(process_label: &str) {
/// Install the process-wide vLLM-style tracing subscriber.
pub fn init_tracing(process_label: &str) {
let filter = build_targets_filter(
env::var("VLLM_LOGGING_LEVEL").ok().as_deref(),
env::var("RUST_LOG").ok().as_deref(),