refactor(gateway): shorten logging targets from sgl_model_gateway to smg (#16328)

This commit is contained in:
Chang Su
2026-01-02 21:12:33 -08:00
committed by GitHub
parent 9821fae5c6
commit b23e7ed13c
8 changed files with 22 additions and 22 deletions
@@ -9,7 +9,7 @@ use super::otel_trace::is_otel_enabled;
/// Module path used by CustomOtelFilter to identify events for OTEL export.
#[inline]
pub const fn get_module_path() -> &'static str {
"sgl_model_gateway::observability::events"
"smg::observability::events"
}
pub trait Event {
@@ -16,7 +16,7 @@ use super::otel_trace::get_otel_layer;
use crate::config::TraceConfig;
const TIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S";
const DEFAULT_LOG_TARGET: &str = "sgl_model_gateway";
const DEFAULT_LOG_TARGET: &str = "smg";
#[derive(Debug, Clone)]
pub struct LoggingConfig {
@@ -36,7 +36,7 @@ impl Default for LoggingConfig {
json_format: false,
log_dir: None,
colorize: true,
log_file_name: "sgl-model-gateway".to_string(),
log_file_name: "smg".to_string(),
log_targets: Some(vec![DEFAULT_LOG_TARGET.to_string()]),
}
}
@@ -38,8 +38,8 @@ static ALLOWED_TARGETS: OnceLock<[&'static str; 3]> = OnceLock::new();
fn get_allowed_targets() -> &'static [&'static str; 3] {
ALLOWED_TARGETS.get_or_init(|| {
[
"sgl_model_gateway::otel-trace",
"sgl_model_gateway::observability::otel_trace",
"smg::otel-trace",
"smg::observability::otel_trace",
events_module_path(),
]
})
@@ -118,7 +118,7 @@ pub fn otel_tracing_init(enable: bool, otlp_endpoint: Option<&str>) -> Result<()
let resource = Resource::default().merge(&Resource::new(vec![KeyValue::new(
"service.name",
"sgl-router",
"smg",
)]));
let provider = TracerProvider::builder()
@@ -130,7 +130,7 @@ pub fn otel_tracing_init(enable: bool, otlp_endpoint: Option<&str>) -> Result<()
.set(provider.clone())
.map_err(|_| anyhow::anyhow!("Provider already initialized"))?;
let tracer = provider.tracer("sgl-router");
let tracer = provider.tracer("smg");
TRACER
.set(tracer)