From 66a67bb353d80ba6c351f6ff4586c2d3b301bfe1 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Wed, 19 Dec 2018 15:14:38 -0500 Subject: [PATCH] Code replaced by micrometer. Fixes #3326 --- .../HystrixCircuitBreakerConfiguration.java | 110 ------------------ 1 file changed, 110 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java index 49e52a5b5..8a15c1cc6 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java @@ -49,116 +49,6 @@ public class HystrixCircuitBreakerConfiguration { return HasFeatures.namedFeatures(new NamedFeature("Hystrix", HystrixCommandAspect.class)); } - //FIXME: 2.0.0 - /*@Configuration - @ConditionalOnProperty(value = "hystrix.metrics.enabled", matchIfMissing = true) - @ConditionalOnClass({ HystrixMetricsPoller.class, GaugeService.class }) - @EnableConfigurationProperties(HystrixMetricsProperties.class) - protected static class HystrixMetricsPollerConfiguration implements SmartLifecycle { - - private static Log logger = LogFactory - .getLog(HystrixMetricsPollerConfiguration.class); - - @Autowired(required = false) - private GaugeService gauges; - - @Autowired - private HystrixMetricsProperties metricsProperties; - - private ObjectMapper mapper = new ObjectMapper(); - - private HystrixMetricsPoller poller; - - private Set reserved = new HashSet(Arrays.asList("group", "name", - "type", "currentTime")); - - @Override - public void start() { - if (this.gauges == null) { - return; - } - MetricsAsJsonPollerListener listener = new MetricsAsJsonPollerListener() { - @Override - public void handleJsonMetric(String json) { - try { - @SuppressWarnings("unchecked") - Map map = HystrixMetricsPollerConfiguration.this.mapper - .readValue(json, Map.class); - if (map != null && map.containsKey("type")) { - addMetrics(map, "hystrix."); - } - } - catch (IOException ex) { - // ignore - } - } - - }; - this.poller = new HystrixMetricsPoller(listener, - metricsProperties.getPollingIntervalMs()); - // start polling and it will write directly to the listener - this.poller.start(); - logger.info("Starting poller"); - } - - private void addMetrics(Map map, String root) { - StringBuilder prefixBuilder = new StringBuilder(root); - if (map.containsKey("type")) { - prefixBuilder.append((String) map.get("type")); - if (map.containsKey("group")) { - prefixBuilder.append(".").append(map.get("group")); - } - prefixBuilder.append(".").append(map.get("name")); - } - String prefix = prefixBuilder.toString(); - for (String key : map.keySet()) { - Object value = map.get(key); - if (!this.reserved.contains(key)) { - if (value instanceof Number) { - String name = prefix + "." + key; - this.gauges.submit(name, ((Number) value).doubleValue()); - } - else if (value instanceof Map) { - @SuppressWarnings("unchecked") - Map sub = (Map) value; - addMetrics(sub, prefix + "." + key); - } - } - } - } - - @Override - public void stop() { - if (this.poller != null) { - this.poller.shutdown(); - } - } - - @Override - public boolean isRunning() { - return this.poller != null ? this.poller.isRunning() : false; - } - - @Override - public int getPhase() { - return Ordered.LOWEST_PRECEDENCE; - } - - @Override - public boolean isAutoStartup() { - return true; - } - - @Override - public void stop(Runnable callback) { - if (this.poller != null) { - this.poller.shutdown(); - } - callback.run(); - } - - }*/ - /** * {@link DisposableBean} that makes sure that Hystrix internal state is cleared when * {@link ApplicationContext} shuts down.