How to expose Kafka producer metrics to Prometheus with spring boot 2.2.6
Asked Answered
T

0

1

I am trying to expose the Kafka producer data to actuator/Prometheus but unfortunately not working with spring boot 2.2.6 and Kafka 2.3.7(auto-configured).

Relevant code:

@Autowired
private KafkaTemplate<String, String> kafkaTemplate;

public <T> void publish(String data, String topicName) {
        kafkaTemplate.send(topicName, data);
}

applicaiton.properties

spring.jmx.enabled=true
management.endpoint.health.show-details=always
management.endpoint.metrics.enabled=true
management.endpoint.prometheus.enabled=true
management.endpoints.web.exposure.include=*
management.metrics.distribution.percentiles-histogram.http.server.requests=tr

somewhere I read for spring 2.2 we have to enable jmx, but even after enabling it kafka producer data is not visible in Prometheus.

Thundershower answered 7/7, 2022 at 14:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.