diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java index 98c7813eb..b90b65f56 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java @@ -102,17 +102,18 @@ public static void reset() { /* package */ HystrixMetricsPublisherCommand getPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { // attempt to retrieve from cache first - HystrixMetricsPublisherCommand publisher = commandPublishers.get(commandKey.name()); + String cacheKey = commandOwner.name() + commandKey.name(); + HystrixMetricsPublisherCommand publisher = commandPublishers.get(cacheKey); if (publisher != null) { return publisher; } else { synchronized (this) { - HystrixMetricsPublisherCommand existingPublisher = commandPublishers.get(commandKey.name()); + HystrixMetricsPublisherCommand existingPublisher = commandPublishers.get(cacheKey); if (existingPublisher != null) { return existingPublisher; } else { HystrixMetricsPublisherCommand newPublisher = HystrixPlugins.getInstance().getMetricsPublisher().getMetricsPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties); - commandPublishers.putIfAbsent(commandKey.name(), newPublisher); + commandPublishers.putIfAbsent(cacheKey, newPublisher); newPublisher.initialize(); return newPublisher; }