diff --git a/src/clients.rs b/src/clients.rs index 91f64ba2..964a8937 100644 --- a/src/clients.rs +++ b/src/clients.rs @@ -442,12 +442,8 @@ impl OnRequest> for ClientOnRequest { trace_id = %current_trace_id(), method = %request.method(), path = %request.uri().path(), - "started processing request", - ); - info!( monotonic_counter.incoming_request_count = 1, - request_method = request.method().as_str(), - request_path = request.uri().path() + "started processing request", ); } } @@ -458,45 +454,25 @@ pub struct ClientOnResponse; impl OnResponse for ClientOnResponse { fn on_response(self, response: &Response, latency: Duration, span: &Span) { let _guard = span.enter(); + // On every response info!( trace_id = %current_trace_id(), status = %response.status(), duration_ms = %latency.as_millis(), - "finished processing request", - ); - - // On every response - info!( monotonic_counter.client_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); - info!( histogram.client_request_duration = latency.as_millis() as u64, - response_status = response.status().as_u16() + "finished processing request", ); if response.status().is_server_error() { // On every server error (HTTP 5xx) response - info!( - monotonic_counter.client_5xx_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); + info!(monotonic_counter.client_5xx_response_count = 1); } else if response.status().is_client_error() { // On every client error (HTTP 4xx) response - info!( - monotonic_counter.client_4xx_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); + info!(monotonic_counter.client_4xx_response_count = 1); } else if response.status().is_success() { // On every successful (HTTP 2xx) response - info!( - monotonic_counter.client_success_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); + info!(monotonic_counter.client_success_response_count = 1); } else { error!( "unexpected gRPC client response status code: {}", @@ -533,11 +509,6 @@ impl OnFailure for ClientOnFailure { info!( monotonic_counter.client_request_failure_count = 1, - latency_ms, - ?status_code, - ?error - ); - info!( monotonic_counter.client_5xx_response_count = 1, latency_ms, ?status_code, @@ -555,13 +526,10 @@ impl OnEos for ClientOnEos { info!( trace_id = %current_trace_id(), duration_ms = stream_duration.as_millis(), - "end of stream", - ); - info!( monotonic_counter.client_stream_response_count = 1, - stream_duration = stream_duration.as_millis() + histogram.client_stream_response_duration = stream_duration.as_millis() as u64, + "end of stream", ); - info!(histogram.client_stream_response_duration = stream_duration.as_millis() as u64); } } diff --git a/src/clients/http.rs b/src/clients/http.rs index f880dfd9..daf8a9fc 100644 --- a/src/clients/http.rs +++ b/src/clients/http.rs @@ -351,12 +351,8 @@ impl OnRequest> for ClientOnRequest { trace_id = %trace::current_trace_id(), method = %request.method(), path = %request.uri().path(), - "started processing request", - ); - info!( monotonic_counter.incoming_request_count = 1, - request_method = request.method().as_str(), - request_path = request.uri().path() + "started processing request", ); } } @@ -367,45 +363,25 @@ pub struct ClientOnResponse; impl OnResponse for ClientOnResponse { fn on_response(self, response: &hyper::Response, latency: Duration, span: &Span) { let _guard = span.enter(); + // On every response info!( trace_id = %trace::current_trace_id(), status = %response.status(), duration_ms = %latency.as_millis(), - "finished processing request", - ); - - // On every response - info!( monotonic_counter.client_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); - info!( histogram.client_request_duration = latency.as_millis() as u64, - response_status = response.status().as_u16() + "finished processing request" ); if response.status().is_server_error() { // On every server error (HTTP 5xx) response - info!( - monotonic_counter.client_5xx_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); + info!(monotonic_counter.client_5xx_response_count = 1); } else if response.status().is_client_error() { // On every client error (HTTP 4xx) response - info!( - monotonic_counter.client_4xx_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); + info!(monotonic_counter.client_4xx_response_count = 1); } else if response.status().is_success() { // On every successful (HTTP 2xx) response - info!( - monotonic_counter.client_success_response_count = 1, - response_status = response.status().as_u16(), - request_duration = latency.as_millis() - ); + info!(monotonic_counter.client_success_response_count = 1); } else { error!( "unexpected HTTP client response status code: {}", @@ -432,8 +408,8 @@ impl OnFailure for ClientOnFailure { let (status_code, error) = match failure_classification { ServerErrorsFailureClass::StatusCode(status_code) => { error!( - ?trace_id, - ?status_code, + %trace_id, + %status_code, latency_ms, "failure handling request", ); @@ -447,11 +423,6 @@ impl OnFailure for ClientOnFailure { info!( monotonic_counter.client_request_failure_count = 1, - latency_ms, - ?status_code, - ?error - ); - info!( monotonic_counter.client_5xx_response_count = 1, latency_ms, ?status_code, @@ -469,13 +440,10 @@ impl OnEos for ClientOnEos { info!( trace_id = %trace::current_trace_id(), duration_ms = stream_duration.as_millis(), - "end of stream", - ); - info!( monotonic_counter.client_stream_response_count = 1, - stream_duration = stream_duration.as_millis() + histogram.client_stream_response_duration = stream_duration.as_millis() as u64, + "end of stream", ); - info!(histogram.client_stream_response_duration = stream_duration.as_millis() as u64); } }