Observability

Prometheus metrics with their types and labels, a scrape configuration, and logging.

OrbitMQ exposes Prometheus metrics at /metrics on the admin API listener and writes structured logs to stderr.

How metrics are collected

Each data-plane core keeps its own plain counters and histograms, updated without atomics or locks. A scrape of /metrics asks every core for a snapshot over its control ring, then adds the snapshots up into node-wide values. Nothing is collected between scrapes, so metrics cost nothing on the publish path.

Each scrape also walks the sessions on every core to compute the state gauges, so a scrape interval of 15 seconds or more is a sensible default. If a core does not answer within [admin] request_timeout_ms (default 2000 ms), the scrape fails with HTTP 504; if a core's control queue is full, with 503.

Enabling the endpoint

/metrics is served by the admin API, which needs a bearer token (or insecure = true on a loopback address):

orbitmq.toml
[admin]
listen = "0.0.0.0:18083"            # default 127.0.0.1:18083
tokens = ["a-long-random-token"]    # or ORBITMQ_ADMIN_TOKENS
curl -H 'Authorization: Bearer a-long-random-token' http://localhost:18083/metrics

The response uses the Prometheus text format, version 0.0.4.

Prometheus scrape configuration

prometheus.yml
scrape_configs:
  - job_name: orbitmq
    scrape_interval: 15s
    metrics_path: /metrics
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/orbitmq-token   # file containing one of the [admin] tokens
    static_configs:
      - targets: ['broker-1.internal:18083']

Metrics

All metrics have the prefix orbitmq_ and describe one node.

Process

MetricTypeLabelsDescription
orbitmq_build_infogaugeversionAlways 1; the label carries the broker version.
orbitmq_uptime_secondsgaugeSeconds since the broker started.
orbitmq_runtime_infogaugebackendAlways 1; the label is the data-plane I/O backend: io_uring, epoll (Linux fallback, the default in containers) or kqueue (macOS). See Running in containers.
orbitmq_coresgaugeNumber of data-plane cores.
orbitmq_core_busy_ratiogaugecoreShare of the last second each core spent in broker event handlers (0 to 1).
orbitmq_core_busy_seconds_totalcountercoreTime each core has spent in broker event handlers.

Flow control and subscribe visibility

See cross-core routing for the mechanisms behind these counters.

MetricTypeLabelsDescription
orbitmq_core_throttled_totalcountercoreTimes a connection reader (or the core-to-core ring consumer) on each core was paused because deliveries it caused were blocked (ingress back-pressure).
orbitmq_core_cut_excluded_totalcountercoreLive deliveries skipped on each core because the message was processed before the new subscription existed. Not a loss: such a message never belongs to that subscription.
orbitmq_core_retained_deduplicated_totalcountercoreDuplicate copies skipped on each core because a new subscription would otherwise receive the same message both as a retained and as a live message.

Event loop and I/O

These counters show how much work each core does per pass of its event loop. Dividing one by another gives batch sizes, which help when tuning cores: for example, inbox_messages / inbox_batches is the average number of messages per core-to-core hand-off, and socket_writes divided by delivered messages shows how well writes are batched.

MetricTypeLabelsDescription
orbitmq_core_loop_passes_totalcountercorePasses of each core's event loop (run the ready tasks, then poll for I/O).
orbitmq_core_loop_parks_totalcountercorePasses that ended with the core waiting for I/O because it had nothing to do.
orbitmq_core_handoff_batches_totalcountercoreBatches each core sent to other cores.
orbitmq_core_handoff_messages_totalcountercoreMessages in those batches.
orbitmq_core_handoff_wakeups_sent_totalcountercoreBatches that had to wake the receiving core because it was waiting.
orbitmq_core_handoff_wakeups_skipped_totalcountercoreBatches that needed no wake-up.
orbitmq_core_inbox_batches_totalcountercoreReads of each core's inbox from other cores that returned messages.
orbitmq_core_inbox_messages_totalcountercoreMessages those reads returned.
orbitmq_core_socket_reads_totalcountercoreClient socket reads that returned data.
orbitmq_core_socket_writes_totalcountercoreWrite calls to client sockets.

Connections

MetricTypeLabelsDescription
orbitmq_connections_currentgaugelistener, protocolConnected clients (CONNACK sent).
orbitmq_connections_totalcounterlistener, protocolSuccessful CONNECTs.
orbitmq_connections_accepted_totalcounterlistenerNetwork connections accepted.
orbitmq_connections_refused_totalcounterlistener, reasonCONNECTs refused because a connection limit was reached (reason="max_connections").
orbitmq_connections_opengaugeOpen network connections in any phase, including before CONNACK.

Traffic

MetricTypeLabelsDescription
orbitmq_packets_received_totalcountertypeMQTT control packets received.
orbitmq_packets_sent_totalcountertypeMQTT control packets sent.
orbitmq_messages_received_totalcounterqosPUBLISH packets received from clients.
orbitmq_messages_sent_totalcounterqosPUBLISH packets sent to clients, re-deliveries included.
orbitmq_bytes_received_totalcounterMQTT bytes received, after TLS and WebSocket decoding.
orbitmq_bytes_sent_totalcounterMQTT bytes sent, before TLS and WebSocket encoding.
orbitmq_dropped_messages_totalcounterreasonMessages dropped.
orbitmq_publish_deliver_latency_secondshistogramPublish-to-delivery latency of messages handed over between cores, measured on the delivering core.

State

MetricTypeLabelsDescription
orbitmq_sessionsgaugestateSessions, connected or disconnected (kept for a later reconnect).
orbitmq_sessions_persistentgaugeSessions with a non-zero Session Expiry Interval.
orbitmq_subscriptionsgaugeSubscriptions of all sessions.
orbitmq_inflight_messagesgaugeUnacknowledged outgoing QoS 1 and QoS 2 messages.
orbitmq_queued_messagesgaugeMessages waiting in session queues.
orbitmq_retained_messagesgaugeRetained messages stored.
orbitmq_retained_bytesgaugeBytes held by retained messages.
orbitmq_memory_budget_bytesgaugeThe node's memory budget (0: no budget).
orbitmq_memory_used_bytesgaugekindBytes counted against the budget. A QoS 1 or 2 message being sent shows under both inflight and outbound, and counts once.
orbitmq_memory_budget_closes_totalcounterConnections closed because their buffers put the node over its budget.

Authentication

MetricTypeLabelsDescription
orbitmq_auth_totalcounterresultCONNECTs accepted (success) or refused (failure) by the authentication chain. Stays at 0 while neither chain has a source and the admin API is off (no authentication runs then).
orbitmq_auth_source_decisions_totalcounterchain, source, kind, resultAnswers of each authentication and authorization source: allow, deny or ignore. For authorization sources, one per PUBLISH or SUBSCRIBE check that reached the source.
orbitmq_auth_source_checks_totalcounterchain, source, kindNetwork sources (jwt, http, postgres, mysql, redis, mongodb): queries sent to the backend.
orbitmq_auth_source_errors_totalcounterchain, source, kindNetwork sources: backend errors, timeouts and max_in_flight refusals.
orbitmq_auth_source_cache_hits_totalcounterchain, source, kindNetwork sources: answers taken from the cache.
orbitmq_auth_source_enabledgaugechain, source, kind1 when the source is enabled, 0 when it is skipped.
orbitmq_auth_source_positiongaugechain, source, kindThe source's 0-based position in its chain.

chain is authentication or authorization, source the source's name. See Authentication.

Rules

MetricTypeLabelsDescription
orbitmq_rule_messages_totalcounterrule, resultMessages seen by each rule: matched (evaluated), passed (WHERE true), filtered (WHERE not true), failed (evaluation error), dropped (the core's rules queue was full).
orbitmq_rule_action_messages_totalcounterrule, action, type, resultMessages handled by each rule action: success, failed, dropped (action queue full), retried, dead_lettered.
orbitmq_rule_action_queuedgaugerule, action, typeMessages waiting in each action's queue.
orbitmq_connector_upgaugeconnector, kind1 while an MQTT or Kafka connector is connected, 0 otherwise.

rule is the rule id, action the action's 0-based position in the rule, type one of republish, webhook, mqtt and kafka. The series exist only while the rule engine is enabled. See Rules and integrations.

Label values

LabelValues
listenerListener names from the configuration (default for listen).
protocol3.1, 3.1.1, 5.0
typeconnect, connack, publish, puback, pubrec, pubrel, pubcomp, subscribe, suback, unsubscribe, unsuback, pingreq, pingresp, disconnect, auth
qos0, 1, 2
reason (dropped)ring_full: QoS 0 hand-off dropped because the destination core stayed overloaded (its backlog passed four ring capacities while the publisher was already being throttled). qos0_queue_full: QoS 0 delivery to a slow or offline client. queue_full: QoS 1 or 2 delivery to a session whose queue was full (max_queued_messages or max_queued_bytes). expired: the message expired before delivery. too_large: larger than the receiving client's Maximum Packet Size. no_subscribers: no subscription matched. memory_limit: shed from one of the longest session queues because the node's queued messages exceeded their memory budget (see Session queues).
kindqueued, inflight, outbound, read, retained
stateconnected, disconnected
resultsuccess, failure (orbitmq_auth_total); allow, deny, ignore (orbitmq_auth_source_decisions_total); matched, passed, filtered, failed, dropped (orbitmq_rule_messages_total); success, failed, dropped, retried, dead_lettered (orbitmq_rule_action_messages_total)
coreCore index, from 0.

The latency histogram has log-linear buckets: the first ends at 1.024 µs, then two buckets per power of two up to about 17 seconds, then +Inf.

Useful queries

PromQL
# Messages in and out per second
sum(rate(orbitmq_messages_received_total[1m]))
sum(rate(orbitmq_messages_sent_total[1m]))

# Connected clients per listener
sum by (listener) (orbitmq_connections_current)

# Dropped messages per second, by reason
sum by (reason) (rate(orbitmq_dropped_messages_total[5m]))

# p99 cross-core delivery latency
histogram_quantile(0.99, sum by (le) (rate(orbitmq_publish_deliver_latency_seconds_bucket[5m])))

# Busiest core
max(orbitmq_core_busy_ratio)

# Messages dropped by the rule engine per second, by rule
sum by (rule) (rate(orbitmq_rule_messages_total{result="dropped"}[5m]))

Logs

Logs go to stderr in a human-readable format, one event per line, for example:

2026-10-13T18:21:32.378224Z  INFO orbitmq_core::broker: listening listener=default kind=tcp addr=0.0.0.0:1883

Set the level with log in orbitmq.toml or ORBITMQ_LOG, using tracing env-filter syntax: info (default), debug, warn, or per module, such as info,orbitmq_core=debug. The filter is read at start-up.

State-changing admin API requests are logged at info under the target orbitmq::admin::audit (see Audit log), and invalid admin tokens at warn with the peer address. Configuration risks are logged as warnings at start-up, among them secret files and TLS private keys readable by other users, PROXY listeners without trusted_proxies, an admin API on a non-loopback address without TLS, JWT sources that check no issuer or audience, and insecure connections allowed to authentication sources.

On this page