Super tiny remove unused log_request (#15035)
This commit is contained in:
@@ -380,62 +380,6 @@ pub fn create_logging_layer() -> TraceLayer<
|
||||
.on_response(ResponseLogger::default())
|
||||
}
|
||||
|
||||
/// Structured logging data for requests
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct RequestLogEntry {
|
||||
pub timestamp: String,
|
||||
pub request_id: String,
|
||||
pub method: String,
|
||||
pub uri: String,
|
||||
pub status: u16,
|
||||
pub latency_ms: u64,
|
||||
pub user_agent: Option<String>,
|
||||
pub remote_addr: Option<String>,
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
/// Log a request with structured data
|
||||
pub fn log_request(entry: RequestLogEntry) {
|
||||
if entry.status >= 500 {
|
||||
tracing::error!(
|
||||
target: "sgl_model_gateway::http",
|
||||
request_id = %entry.request_id,
|
||||
method = %entry.method,
|
||||
uri = %entry.uri,
|
||||
status = entry.status,
|
||||
latency_ms = entry.latency_ms,
|
||||
user_agent = ?entry.user_agent,
|
||||
remote_addr = ?entry.remote_addr,
|
||||
error = ?entry.error,
|
||||
"HTTP request failed"
|
||||
);
|
||||
} else if entry.status >= 400 {
|
||||
tracing::warn!(
|
||||
target: "sgl_model_gateway::http",
|
||||
request_id = %entry.request_id,
|
||||
method = %entry.method,
|
||||
uri = %entry.uri,
|
||||
status = entry.status,
|
||||
latency_ms = entry.latency_ms,
|
||||
user_agent = ?entry.user_agent,
|
||||
remote_addr = ?entry.remote_addr,
|
||||
"HTTP request client error"
|
||||
);
|
||||
} else {
|
||||
tracing::info!(
|
||||
target: "sgl_model_gateway::http",
|
||||
request_id = %entry.request_id,
|
||||
method = %entry.method,
|
||||
uri = %entry.uri,
|
||||
status = entry.status,
|
||||
latency_ms = entry.latency_ms,
|
||||
user_agent = ?entry.user_agent,
|
||||
remote_addr = ?entry.remote_addr,
|
||||
"HTTP request completed"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Request queue entry
|
||||
pub struct QueuedRequest {
|
||||
/// Time when the request was queued
|
||||
|
||||
Reference in New Issue
Block a user