[ https://issues.apache.org/jira/browse/KAFKA-9152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17012987#comment-17012987 ]
ASF GitHub Bot commented on KAFKA-9152: --------------------------------------- highluck commented on pull request #7914: KAFKA-9152; Improve Sensor Retrieval URL: https://github.com/apache/kafka/pull/7914 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Improve Sensor Retrieval > ------------------------- > > Key: KAFKA-9152 > URL: https://issues.apache.org/jira/browse/KAFKA-9152 > Project: Kafka > Issue Type: Improvement > Components: streams > Reporter: Bruno Cadonna > Assignee: highluck > Priority: Minor > Labels: newbie, tech-debt > > 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. -- This message was sent by Atlassian Jira (v8.3.4#803005)