From 7de855506464bc686f379813c063882d7425177e Mon Sep 17 00:00:00 2001 From: Maria Kuklina Date: Wed, 29 Mar 2023 16:44:10 +0200 Subject: [PATCH 1/3] collect separate metrics for root alised services and worker spells --- particle-services/src/app_services.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/particle-services/src/app_services.rs b/particle-services/src/app_services.rs index 7ff5430e01..0daca6ae29 100644 --- a/particle-services/src/app_services.rs +++ b/particle-services/src/app_services.rs @@ -383,7 +383,17 @@ impl ParticleAppServices { // )); // } - let service_type = ServiceType::Service(service.aliases.first().cloned()); + // Metrics collection are enables for services with aliases which are installed on root worker or worker spells. + let allowed_alias = if worker_id == self.config.local_peer_id { + service.aliases.first().cloned() + } else { + if service.aliases.iter().any(|alias| alias == "worker-spell") { + Some("worker-spell".to_string()) + } else { + None + } + }; + let service_type = ServiceType::Service(allowed_alias); // TODO: move particle vault creation to aquamarine::particle_functions self.create_vault(&particle.id)?; From 048a4cc79b67695bbdfd31eb494c2ba5b6e42ca2 Mon Sep 17 00:00:00 2001 From: Maria Kuklina Date: Fri, 31 Mar 2023 15:42:17 +0200 Subject: [PATCH 2/3] fix lint --- particle-services/src/app_services.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/particle-services/src/app_services.rs b/particle-services/src/app_services.rs index 3c111c4b34..5ac1a1da57 100644 --- a/particle-services/src/app_services.rs +++ b/particle-services/src/app_services.rs @@ -428,12 +428,10 @@ impl ParticleAppServices { // Metrics collection are enables for services with aliases which are installed on root worker or worker spells. let allowed_alias = if worker_id == self.config.local_peer_id { service.aliases.first().cloned() + } else if service.aliases.iter().any(|alias| alias == "worker-spell") { + Some("worker-spell".to_string()) } else { - if service.aliases.iter().any(|alias| alias == "worker-spell") { - Some("worker-spell".to_string()) - } else { - None - } + None }; let service_type = ServiceType::Service(allowed_alias); From b29bdc0ce324551c090822ad85970bd23bca60e3 Mon Sep 17 00:00:00 2001 From: Maria Kuklina Date: Tue, 4 Apr 2023 16:07:48 +0200 Subject: [PATCH 3/3] check only first alias --- particle-services/src/app_services.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/particle-services/src/app_services.rs b/particle-services/src/app_services.rs index 5ac1a1da57..44aee9dfd0 100644 --- a/particle-services/src/app_services.rs +++ b/particle-services/src/app_services.rs @@ -428,7 +428,12 @@ impl ParticleAppServices { // Metrics collection are enables for services with aliases which are installed on root worker or worker spells. let allowed_alias = if worker_id == self.config.local_peer_id { service.aliases.first().cloned() - } else if service.aliases.iter().any(|alias| alias == "worker-spell") { + } else if service + .aliases + .first() + .map(|alias| alias == "worker-spell") + .unwrap_or(false) + { Some("worker-spell".to_string()) } else { None