Commit 7234a997 by Spencer Gibb

Merge pull request #735 from jkschneider/metrics-gauge-deconflict

* jkschneider-metrics-gauge-deconflict: Deconflict GaugeService provided by Servo/Spectator integration
parents 2bb6befb 33d65184
......@@ -27,7 +27,6 @@ import org.springframework.context.annotation.Import;
import org.springframework.web.client.RestTemplate;
import com.netflix.servo.MonitorRegistry;
import com.netflix.servo.publish.MetricPoller;
import com.netflix.servo.publish.MonitorRegistryMetricPoller;
import com.netflix.servo.tag.BasicTagList;
......@@ -65,13 +64,7 @@ public class AtlasAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public MetricPoller metricPoller(MonitorRegistry monitorRegistry) {
return new MonitorRegistryMetricPoller(monitorRegistry);
}
@Bean
@ConditionalOnMissingBean
public Exporter exporter(AtlasMetricObserver observer, MetricPoller poller) {
return new AtlasExporter(observer, poller);
public Exporter exporter(AtlasMetricObserver observer, MonitorRegistry monitorRegistry) {
return new AtlasExporter(observer, new MonitorRegistryMetricPoller(monitorRegistry));
}
}
......@@ -81,12 +81,12 @@ public class AtlasMetricObserver implements MetricObserver {
protected static boolean validTags(TagList tags) {
for (Tag tag : tags) {
if (!validAtlasTag.matcher(tag.getKey()).matches()) {
logger.error("Invalid tag key " + tag.getKey());
logger.debug("Invalid tag key " + tag.getKey());
return false;
}
if (!validAtlasTag.matcher(tag.getValue()).matches()) {
logger.error("Invalid tag value " + tag.getValue());
logger.debug("Invalid tag value " + tag.getValue());
return false;
}
}
......
......@@ -13,10 +13,8 @@
package org.springframework.cloud.netflix.metrics.servo;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration;
import org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics;
import org.springframework.boot.actuate.metrics.CounterService;
import org.springframework.boot.actuate.metrics.GaugeService;
import org.springframework.boot.actuate.metrics.reader.MetricReader;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
......@@ -43,7 +41,7 @@ import com.netflix.servo.monitor.Monitors;
@Configuration
@ConditionalOnClass({ Monitors.class, MetricReader.class })
@ConditionalOnMissingClass("com.netflix.spectator.api.Registry")
@AutoConfigureBefore(EndpointAutoConfiguration.class)
@AutoConfigureBefore(MetricRepositoryAutoConfiguration.class)
@Import(MetricsInterceptorConfiguration.class)
public class ServoMetricsAutoConfiguration {
@Bean
......@@ -78,8 +76,7 @@ public class ServoMetricsAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean({ ServoMetricServices.class, CounterService.class, GaugeService.class })
public ServoMetricServices spectatorMetricServices(MonitorRegistry monitorRegistry) {
public ServoMetricServices servoMetricServices(MonitorRegistry monitorRegistry) {
return new ServoMetricServices(monitorRegistry);
}
......
......@@ -14,7 +14,7 @@
package org.springframework.cloud.netflix.metrics.spectator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration;
import org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics;
import org.springframework.boot.actuate.metrics.reader.MetricReader;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
......@@ -30,8 +30,6 @@ import org.springframework.context.annotation.Import;
import com.netflix.servo.DefaultMonitorRegistry;
import com.netflix.servo.MonitorRegistry;
import com.netflix.servo.publish.MetricPoller;
import com.netflix.servo.publish.MonitorRegistryMetricPoller;
import com.netflix.spectator.api.Registry;
import com.netflix.spectator.servo.ServoRegistry;
......@@ -46,7 +44,7 @@ import com.netflix.spectator.servo.ServoRegistry;
* @author Jon Schneider
*/
@Configuration
@AutoConfigureBefore(EndpointAutoConfiguration.class)
@AutoConfigureBefore(MetricRepositoryAutoConfiguration.class)
@ConditionalOnClass({ Registry.class, MetricReader.class })
@Import(MetricsInterceptorConfiguration.class)
public class SpectatorMetricsAutoConfiguration {
......@@ -73,7 +71,6 @@ public class SpectatorMetricsAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean
public SpectatorMetricServices spectatorMetricServices(Registry metricRegistry) {
return new SpectatorMetricServices(metricRegistry);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment