From 101dd99d3e61311a06f3b8bb5d5f122714a4604b Mon Sep 17 00:00:00 2001 From: meowjesty Date: Tue, 31 Dec 2024 16:43:35 -0300 Subject: [PATCH] filtered port --- mirrord/agent/src/steal/subscriptions.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mirrord/agent/src/steal/subscriptions.rs b/mirrord/agent/src/steal/subscriptions.rs index 880af28a93c..0a01c0d36df 100644 --- a/mirrord/agent/src/steal/subscriptions.rs +++ b/mirrord/agent/src/steal/subscriptions.rs @@ -195,7 +195,14 @@ impl PortSubscriptions { ) -> Result, R::Error> { let add_redirect = match self.subscriptions.entry(port) { Entry::Occupied(mut e) => { + let filtered = filter.is_some(); if e.get_mut().try_extend(client_id, filter) { + if filtered { + STEAL_FILTERED_PORT_SUBSCRIPTION.inc(); + } else { + STEAL_UNFILTERED_PORT_SUBSCRIPTION.inc(); + } + Ok(false) } else { Err(ResponseError::PortAlreadyStolen(port)) @@ -203,6 +210,12 @@ impl PortSubscriptions { } Entry::Vacant(e) => { + if filter.is_some() { + STEAL_FILTERED_PORT_SUBSCRIPTION.inc(); + } else { + STEAL_UNFILTERED_PORT_SUBSCRIPTION.inc(); + } + e.insert(PortSubscription::new(client_id, filter)); Ok(true) }