|
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 |
|
27 | 28 | import java.time.Duration; |
| 29 | +import java.util.Map; |
28 | 30 | import java.util.concurrent.ScheduledExecutorService; |
| 31 | +import java.util.function.Supplier; |
29 | 32 |
|
30 | 33 | /** |
31 | 34 | * Kafka Client metrics binder. This should be closed on application shutdown to clean up |
@@ -223,4 +226,38 @@ public KafkaClientMetrics(AdminClient adminClient) { |
223 | 226 | super(adminClient::metrics); |
224 | 227 | } |
225 | 228 |
|
| 229 | + /** |
| 230 | + * Kafka client metrics binder |
| 231 | + * @param metricsSupplier supplier of metrics, make sure this comes from the Java |
| 232 | + * Kafka Client because {@link KafkaClientMetrics} heavily depends on the behavior of |
| 233 | + * the Java Kafka Client |
| 234 | + */ |
| 235 | + public KafkaClientMetrics(Supplier<Map<MetricName, ? extends Metric>> metricsSupplier) { |
| 236 | + super(metricsSupplier); |
| 237 | + } |
| 238 | + |
| 239 | + /** |
| 240 | + * Kafka client metrics binder |
| 241 | + * @param metricsSupplier supplier of metrics, make sure this comes from the Java |
| 242 | + * Kafka Client because {@link KafkaClientMetrics} heavily depends on the behavior of |
| 243 | + * the Java Kafka Client |
| 244 | + * @param tags additional tags |
| 245 | + */ |
| 246 | + public KafkaClientMetrics(Supplier<Map<MetricName, ? extends Metric>> metricsSupplier, Iterable<Tag> tags) { |
| 247 | + super(metricsSupplier, tags); |
| 248 | + } |
| 249 | + |
| 250 | + /** |
| 251 | + * Kafka client metrics binder |
| 252 | + * @param metricsSupplier supplier of metrics, make sure this comes from the Java |
| 253 | + * Kafka Client because {@link KafkaClientMetrics} heavily depends on the behavior of |
| 254 | + * the Java Kafka Client |
| 255 | + * @param tags additional tags |
| 256 | + * @param scheduler custom scheduler to check and bind metrics |
| 257 | + */ |
| 258 | + public KafkaClientMetrics(Supplier<Map<MetricName, ? extends Metric>> metricsSupplier, Iterable<Tag> tags, |
| 259 | + ScheduledExecutorService scheduler) { |
| 260 | + super(metricsSupplier, tags, scheduler); |
| 261 | + } |
| 262 | + |
226 | 263 | } |
0 commit comments