Search code examples
spring-kafkamicrometerobservability

Spring-kafka default for Micrometer observation


I understand that for spring-kafka, using Micrometer for observation is disabled by default.

We need to set observationEnabled to true on the KafkaTemplate and ContainerProperties to enable observation. Link to reference doc

Questions:

  1. Just curious why it is off by default?

  2. Does spring-kafka team anticipate enabling by default in the future?

Thanks in advance for any insights!


Solution

  • It is disabled by default because not all the applications might require observability. When you enable observation, the application is expected to provide an implementation for the ObservationRegistry. By default, spring-kafka uses ObservationRegistry.NOOP on both KafkaTemplate and the message listener container, which does not perform any observations. Applications that enable observation usually add more dependencies to provide a proper implementation for ObservationRegistry. By enabling observation by default, while not providing a proper registry, etc. we might add some extra overhead while an application may not intend to compute any observability. For these reasons, it is disabled by default and the framework wants the applications to opt-in to this feature. Currently, there is no plan to enable this by default. If you have a real use case for enabling observation, we would like to hear that though.