Skip to content

Commit f6a9c66

Browse files
committed
Support collapser metrics in HystrixMetricPublisher implementations
The included implementations of HystrixMetricsPublisher didn't override the getMetricsPublisherForCollapser method - since there are already implementations of HystrixMetricsPublisherCollapser available for each one, I've added the method for all of them.
1 parent 8eeeabe commit f6a9c66

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

hystrix-contrib/hystrix-codahale-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/codahalemetricspublisher/HystrixCodaHaleMetricsPublisher.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
import com.codahale.metrics.MetricRegistry;
1919
import com.netflix.hystrix.HystrixCircuitBreaker;
20+
import com.netflix.hystrix.HystrixCollapserKey;
21+
import com.netflix.hystrix.HystrixCollapserMetrics;
22+
import com.netflix.hystrix.HystrixCollapserProperties;
2023
import com.netflix.hystrix.HystrixCommandGroupKey;
2124
import com.netflix.hystrix.HystrixCommandKey;
2225
import com.netflix.hystrix.HystrixCommandMetrics;
@@ -25,6 +28,7 @@
2528
import com.netflix.hystrix.HystrixThreadPoolMetrics;
2629
import com.netflix.hystrix.HystrixThreadPoolProperties;
2730
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
31+
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCollapser;
2832
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCommand;
2933
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherThreadPool;
3034

@@ -47,4 +51,9 @@ public HystrixMetricsPublisherCommand getMetricsPublisherForCommand(HystrixComma
4751
public HystrixMetricsPublisherThreadPool getMetricsPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) {
4852
return new HystrixCodaHaleMetricsPublisherThreadPool(threadPoolKey, metrics, properties, metricRegistry);
4953
}
54+
55+
@Override
56+
public HystrixMetricsPublisherCollapser getMetricsPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
57+
return new HystrixCodaHaleMetricsPublisherCollapser(collapserKey, metrics, properties, metricRegistry);
58+
}
5059
}

hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisher.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
package com.netflix.hystrix.contrib.servopublisher;
1717

1818
import com.netflix.hystrix.HystrixCircuitBreaker;
19+
import com.netflix.hystrix.HystrixCollapserKey;
20+
import com.netflix.hystrix.HystrixCollapserMetrics;
21+
import com.netflix.hystrix.HystrixCollapserProperties;
1922
import com.netflix.hystrix.HystrixCommandGroupKey;
2023
import com.netflix.hystrix.HystrixCommandKey;
2124
import com.netflix.hystrix.HystrixCommandMetrics;
@@ -24,6 +27,7 @@
2427
import com.netflix.hystrix.HystrixThreadPoolMetrics;
2528
import com.netflix.hystrix.HystrixThreadPoolProperties;
2629
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
30+
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCollapser;
2731
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCommand;
2832
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherThreadPool;
2933

@@ -65,4 +69,8 @@ public HystrixMetricsPublisherThreadPool getMetricsPublisherForThreadPool(Hystri
6569
return new HystrixServoMetricsPublisherThreadPool(threadPoolKey, metrics, properties);
6670
}
6771

72+
@Override
73+
public HystrixMetricsPublisherCollapser getMetricsPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
74+
return new HystrixServoMetricsPublisherCollapser(collapserKey, metrics, properties);
75+
}
6876
}

hystrix-contrib/hystrix-yammer-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/yammermetricspublisher/HystrixYammerMetricsPublisher.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
package com.netflix.hystrix.contrib.yammermetricspublisher;
1717

1818
import com.netflix.hystrix.HystrixCircuitBreaker;
19+
import com.netflix.hystrix.HystrixCollapserKey;
20+
import com.netflix.hystrix.HystrixCollapserMetrics;
21+
import com.netflix.hystrix.HystrixCollapserProperties;
1922
import com.netflix.hystrix.HystrixCommandGroupKey;
2023
import com.netflix.hystrix.HystrixCommandKey;
2124
import com.netflix.hystrix.HystrixCommandMetrics;
@@ -24,6 +27,7 @@
2427
import com.netflix.hystrix.HystrixThreadPoolMetrics;
2528
import com.netflix.hystrix.HystrixThreadPoolProperties;
2629
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
30+
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCollapser;
2731
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCommand;
2832
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherThreadPool;
2933
import com.yammer.metrics.Metrics;
@@ -52,4 +56,9 @@ public HystrixMetricsPublisherCommand getMetricsPublisherForCommand(HystrixComma
5256
public HystrixMetricsPublisherThreadPool getMetricsPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) {
5357
return new HystrixYammerMetricsPublisherThreadPool(threadPoolKey, metrics, properties, metricsRegistry);
5458
}
59+
60+
@Override
61+
public HystrixMetricsPublisherCollapser getMetricsPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
62+
return new HystrixYammerMetricsPublisherCollapser(collapserKey, metrics, properties, metricsRegistry);
63+
}
5564
}

0 commit comments

Comments
 (0)