Skip to content

Commit a461f23

Browse files
author
Vineeth
committed
Add docs, whats-new entry and author tags for container lifecycle metrics
- Add reference docs section in micrometer.adoc - Add whats-new entry linking to ref docs - Add @author Vineeth Yelagandula to modified classes Signed-off-by: Vineeth <vineeth>
1 parent fed81d3 commit a461f23

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/micrometer.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ This class is a super for the mentioned above `MicrometerConsumerListener`, `Mic
9393
However, it can be used for any Kafka client use-cases.
9494
The class needs to be extended and its `bindClient()` and `unbindClient()` API have to be called to connect Kafka client metrics with a Micrometer collector.
9595

96+
97+
[[monitoring-container-lifecycle]]
98+
== Monitoring Listener Container Lifecycle
99+
100+
Starting with version 4.1.0, the listener container will automatically create and update Micrometer ``Counter``s for container start and stop events, if `Micrometer` is detected on the classpath, and a single `MeterRegistry` is present in the application context.
101+
The counters can be disabled by setting the ``ContainerProperty``'s `micrometerEnabled` to `false`.
102+
103+
Two counters are maintained - one for container start events and one for container stop events.
104+
105+
The counters are named as follows:
106+
107+
* `spring.kafka.container.start.count` - incremented each time the container is started
108+
* `spring.kafka.container.stop.count` - incremented each time the container is stopped (including abnormal stops)
109+
110+
Both counters have the following tag:
111+
112+
* `name` : (container bean name)
113+
114+
This feature is useful for monitoring container restarts, detecting unexpected stops, and tracking the lifecycle of listener containers in production environments.
115+
96116
[[observation]]
97117
== Micrometer Observation
98118

spring-kafka-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
This section covers the changes made from version 4.0 to version 4.1.
88
For changes in earlier versions, see xref:appendix/change-history.adoc[Change History].
99

10+
[[x41-container-lifecycle-metrics]]
11+
=== Container Lifecycle Metrics
12+
13+
The listener container now automatically tracks start and stop counts using Micrometer counters (`spring.kafka.container.start.count` and `spring.kafka.container.stop.count`), tagged with the container bean name.
14+
See xref:kafka/micrometer.adoc#monitoring-container-lifecycle[Monitoring Listener Container Lifecycle] for more information.
15+
1016
[[x41-kafka-listener-ack-mode]]
1117
=== `@KafkaListener` Changes
1218

spring-kafka/src/main/java/org/springframework/kafka/listener/AbstractMessageListenerContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
* @author Sanghyeok An
7474
* @author Lokesh Alamuri
7575
* @author Christian Fredriksson
76+
* @author Vineeth Yelagandula
7677
*/
7778
public abstract class AbstractMessageListenerContainer<K, V>
7879
implements GenericMessageListenerContainer<K, V>, BeanNameAware, ApplicationEventPublisherAware,

spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
* @author Jinhui Kim
180180
* @author Minchul Son
181181
* @author Youngjoo Kim
182+
* @author Vineeth Yelagandula
182183
*/
183184
public class KafkaMessageListenerContainer<K, V> // NOSONAR line count
184185
extends AbstractMessageListenerContainer<K, V> implements ConsumerPauseResumeEventPublisher {

0 commit comments

Comments
 (0)