Message rate
This metric provides the value in messages per second produced to a desired topic aggregated on each Kafka broker at any given time.
Use cases
Understanding data time patterns
Sometimes it’s necessary to understand when it’s the most popular time for your application.
For example:
-
When is a peak hour when people make payments, so ads can be adjusted
-
When application is low-loaded, so it can be upgraded
To do that, just use sum aggregator with the time window of 24h and time step of 1 minute, it will show you the best results for visualisation.
Request example
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/request-time-patterns.json[]
Response example
Some data was omitted for the sake of brevity |
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/response-time-patterns.json[]
Basic usage
Please refer to the example message rate
provided in the API docs.
This request is asking for message rate per
second, averaged over the entire provided rate-size [5M] (default value) to topic payment-events-stream
on
environment dev
for last 15 minutes with the step-size of 1 minute.
Basic Request
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/simple-request.json[]
The below part of sample response, represents the message rate on each Kafka broker.
Basic Response
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/simple-response.json[]
This metric can be used to determine how much messages is being generated by individual topics, or, in terms of business, how many events are happening.
Advanced usage
Using aggregator
By adding aggregator
to the request, the message rate of the
topic will be aggregated over all kafka brokers.
For instance asking for the sum
aggregation function, will result in the sum of message rate of the topic among all existing kafka brokers.
Request using sum aggregator
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/request-with-sum.json[]
The below response represents the aggregated message rate of the topic on a Kafka cluster.
Response using sum aggregator
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/response-with-sum.json[]
Using groupBy
If you want to get response grouped by some label - you can use groupBy
Request using groupBy
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/request-with-groupBy.json[]
The below response represents the rate in messages of the partition on each Kafka broker (pod), with data grouped by pod.
Response using groupBy
Unresolved include directive in modules/ROOT/pages/self-service/client-metrics/topic/message-rate/message-rate.adoc - include::example$/client-metrics/topic/message-rate/response-with-groupBy.json[]