Skip to content

Commit 0083f5e

Browse files
committed
(feat) add metrics on LcKafkaConsumer
1 parent 3ec88f3 commit 0083f5e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/cn/leancloud/kafka/consumer/LcKafkaConsumer.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package cn.leancloud.kafka.consumer;
22

33
import org.apache.kafka.clients.consumer.Consumer;
4+
import org.apache.kafka.common.Metric;
5+
import org.apache.kafka.common.MetricName;
46

57
import java.io.Closeable;
68
import java.util.Collection;
9+
import java.util.Map;
710
import java.util.concurrent.ExecutorService;
811
import java.util.concurrent.TimeUnit;
912

@@ -80,6 +83,13 @@ public synchronized void subscribe(Collection<String> topics) {
8083
state = State.SUBSCRIBED;
8184
}
8285

86+
/**
87+
* Get the metrics kept by the consumer
88+
*/
89+
public Map<MetricName, ? extends Metric> metrics() {
90+
return consumer.metrics();
91+
}
92+
8393
@Override
8494
public void close() {
8595
if (closed()) {

0 commit comments

Comments
 (0)