Producer Metrics
This topic describes JMX metrics available on Kafka producer instances. These metrics are useful for monitoring the health and performance of your producer applications.
For information about how to configure JMX, see Configure JMX for Monitoring.
Search for a metric
Producer instance metrics
The following metrics are available on a producer instance. These metrics are attributes on the associated MBean.
batch-size-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:batch-size-avg The average number of bytes sent per partition per-request. Global request metric.
batch-size-max
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:batch-size-max The maximum number of bytes sent per partition per-request. Global request metric.
batch-split-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:batch-split-rate The average number of batch splits per second. Global request metric.
batch-split-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:batch-split-total The total number of batch splits. Global request metric.
buffer-available-bytes
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:buffer-available-bytes The total amount of buffer memory that is not being used, either unallocated or in the free list. Kafka 3.1.1 and later.
buffer-total-bytes
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:buffer-total-bytes The maximum amount of buffer memory the client can use whether or not it is available. Kafka 3.1.1 and later.
bufferpool-wait-time
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:bufferpool-wait-time The fraction of time an appender waits for space allocation. Kafka 3.1.1 and later.
bufferpool-wait-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:bufferpool-wait-time-ns-total The total time in nanoseconds an appender waits for space allocation in nanoseconds. Kafka 3.1.1 and later.
compression-rate-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:compression-rate-avg The average compression rate of record batches, defined as the average ratio of the compressed batch size over the uncompressed size. Global request metric.
connection-close-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:connection-close-rate The connections closed per second in the window. Global connection metric.
connection-count
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:connection-count The current number of active connections. Global connection metric.
connection-creation-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:connection-creation-rate The number of new connections established per second in the window. Global connection metric.
flush-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:flush-time-ns-total The total time in nanoseconds the producer spent in
Producer.flush. Kafka 3.1.1 and later.
txn-abort-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:txn-abort-time-ns-total The total time in nanoseconds the producer spent aborting transactions for exactly-once semantics. Kafka 3.1.1 and later.
txn-begin-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:txn-begin-time-ns-total The total time in nanoseconds the producer spent in
beginTransactionfor exactly-once semantics. Kafka 3.1.1 and later.
txn-commit-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:txn-commit-time-ns-total The total time in nanoseconds the producer spent committing transactions for exactly-once semantics.
txn-init-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:txn-init-time-ns-total The total time in nanoseconds that the producer spent initializing transactions for exactly-once semantics. Kafka 3.1.1 and later.
txn-send-offsets-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:txn-send-offsets-time-ns-total The total time the producer spent sending offsets to transactions in nanoseconds for exactly-once semantics. Kafka 3.1.1 and later.
waiting-threads
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:waiting-threads The number of user threads blocked waiting for buffer memory to enqueue their records. Kafka 3.1.1 and later.
incoming-byte-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:incoming-byte-rate The average number of incoming bytes received per second from all servers. Global request metric.
io-ratio
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:io-ratio The fraction of time the I/O thread spent doing I/O. Global connection metric.
io-time-ns-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:io-time-ns-avg The average length of time for I/O per select call in nanoseconds. Global connection metric.
io-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:io-time-ns-total The total time the I/O thread spent doing I/O in nanoseconds. Global connection metric.
io-wait-ratio
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:io-wait-ratio The fraction of time the I/O thread spent waiting. Global connection metric.
io-wait-time-ns-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:io-wait-time-ns-avg The average length of time the I/O thread spent waiting for a socket ready for reads or writes in nanoseconds. Global connection metric.
io-wait-time-ns-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:io-wait-time-ns-total The total length of time the I/O thread spent waiting for a socket ready for reads or writes in nanoseconds. Global connection metric.
metadata-age
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:metadata-age The age, in seconds, of the current producer metadata being used. Global request metric.
outgoing-byte-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:outgoing-byte-rate The average number of bytes sent per second to all servers. Global request metric.
produce-throttle-time-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:produce-throttle-time-avg The average time in milliseconds a request was throttled by a broker. Global request metric.
produce-throttle-time-max
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:produce-throttle-time-max The maximum time in milliseconds a request was throttled by a broker. Global request metric.
record-error-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-error-rate The average per-second number of record sends that resulted in errors. Global request metric.
record-error-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-error-total The total number of record sends that resulted in errors. Global request metric.
record-queue-time-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-queue-time-avg The average time in milliseconds record batches spent in the send buffer. Global request metric.
record-queue-time-max
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-queue-time-max The maximum time in milliseconds record batches spent in the send buffer. Global request metric.
record-retry-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-retry-rate The average per-second number of retried record sends. Global request metric.
record-retry-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-retry-total The total number of retried record sends. Global request metric.
record-send-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-send-rate The average number of records sent per second. Global request metric.
record-send-total
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-send-total The total number of records sent. Global request metric.
record-size-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-size-avg The average record size. Global request metric.
record-size-max
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:record-size-max The maximum record size. Global request metric.
records-per-request-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:records-per-request-avg The average number of records per request. Global request metric.
request-latency-avg
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:request-latency-avg The average request latency in milliseconds for producer requests. This metric measures the time from when a request is sent until the response is received, providing insight into the overall request-response performance of the producer.
request-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:request-rate The average number of requests sent per second. Global request metric.
requests-in-flight
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:requests-in-flight The current number of in-flight requests awaiting a response. Global request metric.
select-rate
- MBean:
kafka.producer:type=producer-metrics,client-id={clientId}Attribute:select-rate The number of times the I/O layer checked for new I/O to perform per second. Global connection metric.
Producer per-broker metrics
Besides the producer global request metrics, the following metrics are also available per broker:
incoming-byte-rate
- MBean:
kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)Attribute:incoming-byte-rate The average number of bytes received per second from the broker.
outgoing-byte-rate
- MBean:
kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)Attribute:outgoing-byte-rate The average number of bytes sent per second to the broker.
request-rate
- MBean:
kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)Attribute:request-rate The average number of requests sent per second to the broker.
request-size-avg
- MBean:
kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)Attribute:request-size-avg The average size of all requests in the window for a broker.
request-size-max
- MBean:
kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)Attribute:request-size-max The maximum size of any request sent in the window for a broker.
response-rate
- MBean:
kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)Attribute:response-rate The average number of responses received per second from the broker.
Producer per-topic metrics
In addition to the producer global request metrics, the following metric attributes are available per topic:
byte-rate
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:byte-rate The average number of bytes sent per second for a topic.
byte-total
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:byte-total The total number of bytes sent for a topic.
compression-rate
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:compression-rate The average compression rate of record batches for a topic. This is computed by averaging the compression ratios of the record batches. The compression ratio is computed by dividing the compressed batch size by the uncompressed size.
record-error-rate
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:record-error-rate The average per-second number of record sends that resulted in errors for a topic.
record-error-total
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:record-error-total The total number of record sends that resulted in errors for a topic.
record-retry-rate
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:record-retry-rate The average per-second number of retried record sends for a topic.
record-retry-total
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:record-retry-total The total number of retried record sends for a topic.
record-send-rate
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:record-send-rate The average number of records sent per second for a topic.
record-send-total
- MBean:
kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}Attribute:record-send-total The total number of records sent for a topic.