@Configuration public class MetricRepositoryAutoConfiguration extends Object
Auto-configuration
for metrics services. Creates
user-facing GaugeService
and CounterService
instances, and also back
end repositories to catch the data pumped into them.
In general, even if metric data needs to be stored and analysed remotely, it is
recommended to use in-memory storage to buffer metric updates locally as is done by the
default CounterBuffers
and GaugeBuffers
. The values can be exported
(e.g. on a periodic basis) using an Exporter
, most implementations of which
have optimizations for sending data to remote repositories.
If Spring Messaging is on the classpath and a MessageChannel
called
"metricsChannel" is also available, all metric update events are published additionally
as messages on that channel. Additional analysis or actions can be taken by clients
subscribing to that channel.
In addition if Dropwizard's metrics library is on the classpath a
MetricRegistry
will be created and the default counter and gauge services will
switch to using it instead of the default repository. Users can create "special"
Dropwizard metrics by prefixing their metric names with the appropriate type (e.g.
"histogram.*", "meter.*". "timer.*") and sending them to the GaugeService
or
CounterService
.
By default all metric updates go to all MetricWriter
instances in the
application context via a MetricCopyExporter
firing every 5 seconds (disable
this by setting spring.metrics.export.enabled=false
).
GaugeService
,
CounterService
,
MetricWriter
,
InMemoryMetricRepository
,
Exporter
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.