Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dropshot/src/dtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub(crate) struct ResponseInfo {
pub remote_addr: std::net::SocketAddr,
pub status_code: u16,
pub message: String,
pub latency: std::time::Duration,
}

#[cfg(feature = "usdt-probes")]
Expand Down
9 changes: 7 additions & 2 deletions dropshot/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ async fn http_request_handle_wrap<C: ServerContext>(
// In the case the client disconnects early, the scopeguard allows us
// to perform extra housekeeping before this task is dropped.
let on_disconnect = guard((), |_| {
let latency_us = start_time.elapsed().as_micros();
let latency = start_time.elapsed();
let latency_us = latency.as_micros();

warn!(request_log, "request handling cancelled (client disconnected)";
"latency_us" => latency_us,
Expand All @@ -813,6 +814,7 @@ async fn http_request_handle_wrap<C: ServerContext>(
message: String::from(
"client disconnected before response returned",
),
latency,
}
});
});
Expand All @@ -830,7 +832,8 @@ async fn http_request_handle_wrap<C: ServerContext>(
// cancelled and we can safely "defuse" the scopeguard.
let _ = ScopeGuard::into_inner(on_disconnect);

let latency_us = start_time.elapsed().as_micros();
let latency = start_time.elapsed();
let latency_us = latency.as_micros();
let response = match maybe_response {
Err(error) => {
{
Expand All @@ -848,6 +851,7 @@ async fn http_request_handle_wrap<C: ServerContext>(
message: message_external
.cloned()
.unwrap_or_else(|| message_internal.clone()),
latency,
}
});

Expand Down Expand Up @@ -877,6 +881,7 @@ async fn http_request_handle_wrap<C: ServerContext>(
remote_addr,
status_code: response.status().as_u16(),
message: "".to_string(),
latency,
}
});

Expand Down