diff --git a/aprsd/plugins/email.py b/aprsd/plugins/email.py index 12657a1..b7cd526 100644 --- a/aprsd/plugins/email.py +++ b/aprsd/plugins/email.py @@ -12,6 +12,7 @@ import imapclient from oslo_config import cfg from aprsd import packets, plugin, threads, utils +from aprsd.stats import collector from aprsd.threads import tx from aprsd.utils import trace @@ -126,6 +127,11 @@ class EmailPlugin(plugin.APRSDRegexCommandPluginBase): shortcuts = _build_shortcuts_dict() LOG.info(f"Email shortcuts {shortcuts}") + + # Register the EmailStats producer with the stats collector + # We do this here to prevent EmailStats from being registered + # when email is not enabled in the config file. + collector.Collector().register_producer(EmailStats) else: LOG.info("Email services not enabled.") self.enabled = False diff --git a/aprsd/stats/__init__.py b/aprsd/stats/__init__.py index 2059a65..0e68df7 100644 --- a/aprsd/stats/__init__.py +++ b/aprsd/stats/__init__.py @@ -1,7 +1,6 @@ from aprsd import plugin from aprsd.client import stats as client_stats from aprsd.packets import packet_list, seen_list, tracker, watch_list -from aprsd.plugins import email from aprsd.stats import app, collector from aprsd.threads import aprsd @@ -15,6 +14,5 @@ stats_collector.register_producer(watch_list.WatchList) stats_collector.register_producer(tracker.PacketTrack) stats_collector.register_producer(plugin.PluginManager) stats_collector.register_producer(aprsd.APRSDThreadList) -stats_collector.register_producer(email.EmailStats) stats_collector.register_producer(client_stats.APRSClientStats) stats_collector.register_producer(seen_list.SeenList)