-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add micrometer metrics to kafka streams
- Loading branch information
Showing
5 changed files
with
38 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
dependencies { | ||
api("org.apache.kafka:kafka-streams-test-utils:3.1.0") | ||
implementation(kotlin("test")) | ||
implementation("io.micrometer:micrometer-registry-prometheus:1.8.5") | ||
implementation(project(":kafka")) | ||
implementation(kotlin("test")) | ||
} |
21 changes: 21 additions & 0 deletions
21
kafka-test/main/io/micrometer/core/instrument/binder/kafka/KtorKafkaMetrics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.micrometer.core.instrument.binder.kafka | ||
|
||
import io.micrometer.core.instrument.MeterRegistry | ||
import org.apache.kafka.common.Metric | ||
import org.apache.kafka.common.MetricName | ||
|
||
|
||
/** | ||
* KafkaMetrics is package private. | ||
* KafkaStreams and TestTopologyDriver does not share interface, | ||
* this is a workaround for testing kafka streams metrics | ||
*/ | ||
class KtorKafkaMetrics( | ||
registry: MeterRegistry, | ||
metrics: () -> Map<MetricName, Metric>, | ||
) { | ||
init { | ||
val binder = KafkaMetrics(metrics) | ||
binder.bindTo(registry) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters