Merge pull request #181 from ajmirsky/issue/180

fix: $SYS broker stats plugin, topics
pull/184/head^2
Andrew Mirsky 2025-05-29 13:20:36 -04:00 zatwierdzone przez GitHub
commit 52faed680b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
3 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -1,3 +1,3 @@
"""INIT."""
__version__ = "0.11.0-beta4"
__version__ = "0.11.0-rc"

Wyświetl plik

@ -196,7 +196,7 @@ class PluginManager:
@staticmethod
async def _call_coro(plugin: Plugin, coro_name: str, *args: Any, **kwargs: Any) -> str | bool | None:
if not hasattr(plugin.object, coro_name):
_LOGGER.warning("Plugin doesn't implement coro_name")
_LOGGER.warning(f"Plugin doesn't implement coro_name '{coro_name}': {plugin.name}")
return None
coro: Awaitable[str | bool | None] = getattr(plugin.object, coro_name)(*args, **kwargs)

Wyświetl plik

@ -80,7 +80,7 @@ class BrokerSysPlugin:
async def on_broker_post_start(self, *args: None, **kwargs: None) -> None:
"""Initialize statistics and start $SYS broadcasting."""
self._stats[STAT_START_TIME] = int(datetime.now(tz=UTC).timestamp())
version = f"HBMQTT version {amqtt.__version__}"
version = f"aMQTT version {amqtt.__version__}"
self.context.retain_message(DOLLAR_SYS_ROOT + "version", version.encode())
# Start $SYS topics management
@ -131,8 +131,8 @@ class BrokerSysPlugin:
"messages/received": self._stats[STAT_MSG_RECEIVED],
"messages/sent": self._stats[STAT_MSG_SENT],
"time": int(datetime.now(tz=UTC).timestamp()),
"uptime": str(datetime.fromtimestamp(uptime, UTC)),
"uptime/formatted": str(uptime),
"uptime": str(uptime),
"uptime/formatted": str(datetime.fromtimestamp(self._stats[STAT_START_TIME], UTC)),
"clients/connected": client_connected,
"clients/disconnected": client_disconnected,
"clients/maximum": self._stats[STAT_CLIENTS_MAXIMUM],