io.quarkus.micrometer.runtime.binder.kafka.KafkaEventObserver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-micrometer Show documentation
Show all versions of quarkus-micrometer Show documentation
Instrument the runtime and your application with dimensional metrics using Micrometer.
package io.quarkus.micrometer.runtime.binder.kafka;
import java.util.HashMap;
import java.util.Map;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.producer.Producer;
import org.jboss.logging.Logger;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics;
import io.quarkus.runtime.ShutdownEvent;
/**
* Observer to create and register KafkaClientMetrics.
*
* This observer uses only classes from "kafka-clients" and none from "kafka-streams".
*
* Must be separated from KafkaStreamsEventObserver, because they use different dependencies and if only kafka-client is used,
* the classes from kafka-streams aren't loaded.
*/
@ApplicationScoped
public class KafkaEventObserver {
private static final Logger log = Logger.getLogger(KafkaEventObserver.class);
final MeterRegistry registry = Metrics.globalRegistry;
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy