Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-9152

Improve Sensor Retrieval

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.5.0
    • streams

    Description

      This ticket shall improve two aspects of the retrieval of sensors:

      1. Currently, when a sensor is retrieved with *Metrics.*Sensor() (e.g. ThreadMetrics.createTaskSensor()) after it was created with the same method *Metrics.*Sensor(), the sensor is added again to the corresponding queue in *Sensors (e.g. threadLevelSensors) in StreamsMetricsImpl. Those queues are used to remove the sensors when removeAll*LevelSensors() is called. Having multiple times the same sensors in this queue is not an issue from a correctness point of view. However, it would reduce the footprint to only store a sensor once in those queues.

      2. When a sensor is retrieved, the current code attempts to create a new sensor and to add to it again the corresponding metrics. This could be avoided.

      Both aspects could be improved by checking whether a sensor already exists by calling getSensor() on the Metrics object and checking the return value.

      Attachments

        Issue Links

          Activity

            People

              high.lee highluck
              cadonna Bruno Cadonna
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: