|
23 | 23 | import org.apache.kafka.clients.consumer.Consumer; |
24 | 24 | import org.apache.kafka.clients.producer.Producer; |
25 | 25 | import org.apache.kafka.common.Metric; |
| 26 | +import org.apache.kafka.common.MetricName; |
26 | 27 |
|
| 28 | +import java.util.Map; |
27 | 29 | import java.util.concurrent.ScheduledExecutorService; |
| 30 | +import java.util.function.Supplier; |
28 | 31 |
|
29 | 32 | /** |
30 | 33 | * Kafka Client metrics binder. This should be closed on application shutdown to clean up |
@@ -141,4 +144,31 @@ public KafkaClientMetrics(AdminClient adminClient) { |
141 | 144 | super(adminClient::metrics); |
142 | 145 | } |
143 | 146 |
|
| 147 | + |
| 148 | + /** |
| 149 | + * Kafka client metrics binder |
| 150 | + * @param metricsSupplier supplier of metrics, make sure this comes from the Java Kafka Client because {@link KafkaClientMetrics} heavily depends on the behavior of the Java Kafka Client |
| 151 | + */ |
| 152 | + public KafkaClientMetrics(Supplier<Map<MetricName, ? extends Metric>> metricsSupplier) { |
| 153 | + super(metricsSupplier); |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * Kafka client metrics binder |
| 158 | + * @param metricsSupplier supplier of metrics, make sure this comes from the Java Kafka Client because {@link KafkaClientMetrics} heavily depends on the behavior of the Java Kafka Client |
| 159 | + * @param tags additional tags |
| 160 | + */ |
| 161 | + public KafkaClientMetrics(Supplier<Map<MetricName, ? extends Metric>> metricsSupplier, Iterable<Tag> tags) { |
| 162 | + super(metricsSupplier, tags); |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * Kafka client metrics binder |
| 167 | + * @param metricsSupplier supplier of metrics, make sure this comes from the Java Kafka Client because {@link KafkaClientMetrics} heavily depends on the behavior of the Java Kafka Client |
| 168 | + * @param tags additional tags |
| 169 | + * @param scheduler custom scheduler to check and bind metrics |
| 170 | + */ |
| 171 | + public KafkaClientMetrics(Supplier<Map<MetricName, ? extends Metric>> metricsSupplier, Iterable<Tag> tags, ScheduledExecutorService scheduler) { |
| 172 | + super(metricsSupplier, tags, scheduler); |
| 173 | + } |
144 | 174 | } |
0 commit comments