public void removeMetrics() {
        // Close quietly here so that we can be sure to close everything even if one attempt fails
        Utils.closeQuietly(taskMetricsGroup::close, "Task metrics group");
        Utils.closeQuietly(errorMetrics, "Error handling metrics");
    }
Remove all metrics published by this task.
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerTask.java