[Rust Frontend] Extract shared tracing setup logic into vllm-tracing (#50129)
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
Generated
+11
-3
@@ -5503,9 +5503,9 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
|
||||||
"url",
|
"url",
|
||||||
"uuid",
|
"uuid",
|
||||||
|
"vllm-tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5570,17 +5570,16 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_with",
|
"serde_with",
|
||||||
"thiserror-ext",
|
"thiserror-ext",
|
||||||
"time",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
|
||||||
"uuid",
|
"uuid",
|
||||||
"vllm-bench",
|
"vllm-bench",
|
||||||
"vllm-chat",
|
"vllm-chat",
|
||||||
"vllm-engine-core-client",
|
"vllm-engine-core-client",
|
||||||
"vllm-managed-engine",
|
"vllm-managed-engine",
|
||||||
"vllm-server",
|
"vllm-server",
|
||||||
|
"vllm-tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5827,6 +5826,15 @@ dependencies = [
|
|||||||
"vllm-parser",
|
"vllm-parser",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vllm-tracing"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"time",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "walkdir"
|
name = "walkdir"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ members = [
|
|||||||
"src/server",
|
"src/server",
|
||||||
"src/text",
|
"src/text",
|
||||||
"src/tokenizer",
|
"src/tokenizer",
|
||||||
|
"src/tracing",
|
||||||
]
|
]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
|
|
||||||
@@ -143,6 +144,7 @@ vllm-parser = { path = "src/parser" }
|
|||||||
vllm-server = { path = "src/server" }
|
vllm-server = { path = "src/server" }
|
||||||
vllm-text = { path = "src/text" }
|
vllm-text = { path = "src/text" }
|
||||||
vllm-tokenizer = { path = "src/tokenizer" }
|
vllm-tokenizer = { path = "src/tokenizer" }
|
||||||
|
vllm-tracing = { path = "src/tracing" }
|
||||||
winnow = { version = "1.0.2", features = ["simd"] }
|
winnow = { version = "1.0.2", features = ["simd"] }
|
||||||
xgrammar-structural-tag = "0.2.0"
|
xgrammar-structural-tag = "0.2.0"
|
||||||
zeromq = { version = "0.6.0", default-features = false, features = [
|
zeromq = { version = "0.6.0", default-features = false, features = [
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ tokenizers.workspace = true
|
|||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
tokio-stream.workspace = true
|
tokio-stream.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
|
||||||
url.workspace = true
|
url.workspace = true
|
||||||
uuid.workspace = true
|
uuid.workspace = true
|
||||||
|
vllm-tracing.workspace = true
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|||||||
@@ -19,18 +19,8 @@ struct Cli {
|
|||||||
args: vllm_bench::BenchServeArgs,
|
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<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
init_tracing();
|
vllm_tracing::init_tracing("Bench");
|
||||||
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
vllm_bench::prepare_process();
|
vllm_bench::prepare_process();
|
||||||
|
|||||||
@@ -23,17 +23,16 @@ serde.workspace = true
|
|||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde_with.workspace = true
|
serde_with.workspace = true
|
||||||
thiserror-ext.workspace = true
|
thiserror-ext.workspace = true
|
||||||
time.workspace = true
|
|
||||||
tokio = { workspace = true, features = ["signal"] }
|
tokio = { workspace = true, features = ["signal"] }
|
||||||
tokio-util.workspace = true
|
tokio-util.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
|
||||||
uuid.workspace = true
|
uuid.workspace = true
|
||||||
vllm-bench.workspace = true
|
vllm-bench.workspace = true
|
||||||
vllm-chat.workspace = true
|
vllm-chat.workspace = true
|
||||||
vllm-engine-core-client.workspace = true
|
vllm-engine-core-client.workspace = true
|
||||||
vllm-managed-engine.workspace = true
|
vllm-managed-engine.workspace = true
|
||||||
vllm-server.workspace = true
|
vllm-server.workspace = true
|
||||||
|
vllm-tracing.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
expect-test.workspace = true
|
expect-test.workspace = true
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
|
|
||||||
mod cli;
|
mod cli;
|
||||||
mod logging;
|
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
@@ -89,7 +88,7 @@ fn main() -> Result<()> {
|
|||||||
"serve" | "frontend" => "RustFrontend",
|
"serve" | "frontend" => "RustFrontend",
|
||||||
_ => "Rust",
|
_ => "Rust",
|
||||||
};
|
};
|
||||||
logging::init_tracing(process_label);
|
vllm_tracing::init_tracing(process_label);
|
||||||
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
|
|||||||
@@ -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-License-Identifier: Apache-2.0
|
||||||
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
|
|
||||||
|
//! Shared tracing subscriber and log formatting for vLLM Rust binaries.
|
||||||
|
|
||||||
use std::{env, fmt, process};
|
use std::{env, fmt, process};
|
||||||
|
|
||||||
use time::UtcOffset;
|
use time::UtcOffset;
|
||||||
@@ -26,8 +28,8 @@ const RESET: &str = "\x1b[0m";
|
|||||||
const VLLM_TIME_FORMAT: &[time::format_description::FormatItem<'static>] =
|
const VLLM_TIME_FORMAT: &[time::format_description::FormatItem<'static>] =
|
||||||
format_description!("[month]-[day] [hour]:[minute]:[second]");
|
format_description!("[month]-[day] [hour]:[minute]:[second]");
|
||||||
|
|
||||||
/// Install the process-wide vLLM-style tracing subscriber for the CLI binary.
|
/// Install the process-wide vLLM-style tracing subscriber.
|
||||||
pub(crate) fn init_tracing(process_label: &str) {
|
pub fn init_tracing(process_label: &str) {
|
||||||
let filter = build_targets_filter(
|
let filter = build_targets_filter(
|
||||||
env::var("VLLM_LOGGING_LEVEL").ok().as_deref(),
|
env::var("VLLM_LOGGING_LEVEL").ok().as_deref(),
|
||||||
env::var("RUST_LOG").ok().as_deref(),
|
env::var("RUST_LOG").ok().as_deref(),
|
||||||
Reference in New Issue
Block a user