Skip to content

Spring Boot starter: auto-configure Kafka metrics reporter #12905

@drazzib

Description

@drazzib

Is your feature request related to a problem? Please describe.

I'm not sure if the current behavior is desired or if it's an oversight
(I'll let you reclassify this as a bug at your convenience).

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 following javaagent instrumentations:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions