-
Notifications
You must be signed in to change notification settings - Fork 873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring Boot starter: auto-configure Kafka metrics reporter #12905
Comments
The spring starter can only use library instrumentations. Kafka currently only has agent based instrumentation. I'm not sure if it can be done. If yes, a PR would be welcome. |
@zeitlinger check out |
Thx - missed that. So the starter uses the spring library instrumentation, which doesn't support metrics - and spring doesn't seem to allow access to the underlying hooks. |
I'd try DefaultKafkaConsumerFactoryCustomizer and DefaultKafkaProducerFactoryCustomizer |
Is your feature request related to a problem? Please describe.
On a Spring Boot service, we have just migrated from instrumentation via the OpenTelemetry JVM agent to using the Spring Boot Starter JAR as dependency. Unfortunately, with Spring Boot Starter auto-configuration, we no longer have Kafka metrics associated with our consumer or producer.
The metrics we used to depends on are described in this page: Library instrumentation for Kafka Clients#Usage (Metrics).
Describe the solution you'd like
If I understood correctly, the Kafka metrics are activated via
KafkaMetricsUtil#enhanceConfig
in the followingjavaagent
instrumentations:opentelemetry-java-instrumentation/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/metrics/KafkaMetricsConsumerInstrumentation.java
Line 63 in 9865c17
opentelemetry-java-instrumentation/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/metrics/KafkaMetricsProducerInstrumentation.java
Line 63 in 9865c17
It seems relevant - to me at least :) - to have something similar in the Spring Boot Starter module (perhaps enable/disable via a configuration property)
Describe alternatives you've considered
I don't see a way to add the properties (to enable OpenTelemetryMetricsReporter ) in Spring Kafka consumers or producers in the auto-configuration mechanisms (either KafkaInstrumentationAutoConfiguration or ConcurrentKafkaListenerContainerFactoryPostProcessor)
Additional context
Current behavior tested with:
Spring Boot: 3.3.6 / OpenTelemetry Spring Boot Starter: v2.7.0
The text was updated successfully, but these errors were encountered: