Skip to content
Clone

feat(metrics): count git protocol operations over ssh

ZhenYi committed
parent d3d11f4 commit 39d7e6b Browse files

1 file changed

+9 −1

Modified lib/git/src/ssh/handler/channel.rs View lib/git/src/ssh/handler/channel.rs
@@ -386,13 +386,17 @@
386386 rx: tokio::sync::mpsc::UnboundedReceiver<Vec<u8>>,
387387) -> tokio::task::AbortHandle {
388388 let op = state.git_op.clone();
389 let service = state.git_op.as_ref().map(|o| o.service_arg().to_string());
389 let service = state.git_op.as_ref().map(|o| o.service_arg());
390390 let timeout_secs = state.rpc_timeout_secs;
391391 let task = tokio::spawn(async move {
392392 let Some(op) = op else {
393393 return;
394394 };
395395 let result = streaming_git(&op, &handle, channel, rx, timeout_secs).await;
396 export::metrics::git_op(
397 op.service_arg(),
398 if result.is_ok() { "ok" } else { "error" },
399 );
396400 match &result {
397401 Ok(()) => tracing::debug!(?channel, "ssh streaming git finished"),
398402 Err(e) => tracing::warn!(?channel, error = %e, "ssh streaming git failed"),
@@ -710,6 +714,10 @@
710714 }
711715 }
712716 .await;
717 export::metrics::git_op(
718 op.service_arg(),
719 if result.is_ok() { "ok" } else { "error" },
720 );
713721 result
714722}
715723