Merge branch '1.5.x'

See gh-6982
This commit is contained in:
Andy Wilkinson 2016-11-01 13:55:34 +00:00
commit 8026b2e7a0
1 changed files with 5 additions and 24 deletions

View File

@ -28,12 +28,8 @@ import org.springframework.boot.actuate.metrics.buffer.GaugeBuffers;
import org.springframework.boot.actuate.metrics.export.Exporter; import org.springframework.boot.actuate.metrics.export.Exporter;
import org.springframework.boot.actuate.metrics.export.MetricCopyExporter; import org.springframework.boot.actuate.metrics.export.MetricCopyExporter;
import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository; import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository;
import org.springframework.boot.actuate.metrics.repository.MetricRepository;
import org.springframework.boot.actuate.metrics.writer.MetricWriter; import org.springframework.boot.actuate.metrics.writer.MetricWriter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava;
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava.JavaVersion;
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava.Range;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -44,12 +40,11 @@ import org.springframework.messaging.MessageChannel;
* user-facing {@link GaugeService} and {@link CounterService} instances, and also back * user-facing {@link GaugeService} and {@link CounterService} instances, and also back
* end repositories to catch the data pumped into them. * end repositories to catch the data pumped into them.
* <p> * <p>
* An {@link InMemoryMetricRepository} is always created unless another * In general, even if metric data needs to be stored and analysed remotely, it is
* {@link MetricRepository} is already provided by the user. In general, even if metric * recommended to use in-memory storage to buffer metric updates locally as is done by the
* data needs to be stored and analysed remotely, it is recommended to use an in-memory * default {@link CounterBuffers} and {@link GaugeBuffers}. The values can be exported
* repository to buffer metric updates locally. The values can be exported (e.g. on a * (e.g. on a periodic basis) using an {@link Exporter}, most implementations of which
* periodic basis) using an {@link Exporter}, most implementations of which have * have optimizations for sending data to remote repositories.
* optimizations for sending data to remote repositories.
* <p> * <p>
* If Spring Messaging is on the classpath and a {@link MessageChannel} called * If Spring Messaging is on the classpath and a {@link MessageChannel} called
* "metricsChannel" is also available, all metric update events are published additionally * "metricsChannel" is also available, all metric update events are published additionally
@ -115,18 +110,4 @@ public class MetricRepositoryAutoConfiguration {
} }
} }
@Configuration
@ConditionalOnJava(value = JavaVersion.EIGHT, range = Range.OLDER_THAN)
@ConditionalOnMissingBean(name = "actuatorMetricRepository")
static class LegacyMetricRepositoryConfiguration {
@Bean
@ExportMetricReader
@ActuatorMetricWriter
public InMemoryMetricRepository actuatorMetricRepository() {
return new InMemoryMetricRepository();
}
}
} }