[#99] Basic Health Metrics

Changes following review
    - Reusing CounterService to automatically profit from Dropwizard if present
    - NoOp is the default impl for SpanReporterService
    - SpanReporterService has configurable metric names (it's enough to change the
    name to 'meter.a.b.c' to profit from Dropwizard's meters)

    Fixes gh-99
This commit is contained in:
Marcin Grzejszczak
2016-01-21 15:55:26 +01:00
parent 3a4554d8c1
commit 301c6b230a
16 changed files with 328 additions and 64 deletions

View File

@@ -23,6 +23,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.cloud.sleuth.metric.SpanReporterService;
import org.springframework.cloud.sleuth.zipkin.HttpZipkinSpanReporter;
import org.springframework.cloud.sleuth.zipkin.ZipkinProperties;
import org.springframework.cloud.sleuth.zipkin.ZipkinSpanReporter;
@@ -73,12 +74,14 @@ public class ZipkinTests extends AbstractIntegrationTest {
public static class WaitUntilZipkinIsUpConfig {
@Bean
@SneakyThrows
public ZipkinSpanReporter spanCollector(final ZipkinProperties zipkin) {
public ZipkinSpanReporter spanCollector(final ZipkinProperties zipkin,
final SpanReporterService spanReporterService) {
await().until(new Runnable() {
@Override
public void run() {
try {
WaitUntilZipkinIsUpConfig.this.getSpanCollector(zipkin);
WaitUntilZipkinIsUpConfig.this.getSpanCollector(zipkin,
spanReporterService);
}
catch (Exception e) {
log.error("Exception occurred while trying to connect to zipkin ["
@@ -87,11 +90,13 @@ public class ZipkinTests extends AbstractIntegrationTest {
}
}
});
return getSpanCollector(zipkin);
return getSpanCollector(zipkin, spanReporterService);
}
private ZipkinSpanReporter getSpanCollector(ZipkinProperties zipkin) {
return new HttpZipkinSpanReporter(zipkin.getBaseUrl(), zipkin.getFlushInterval());
private ZipkinSpanReporter getSpanCollector(ZipkinProperties zipkin,
SpanReporterService spanReporterService) {
return new HttpZipkinSpanReporter(zipkin.getBaseUrl(), zipkin.getFlushInterval(),
spanReporterService);
}
}
}