|
conduit 0.6.0
Modern C++23 header-only event-dispatching / event-transport library
|
Always-on, backend-agnostic prom metrics for the conduit event system. More...
#include <prom/prom.hpp>#include <memory>

Go to the source code of this file.
Namespaces | |
| namespace | conduit |
| namespace | conduit::metrics |
Functions | |
| std::shared_ptr< prom::Scope > & | conduit::metrics::scope () |
The shared conduit scope; applies the conduit_ prefix to every metric. | |
| prom::Counter & | conduit::metrics::events_published () |
Envelopes that entered the dispatch pipeline (one per Bus::publish). | |
| prom::Counter & | conduit::metrics::events_dropped () |
Envelopes dropped before listener fan-out (a middleware before_dispatch returned false, or a routing conflict). | |
| prom::Counter & | conduit::metrics::listener_invocations () |
| Listener handler calls during fan-out (counts every matched listener, summed over all delivered envelopes). | |
| prom::Counter & | conduit::metrics::listener_errors () |
| Listener handlers that threw during fan-out. | |
| prom::Counter & | conduit::metrics::transport_errors () |
Transport-level inbound failures, selected by the transport label ("redis", "amqp", "zmq", "mqtt", "nats", …). | |
| prom::Gauge & | conduit::metrics::listeners () |
| Live listener subscriptions across all buses in the process. | |
| prom::Histogram & | conduit::metrics::dispatch_seconds () |
| Wall-clock seconds from publish to the end of the synchronous dispatch pipeline. | |
Always-on, backend-agnostic prom metrics for the conduit event system.
Every accessor returns a long-lived metric handle created on first call via a shared prom::Scope named "conduit" (metric prefix "conduit_"), cached in a static-local. Metrics are always-on and safe by default: until a host application installs a backend via prom::Registry::global()->set_adapter(...), every metric op is a noexcept no-op through prom's NullAdapter. This header never installs an adapter.
The recording sites live in bus.hpp: the Bus instruments its own publish / fan-out / error / subscription paths directly rather than through a metrics middleware. That keeps event-level telemetry on by default with no consumer API call, and — unlike a middleware — still counts envelopes published with flags::NoMiddleware, which bypass the middleware pipeline entirely. Pool / worker / thread telemetry comes for free from threadman's own prom instrumentation. Histograms observe seconds.
Labels. The bus attaches the most specific label it can derive at each site: event-level series carry {event=<name>} (the concrete event name, or a listener's name/pattern for conduit_listeners), and conduit_transport_errors_total carries {transport=<adapter>}. conduit emits whatever is derivable and leaves cardinality control to the consumer — a deployment that doesn't want per-event series drops the label at scrape/relabel time.