pub struct DeceptiveCanaryRouter { /* private fields */ }Expand description
Deceptive canary router
Handles routing logic for deceptive canary mode.
Implementations§
Source§impl DeceptiveCanaryRouter
impl DeceptiveCanaryRouter
Sourcepub fn new(config: DeceptiveCanaryConfig) -> Self
pub fn new(config: DeceptiveCanaryConfig) -> Self
Create a new deceptive canary router
Sourcepub fn should_route_to_canary(
&self,
user_agent: Option<&str>,
ip_address: Option<&str>,
headers: &HashMap<String, String>,
query_params: &HashMap<String, String>,
user_id: Option<&str>,
) -> bool
pub fn should_route_to_canary( &self, user_agent: Option<&str>, ip_address: Option<&str>, headers: &HashMap<String, String>, query_params: &HashMap<String, String>, user_id: Option<&str>, ) -> bool
Check if a request should be routed to deceptive deploy
§Arguments
user_agent- User agent string from requestip_address- Client IP addressheaders- Request headersquery_params- Query parametersuser_id- Optional user ID for consistent hashing
§Returns
True if request should be routed to deceptive deploy
Sourcepub fn config(&self) -> &DeceptiveCanaryConfig
pub fn config(&self) -> &DeceptiveCanaryConfig
Get current configuration
Sourcepub fn update_config(&mut self, config: DeceptiveCanaryConfig)
pub fn update_config(&mut self, config: DeceptiveCanaryConfig)
Update configuration
Sourcepub fn stats(&self) -> Option<&CanaryStats>
pub fn stats(&self) -> Option<&CanaryStats>
Get routing statistics
Sourcepub fn record_request(&self, routed: bool, opted_out: bool, matched: bool)
pub fn record_request(&self, routed: bool, opted_out: bool, matched: bool)
Update statistics (thread-safe)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeceptiveCanaryRouter
impl RefUnwindSafe for DeceptiveCanaryRouter
impl Send for DeceptiveCanaryRouter
impl Sync for DeceptiveCanaryRouter
impl Unpin for DeceptiveCanaryRouter
impl UnwindSafe for DeceptiveCanaryRouter
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> 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 more