volo_http/context/stat.rs
1//! HTTP request and response statistics shared across client and server contexts.
2
3use chrono::{DateTime, Local};
4use http::{method::Method, status::StatusCode, uri::Uri};
5
6/// Shared HTTP statistics captured for every request on both client and server sides
7#[derive(Debug, Default, Clone)]
8pub struct CommonStats {
9 /// The time at which request processing began
10 pub process_start_time: DateTime<Local>,
11
12 /// The time at which request processing completed
13 pub process_end_time: DateTime<Local>,
14
15 /// The HTTP method of the request (e.g. `GET`, `POST`)
16 pub method: Method,
17
18 /// The full URI of the request
19 pub uri: Uri,
20
21 /// The HTTP status code of the response.
22 ///
23 /// Status code may be None if the service failed
24 pub status_code: Option<StatusCode>,
25
26 /// Size of the request body in bytes
27 pub req_size: i64,
28
29 /// Size of the response body in bytes
30 pub resp_size: i64,
31
32 /// Whether the request resulted in an error
33 pub is_error: bool,
34}