mirror of https://github.com/apache/kafka.git
KAFKA-19697: Fix unregistering connectorStatusMetrics NPE if tasks fail to start
This commit is contained in:
parent
5919762009
commit
fe4f3e4508
|
@ -2394,6 +2394,10 @@ public final class Worker {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void recordTaskRemoved(ConnectorTaskId connectorTaskId) {
|
protected synchronized void recordTaskRemoved(ConnectorTaskId connectorTaskId) {
|
||||||
|
if (!connectorStatusMetrics.containsKey(connectorTaskId.connector())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Unregister connector task count metric if we remove the last task of the connector
|
// Unregister connector task count metric if we remove the last task of the connector
|
||||||
if (tasks.keySet().stream().noneMatch(id -> id.connector().equals(connectorTaskId.connector()))) {
|
if (tasks.keySet().stream().noneMatch(id -> id.connector().equals(connectorTaskId.connector()))) {
|
||||||
connectorStatusMetrics.get(connectorTaskId.connector()).close();
|
connectorStatusMetrics.get(connectorTaskId.connector()).close();
|
||||||
|
|
Loading…
Reference in New Issue