pub struct RequestContext {
pub request_id: String,
pub user_id: Option<Uuid>,
pub team_id: Option<Uuid>,
pub api_key_id: Option<Uuid>,
pub client_ip: Option<String>,
pub user_agent: Option<String>,
pub timestamp: DateTime<Utc>,
pub headers: HashMap<String, String>,
pub trace_id: Option<String>,
pub span_id: Option<String>,
}Expand description
Request context information
Fields§
§request_id: StringRequest ID
user_id: Option<Uuid>User ID (if authenticated)
team_id: Option<Uuid>Team ID (if applicable)
api_key_id: Option<Uuid>API Key ID (if using API key auth)
client_ip: Option<String>Client IP address
user_agent: Option<String>User agent
timestamp: DateTime<Utc>Request timestamp
headers: HashMap<String, String>Additional headers
trace_id: Option<String>Trace ID for distributed tracing
span_id: Option<String>Span ID for distributed tracing
Implementations§
Source§impl RequestContext
impl RequestContext
Sourcepub fn with_api_key(self, api_key_id: Uuid) -> Self
pub fn with_api_key(self, api_key_id: Uuid) -> Self
Set API key information
Sourcepub fn with_client_info(
self,
ip: Option<String>,
user_agent: Option<String>,
) -> Self
pub fn with_client_info( self, ip: Option<String>, user_agent: Option<String>, ) -> Self
Set client information
Sourcepub fn with_tracing(self, trace_id: String, span_id: String) -> Self
pub fn with_tracing(self, trace_id: String, span_id: String) -> Self
Set tracing information
Trait Implementations§
Source§impl Clone for RequestContext
impl Clone for RequestContext
Source§fn clone(&self) -> RequestContext
fn clone(&self) -> RequestContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RequestContext
impl Debug for RequestContext
Source§impl Default for RequestContext
impl Default for RequestContext
Source§impl<'de> Deserialize<'de> for RequestContext
impl<'de> Deserialize<'de> for RequestContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RequestContext
impl RefUnwindSafe for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnwindSafe for RequestContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CacheValue for T
impl<T> CacheValue for T
Source§fn from_bytes(bytes: &[u8]) -> Result<T, CacheError>
fn from_bytes(bytes: &[u8]) -> Result<T, CacheError>
Deserialize from bytes
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.