[model-gateway] Improve logging in data_connector module (#15495)

This commit is contained in:
Simo Lin
2025-12-19 10:57:18 -10:00
committed by GitHub
parent d72e908ba5
commit b5eb0214ca
3 changed files with 7 additions and 6 deletions

View File

@@ -1,8 +1,6 @@
// factory.rs
//
// Factory function to create storage backends based on configuration.
// This centralizes storage initialization logic and fixes the bug where
// conversation_item_storage was missing/incorrect in server.rs.
use std::sync::Arc;

View File

@@ -332,9 +332,11 @@ impl ResponseStorage for MemoryResponseStorage {
.push(response_id.clone());
}
// Store the response
store.responses.insert(response_id.clone(), response);
tracing::info!("memory_store_size" = store.responses.len());
tracing::debug!(
memory_store_size = store.responses.len(),
"Response stored in memory"
);
Ok(response_id)
}
@@ -345,7 +347,7 @@ impl ResponseStorage for MemoryResponseStorage {
) -> ResponseResult<Option<StoredResponse>> {
let store = self.store.read();
let result = store.responses.get(response_id).cloned();
tracing::info!("memory_get_response" = %response_id.0, found = result.is_some());
tracing::debug!(response_id = %response_id.0, found = result.is_some(), "Memory response lookup");
Ok(result)
}

View File

@@ -13,6 +13,7 @@ use chrono::{DateTime, Utc};
use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod};
use serde_json::Value;
use tokio_postgres::{NoTls, Row};
use tracing;
use crate::{
config::PostgresConfig,
@@ -588,7 +589,7 @@ impl ResponseStorage for PostgresResponseStorage {
&conversation_id,
&json_raw_response,
]).await.unwrap();
println!("INSERT INTO responses VALUES {insert_count}");
tracing::debug!(rows_affected = insert_count, "Response stored in Postgres");
Ok(response_id)
}