mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Small docs tweaks in metrics
This commit is contained in:
parent
b12d7c705c
commit
0dca2dd978
@ -32,8 +32,11 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* A {@link MetricRepository} implementation for a redis backend. Metric values are stored
|
||||
* as regular hash values against a key composed of the metric name prefixed with a
|
||||
* constant (default "spring.metrics.").
|
||||
* as zset values plus a regular hash value for the timestamp, both against a key composed
|
||||
* of the metric name prefixed with a constant (default "spring.metrics."). If you have
|
||||
* multiple metrics repositories all point at the same instance of Redis, it may be useful
|
||||
* to change the prefix to be unique (but not if you want them to contribute to the same
|
||||
* metrics).
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
|
@ -658,12 +658,19 @@ http://matt.aimonetti.net/posts/2013/06/26/practical-guide-to-graphite-monitorin
|
||||
Metric service implementations are usually bound to a
|
||||
{sc-spring-boot-actuator}/metrics/repository/MetricRepository.{sc-ext}[`MetricRepository`].
|
||||
A `MetricRepository` is responsible for storing and retrieving metric information. Spring
|
||||
Boot provides an `InMemoryMessageRespository` and a `RedisMetricRepository` out of the
|
||||
Boot provides an `InMemoryMetricRespository` and a `RedisMetricRepository` out of the
|
||||
box (the in-memory repository is the default) but you can also write your own. The
|
||||
`MetricRepository` interface is actually composed of higher level `MetricReader` and
|
||||
`MetricWriter` interfaces. For full details refer to the
|
||||
{dc-spring-boot-actuator}/metrics/repository/MetricRepository.{dc-ext}[Javadoc].
|
||||
|
||||
There's nothing to stop you hooking a `MetricRepository` with back-end storage directly
|
||||
into your app, but we recommend using the default `InMemoryMetricRespository`
|
||||
(possibly with a custom `Map` instance if you are worried about heap usage) and
|
||||
populating a back-end repository through a scheduled export job. In that way you get
|
||||
some buffering in memory of the metric values and you can reduce the network
|
||||
chatter by exporting less frequently or in batches. Spring Boot provides
|
||||
an `Exporter` interface and a few basic implementations for you to get started with that.
|
||||
|
||||
|
||||
[[production-ready-code-hale-metrics]]
|
||||
|
Loading…
Reference in New Issue
Block a user