diff --git a/psc/src/main/java/com/pinterest/psc/consumer/PscConsumer.java b/psc/src/main/java/com/pinterest/psc/consumer/PscConsumer.java index c242321..12ea1af 100644 --- a/psc/src/main/java/com/pinterest/psc/consumer/PscConsumer.java +++ b/psc/src/main/java/com/pinterest/psc/consumer/PscConsumer.java @@ -1902,7 +1902,9 @@ public Map metrics() throws ClientException { ensureOpen(); Map metrics = new ConcurrentHashMap<>(); for (PscBackendConsumer backendConsumer : backendConsumers) { - metrics.putAll(backendConsumer.metrics()); + synchronized (backendConsumer.metrics()) { + metrics.putAll(backendConsumer.metrics()); + } } return metrics; }