cluster/zeromq: Improve XPUB stall behavior, add a metric

Instead of fprintf, track the number of occurrences via a metric and
change the sleep loop to a blocking send instead.
This commit is contained in:
Arne Welzel 2025-03-25 20:31:06 +01:00
parent 33d7e5a7bf
commit bfffc8dac8
2 changed files with 40 additions and 14 deletions

View file

@ -10,7 +10,15 @@
#include "zeek/cluster/Serializer.h"
#include "zeek/cluster/backend/zeromq/ZeroMQ-Proxy.h"
namespace zeek::cluster::zeromq {
namespace zeek {
namespace telemetry {
class Counter;
using CounterPtr = std::shared_ptr<Counter>;
} // namespace telemetry
namespace cluster::zeromq {
class ZeroMQBackend : public cluster::ThreadedBackend {
public:
@ -105,6 +113,9 @@ private:
// Tracking the subscriptions on the local XPUB socket.
std::map<std::string, SubscribeCallback> subscription_callbacks;
std::set<std::string> xpub_subscriptions;
zeek::telemetry::CounterPtr total_xpub_stalls;
};
} // namespace zeek::cluster::zeromq
} // namespace cluster::zeromq
} // namespace zeek