Class ConsumerTopicMessageHistogram


  • public class ConsumerTopicMessageHistogram
    extends java.lang.Object
    The central definition of the message consumer duration histogram. This is the definition of the message consumed duration histogram as it should be provided by all Kafka consumers to measure message process durations with Prometheus.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConsumerTopicMessageHistogram()
      Creates and registers a new Histogram matching the specification of this ConsumerTopicMessageHistogram instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void observe​(double durationSeconds, java.lang.String producerName, java.lang.String topicName)
      Observes the given message duration and adds the defined labels.
      void unregister()
      Unregisters the histogram.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConsumerTopicMessageHistogram

        public ConsumerTopicMessageHistogram()
        Creates and registers a new Histogram matching the specification of this ConsumerTopicMessageHistogram instance. Note that there should be only one registered instance of this type in the application.
    • Method Detail

      • unregister

        public void unregister()
        Unregisters the histogram. Should be called when the context is closed.
      • observe

        public void observe​(double durationSeconds,
                            java.lang.String producerName,
                            java.lang.String topicName)
        Observes the given message duration and adds the defined labels.
        Parameters:
        durationSeconds - the duration to add
        producerName - the name of the producer
        topicName - the name of the topic