feat: Add telemetry, timing, and detailed logging across server, stub, and nvim-core
This commit is contained in:
1 parent
26cf6cee80
commit
2fdb03c302
4 files changed
+62
-4
No files matched your search
+14
-1
@@ -524,9 +524,18 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) {
|
||||
|
||||
tokio::spawn(async move {
|
||||
let id = msg.id.clone().unwrap_or(json!(null));
|
||||
let _start_time = std::time::Instant::now();
|
||||
let id_clone = id.clone();
|
||||
let start_time = std::time::Instant::now();
|
||||
let method_clone = if msg.method == "tools/call" {
|
||||
let tool_name = msg.params.as_ref().and_then(|p| p.get("name")).and_then(|n| n.as_str()).unwrap_or("unknown");
|
||||
format!("ToolCall[{}]", tool_name)
|
||||
} else {
|
||||
msg.method.clone()
|
||||
};
|
||||
|
||||
|
||||
match msg.method.as_str() {
|
||||
|
||||
"initialize" => {
|
||||
let init = rmcp::model::InitializeResult::new(
|
||||
rmcp::model::ServerCapabilities::builder()
|
||||
@@ -818,10 +827,14 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) {
|
||||
}
|
||||
}
|
||||
}
|
||||
let elapsed = start_time.elapsed();
|
||||
tracing::info!("<<< [Nvim] {} (id: {}) completed in {:?}", method_clone, id_clone, elapsed);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn init_logging(app_name: &str) -> tracing_appender::non_blocking::WorkerGuard {
|
||||
let log_dir = dirs::home_dir()
|
||||
.unwrap_or_default()
|
||||
|
||||
Reference in new issue
Block a user