diff --git a/plugins/zenoh-plugin-trait/src/manager.rs b/plugins/zenoh-plugin-trait/src/manager.rs index ef5ceb0ee7..2aa754906a 100644 --- a/plugins/zenoh-plugin-trait/src/manager.rs +++ b/plugins/zenoh-plugin-trait/src/manager.rs @@ -322,21 +322,21 @@ impl P ); let mut plugins = Vec::new(); for plugin in self.declared_plugins_iter() { - let name = unsafe { keyexpr::from_str_unchecked(plugin.name()) }; - if names.includes(name) { + let id = unsafe { keyexpr::from_str_unchecked(plugin.id()) }; + if names.includes(id) { let status = PluginStatusRec::new(plugin.as_status()); plugins.push(status); } // for running plugins append their subplugins prepended with the running plugin name if let Some(plugin) = plugin.loaded() { if let Some(plugin) = plugin.started() { - if let [names, ..] = names.strip_prefix(name)[..] { + if let [names, ..] = names.strip_prefix(id)[..] { plugins.append( &mut plugin .instance() .plugins_status(names) .into_iter() - .map(|s| s.prepend_name(name)) + .map(|s| s.prepend_name(id)) .collect(), ); } diff --git a/plugins/zenoh-plugin-trait/src/manager/static_plugin.rs b/plugins/zenoh-plugin-trait/src/manager/static_plugin.rs index 3fabaf21e8..a77be2f815 100644 --- a/plugins/zenoh-plugin-trait/src/manager/static_plugin.rs +++ b/plugins/zenoh-plugin-trait/src/manager/static_plugin.rs @@ -106,10 +106,10 @@ where } fn start(&mut self, args: &StartArgs) -> ZResult<&mut dyn StartedPlugin> { if self.instance.is_none() { - tracing::debug!("Plugin `{}` started", self.name()); + tracing::debug!("Plugin `{}` started", self.id()); self.instance = Some(P::start(self.id(), args)?); } else { - tracing::warn!("Plugin `{}` already started", self.name()); + tracing::warn!("Plugin `{}` already started", self.id()); } Ok(self) } diff --git a/zenoh/src/net/runtime/adminspace.rs b/zenoh/src/net/runtime/adminspace.rs index ff44b19e62..2a8ec088b8 100644 --- a/zenoh/src/net/runtime/adminspace.rs +++ b/zenoh/src/net/runtime/adminspace.rs @@ -103,20 +103,21 @@ impl AdminSpace { start_args: &Runtime, required: bool, ) -> ZResult<()> { + let id = &config.id; let name = &config.name; - let declared = if let Some(declared) = plugin_mgr.plugin_mut(name) { - tracing::warn!("Plugin `{}` was already declared", declared.name()); + let declared = if let Some(declared) = plugin_mgr.plugin_mut(id) { + tracing::warn!("Plugin `{}` was already declared", declared.id()); declared } else if let Some(paths) = &config.paths { - plugin_mgr.declare_dynamic_plugin_by_paths(name, name, paths, required)? + plugin_mgr.declare_dynamic_plugin_by_paths(id, name, paths, required)? } else { - plugin_mgr.declare_dynamic_plugin_by_name(name, name, required)? + plugin_mgr.declare_dynamic_plugin_by_name(id, name, required)? }; let loaded = if let Some(loaded) = declared.loaded_mut() { tracing::warn!( "Plugin `{}` was already loaded from {}", - loaded.name(), + loaded.id(), loaded.path() ); loaded @@ -125,12 +126,12 @@ impl AdminSpace { }; if let Some(started) = loaded.started_mut() { - tracing::warn!("Plugin `{}` was already started", started.name()); + tracing::warn!("Plugin `{}` was already started", started.id()); } else { let started = loaded.start(start_args)?; tracing::info!( "Successfully started plugin `{}` from {}", - started.name(), + started.id(), started.path() ); }; @@ -768,7 +769,7 @@ fn plugins_data(context: &AdminContext, query: Query) { let statuses = guard.plugins_status(names); for status in statuses { tracing::debug!("plugin status: {:?}", status); - let key = root_key.join(status.name()).unwrap(); + let key = root_key.join(status.id()).unwrap(); let status = serde_json::to_value(status).unwrap(); if let Err(e) = query.reply(Ok(Sample::new(key, Value::from(status)))).res() { tracing::error!("Error sending AdminSpace reply: {:?}", e); @@ -834,15 +835,15 @@ fn plugins_status(context: &AdminContext, query: Query) { } } Ok(Err(e)) => { - tracing::error!("Plugin {} bailed from responding to {}: {}", plugin.name(), query.key_expr(), e) + tracing::error!("Plugin {} bailed from responding to {}: {}", plugin.id(), query.key_expr(), e) } Err(e) => match e .downcast_ref::() .map(|s| s.as_str()) .or_else(|| e.downcast_ref::<&str>().copied()) { - Some(e) => tracing::error!("Plugin {} panicked while responding to {}: {}", plugin.name(), query.key_expr(), e), - None => tracing::error!("Plugin {} panicked while responding to {}. The panic message couldn't be recovered.", plugin.name(), query.key_expr()), + Some(e) => tracing::error!("Plugin {} panicked while responding to {}: {}", plugin.id(), query.key_expr(), e), + None => tracing::error!("Plugin {} panicked while responding to {}. The panic message couldn't be recovered.", plugin.id(), query.key_expr()), }, } }); diff --git a/zenoh/src/plugins/loader.rs b/zenoh/src/plugins/loader.rs index 2e9695b395..c037ba4c4a 100644 --- a/zenoh/src/plugins/loader.rs +++ b/zenoh/src/plugins/loader.rs @@ -24,7 +24,7 @@ pub(crate) fn load_plugin( required: bool, ) -> ZResult<()> { let declared = if let Some(declared) = plugin_mgr.plugin_mut(name) { - tracing::warn!("Plugin `{}` was already declared", declared.name()); + tracing::warn!("Plugin `{}` was already declared", declared.id()); declared } else if let Some(paths) = paths { plugin_mgr.declare_dynamic_plugin_by_paths(name, id, paths, required)? @@ -35,7 +35,7 @@ pub(crate) fn load_plugin( if let Some(loaded) = declared.loaded_mut() { tracing::warn!( "Plugin `{}` was already loaded from {}", - loaded.name(), + loaded.id(), loaded.path() ); } else { @@ -76,13 +76,13 @@ pub(crate) fn start_plugins(runtime: &Runtime) { tracing::info!( "Starting {req} plugin \"{name}\"", req = if required { "required" } else { "" }, - name = plugin.name() + name = plugin.id() ); match plugin.start(runtime) { Ok(_) => { tracing::info!( "Successfully started plugin {} from {:?}", - plugin.name(), + plugin.id(), plugin.path() ); } @@ -94,7 +94,7 @@ pub(crate) fn start_plugins(runtime: &Runtime) { if required { panic!( "Plugin \"{}\" failed to start: {}", - plugin.name(), + plugin.id(), if report.is_empty() { "no details provided" } else { @@ -104,7 +104,7 @@ pub(crate) fn start_plugins(runtime: &Runtime) { } else { tracing::error!( "Required plugin \"{}\" failed to start: {}", - plugin.name(), + plugin.id(), if report.is_empty() { "no details provided" } else {