michael-carter-instaclustr opened a new pull request #8844: URL: https://github.com/apache/kafka/pull/8844
Moved the responsibility for recording task and connector startup and failure metrics from the Worker class into the status listener that gets passed into the WorkerTask. The status listener is decorated to record the metrics when onStartup or onFailure occur (if failure happens before startup). This gets around the previous issues where these metrics were not being recorded because the WorkerTasks/WorkerConnectors were either not propagating exceptions upwards, or were unable to do so easily because they were running on completely different threads. Also split out WorkerMetricsGroup from being an inner class into being a standard class. This was to make sure the Data Abstraction Coupling checkStyle rule for the Worker class was not violated. Testing involved adding some unit tests for the decorated listeners to ensure they recorded metrics correctly. Some manual testing was done with Connectors and Tasks that deliberately threw exceptions in the startup phase to ensure JMX metrics were reported correctly. Some of the unit tests for the Worker class had some assertions around startup statistics removed, as setting these statistics is no longer the direct responsibility of the Worker class, ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- 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