Skip to content

Commit 67467de

Browse files
Merge pull request #33 from benjchristensen/migrate-servo-to-contrib
Remove Servo dependency from core, move to submodule #24
2 parents a476fee + 6dad259 commit 67467de

12 files changed

+678
-566
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apply plugin: 'java'
2+
dependencies {
3+
compile project(':hystrix-core')
4+
compile 'com.netflix.servo:servo-core:0.4.27'
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Copyright 2012 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.netflix.hystrix.contrib.servopublisher;
17+
18+
import com.netflix.hystrix.HystrixCircuitBreaker;
19+
import com.netflix.hystrix.HystrixCommandGroupKey;
20+
import com.netflix.hystrix.HystrixCommandKey;
21+
import com.netflix.hystrix.HystrixCommandMetrics;
22+
import com.netflix.hystrix.HystrixCommandProperties;
23+
import com.netflix.hystrix.HystrixThreadPoolKey;
24+
import com.netflix.hystrix.HystrixThreadPoolMetrics;
25+
import com.netflix.hystrix.HystrixThreadPoolProperties;
26+
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
27+
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCommand;
28+
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherThreadPool;
29+
30+
/**
31+
* Servo implementation of {@link HystrixMetricsPublisher}.
32+
* <p>
33+
* See <a href="https://github.com/Netflix/Hystrix/wiki/Plugins">Wiki docs</a> about plugins for more information.
34+
*/
35+
public class HystrixServoMetricsPublisher extends HystrixMetricsPublisher {
36+
37+
private static HystrixServoMetricsPublisher INSTANCE = new HystrixServoMetricsPublisher();
38+
39+
public static HystrixServoMetricsPublisher getInstance() {
40+
return INSTANCE;
41+
}
42+
43+
private HystrixServoMetricsPublisher() {
44+
}
45+
46+
@Override
47+
public HystrixMetricsPublisherCommand getMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) {
48+
return new HystrixServoMetricsPublisherCommand(commandKey, commandGroupKey, metrics, circuitBreaker, properties);
49+
}
50+
51+
@Override
52+
public HystrixMetricsPublisherThreadPool getMetricsPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) {
53+
return new HystrixServoMetricsPublisherThreadPool(threadPoolKey, metrics, properties);
54+
}
55+
56+
}

hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsServoPublisherAbstract.java hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherAbstract.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.netflix.hystrix.strategy.metrics;
16+
package com.netflix.hystrix.contrib.servopublisher;
1717

1818
import com.netflix.hystrix.HystrixCommandMetrics;
1919
import com.netflix.hystrix.util.HystrixRollingNumberEvent;
@@ -27,9 +27,9 @@
2727
import com.netflix.servo.tag.Tag;
2828

2929
/**
30-
* Utility used for Servo (https://github.com/Netflix/servo) based default implementations of metrics publishers.
30+
* Utility used for Servo (https://github.com/Netflix/servo) based implementations of metrics publishers.
3131
*/
32-
/* package */abstract class HystrixMetricsServoPublisherAbstract {
32+
/* package */abstract class HystrixServoMetricsPublisherAbstract {
3333

3434
protected abstract Tag getServoTypeTag();
3535

0 commit comments

Comments
 (0)