Skip to content

Commit

Permalink
Add kafka.request.time.avg (#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
mackjmr authored Jan 4, 2024
1 parent b495ac8 commit 8fe0252
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions jmx-metrics/docs/target-systems/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ These metrics are sourced from Kafka's exposed Yammer metrics for each instance:
* Attributes: `type`
* Instrument Type: DoubleValueObserver

* Name: `kafka.request.time.avg`
* Description: The average time the broker has taken to service requests
* Unit: `ms`
* Attributes: `type`
* Instrument Type: DoubleValueObserver

* Name: `kafka.network.io`
* Description: The bytes received or sent by the broker
* Unit: `by`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ List<Consumer<Metric>> kafkaBrokerAssertions() {
attrs -> attrs.containsOnly(entry("type", "produce")),
attrs -> attrs.containsOnly(entry("type", "fetchfollower")),
attrs -> attrs.containsOnly(entry("type", "fetchconsumer"))),
metric ->
assertGaugeWithAttributes(
metric,
"kafka.request.time.avg",
"The average time the broker has taken to service requests",
"ms",
attrs -> attrs.containsOnly(entry("type", "produce")),
attrs -> attrs.containsOnly(entry("type", "fetchfollower")),
attrs -> attrs.containsOnly(entry("type", "fetchconsumer"))),
metric ->
assertGauge(
metric,
Expand Down
10 changes: 8 additions & 2 deletions jmx-metrics/src/main/resources/target-systems/kafka.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ otel.instrument(requestTime,
"type" : { mbean -> mbean.name().getKeyProperty("request").toLowerCase() },
],
"99thPercentile", otel.&doubleValueCallback)


otel.instrument(requestTime,
"kafka.request.time.avg",
"The average time the broker has taken to service requests",
"ms",
[
"type" : { mbean -> mbean.name().getKeyProperty("request").toLowerCase() },
],
"Mean", otel.&doubleValueCallback)

def network = otel.mbeans(["kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec",
"kafka.server:type=BrokerTopicMetrics,name=BytesOutPerSec"])
Expand Down

0 comments on commit 8fe0252

Please sign in to comment.