Skip to content

Statistics

Magnus Edenhill edited this page Nov 20, 2016 · 25 revisions

librdkafka optionally emits internal metrics every statistics.interval.ms if a stats_cb has been registered. The stats are provided as a JSON object string.

Note: librdkafka makes use of the system's monotonic clock if one is available, else falls back to the system wall clock time. This clock is represented in number of microseconds since the unix epoch (1970).

Top-level

Field Type Example Description
name string "rdkafka#producer-1" Handle instance name
type string "producer" Instance type (producer or consumer)
ts int 12345678912345 librdkafka's internal monotonic clock (micro seconds)
replyq int Number of ops waiting in queue for application to serve with rd_kafka_poll()
msg_cnt int Current number of messages in instance queues
msg_size int Current total size of messages in instance queues
msg_max int Threshold: maximum number of messages allowed
msg_size_max int Threshold: maximum total size of messages allowed
simple_cnt int Internal tracking of legacy vs new consumer API state
brokers object Dict of brokers, key is broker name, value is object. See brokers below

brokers

Field Type Example Description
name string "example.com:9092/13" Broker hostname, port and broker id
nodeid int 13 Broker id (-1 for bootstraps)
state string Broker state
stateage int Time of last broker state change (librdkafka's clock)
outbuf_cnt int Number of requests awaiting transmission to broker
outbuf_msg_cnt int Number of messages in outbuf_cnt
waitresp_cnt int Number of requests in-flight to broker awaiting response
waitresp_msg_cnt int Number of messages in waitresp_cnt
tx int Total number of requests sent
txbytes int Total number of bytes sent
txerrs int Total number of transmission errors
txretries int Total number of request retries
req_timeouts int Total number of requests timed out
rx int Total number of responses received
rxbytes int Total number of bytes received
rxerrs int Total number of receive errors
rxcorriderrs int Total number of unmatched correlation ids in response (typically for timed out requests)
rxpartial int Total number of partial messagesets received
zbuf_grow int Total number of decompression buffer size increases
buf_grow int Total number of buffer size increases
rtt object Broker latency / round-trip time. See Window stats below
throttle object Broker throttling time. See Window stats below
toppars object Metrics for partitions handled by this broker handle. See toppars below

Window stats

Rolling window statistics

Field Type Example Description
min int Smallest value
max int Largest value
avg int Average value
sum int Sum of values
cnt int Number of value samples

toppars

Per-partition metrics

Field Type Example Description
Clone this wiki locally