Open bigsmoke opened 2 months ago
Bonus point if this can be done from non-worker threads.
One issue with publishing directly to $SYS
is that the topics appear at a different time from FlashMQ's own $SYS
topics. What we can perhaps do, is expose GlobalStats::setExtra to the plugin. That also takes care of the publishing from any thread.
I haven't quite glanced the overall role of GlobalStats
yet. Are all these stats published simultaneously, with the same flags in terms of retention and such? If that's the case, I think that what you propose would be just what's needed for writing $SYS
topics from plugins.
Although I could think of scenarios in which plugins would want to GlobalStats.setExtra()
at a higher frequency than that the whole GlobalStats
collection is published, I can't think of a scenario in which it matters (much) if the occasional intermediate stat is missed. I'm guessing that at the very least your idea will be more than sufficient for the majority of cases. And otherwise it might still be preferable to up the GlobalStats
publish frequency rather than making it possible for plugins to directly publish to $SYS
topics.
It would be nice if plugins could publish to
$SYS
topics, for plugin-specfic stats.