Skip to main content

RequestLog

Struct RequestLog 

Source
pub struct RequestLog {
Show 20 fields pub request_id: String, pub client_ip: String, pub client_country: Option<String>, pub client_province: Option<String>, pub client_city: Option<String>, pub host: Option<String>, pub method: String, pub path: String, pub origin: Option<String>, pub user_agent: Option<String>, pub referer: Option<String>, pub request_parts: Option<String>, pub request_time: i64, pub response_time: i64, pub elapsed: i64, pub status_code: Option<u16>, pub content_type: Option<String>, pub response_size: Option<usize>, pub response_parts: Option<String>, pub node_address: String,
}
Expand description

网关请求日志

Fields§

§request_id: String

请求ID,由网关统一生成,唯一的请求标识,标准的36位UUID

§client_ip: String

客户端IP地址,通过该地址定位到客户端所在区域

§client_country: Option<String>

客户端所在国家

§client_province: Option<String>

客户端所在省份

§client_city: Option<String>

客户端所在城市

§host: Option<String>

Host,从Header取

§method: String

请求方式,如GET、POST、PUT、DELETE等

§path: String

请求路径,不含query参数

§origin: Option<String>§user_agent: Option<String>

取Header里的User-Agent

§referer: Option<String>

取Header里的Referer

§request_parts: Option<String>

原始请求的Parts部分(未经过网关处理)

§request_time: i64

请求时间戳,即网关收到请求的时刻,单位:毫秒

§response_time: i64

响应时间戳,即网关将响应发送到客户端前的时刻,单位:毫秒

§elapsed: i64

耗时。统计从接收到请求开始到响应客户端之前的时间,单位:毫秒。

§status_code: Option<u16>

HTTP状态码

§content_type: Option<String>

响应内容类型,从Header取

§response_size: Option<usize>

响应大小,流式响应为None

§response_parts: Option<String>

最终响应给客户端的的Parts部分

§node_address: String

网关节点地址,格式:ip:port,该字段用于记录请求被哪个网关节点处理

Trait Implementations§

Source§

impl Clone for RequestLog

Source§

fn clone(&self) -> RequestLog

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RequestLog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RequestLog

Source§

fn default() -> RequestLog

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RequestLog

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RequestLog

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,