The instrumentation of any `RestTemplate` created using the auto-configured
`RestTemplateBuilder` is enabled. It is also possible to apply
`MetricsRestTemplateCustomizer` manually.
@ -1203,26 +1458,34 @@ The instrumentation of any `RestTemplate` created using the auto-configured
@@ -1203,26 +1458,34 @@ The instrumentation of any `RestTemplate` created using the auto-configured
By default, metrics are generated with the name, `http.client.requests`. The name can be
customized by setting the `management.metrics.web.client.requests-metric-name` property.
[[production-ready-metrics-rest-template-tags]]
==== RestTemplate Metric Tags
By default, metrics generated by an instrumented `RestTemplate` are tagged with the
following information:
* The request's method.
* The request's URI (templated if possible).
* The response's status.
* The request URI's host.
* `method`, the request's method (for example, `GET` or `POST`).
* `uri`, the request's URI template prior to variable substitution, if possible (for
example, `/api/person/{id}`).
* `status`, the response's HTTP status code (for example, `200` or `500`).
* `clientName`, the host portion of the URI.
To customize the tags, provide a `@Bean` that implements
`RestTemplateExchangeTagsProvider`. There are convenience static functions in
`RestTemplateExchangeTags`.
[[production-ready-metrics-integration]]
==== Spring Integration metrics
When Spring Integration is available, a `timer` and `errorCounter` are registered for each
`MessageHandler` and `MessageChannel`. For each `MessageSource`, a `counter` is
registered.
[[production-ready-metrics-cache]]
=== Cache metrics
Auto-configuration will enable the instrumentation of all available ``Cache``s on startup
with metrics prefixed with `cache.`. Cache instrumentation is standardized for a basic set
of metrics. Additional, cache-specific metrics are also available. Please refer to
https://micrometer.io/docs[the Micrometer documentation] for more details.
==== Cache Metrics
Auto-configuration enables the instrumentation of all available ``Cache``s on startup
with metrics prefixed with `cache`. Cache instrumentation is standardized for a basic set
of metrics. Additional, cache-specific metrics are also available.
The following cache libraries are supported:
@ -1241,7 +1504,7 @@ is required. A `CacheMetricsRegistrar` bean is made available to make that proce
@@ -1241,7 +1504,7 @@ is required. A `CacheMetricsRegistrar` bean is made available to make that proce
[[production-ready-metrics-jdbc]]
=== DataSource Metrics
==== DataSource Metrics
Auto-configuration enables the instrumentation of all available ``DataSource`` objects
with a metric named `jdbc`. Data source instrumentation results in gauges representing the
currently active, maximum allowed, and minimum allowed connections in the pool. Each of
@ -1252,14 +1515,21 @@ Metrics are also tagged by the name of the `DataSource` computed based on the be
@@ -1252,14 +1515,21 @@ Metrics are also tagged by the name of the `DataSource` computed based on the be
[[production-ready-metrics-rabbitmq]]
=== RabbitMQ metrics
==== RabbitMQ Metrics
Auto-configuration will enable the instrumentation of all available RabbitMQ connection
factories with a metric named `rabbitmq`.
[[production-ready-metrics-custom]]
=== Registering custom metrics
To register custom metrics, create a `MeterBinder` bean. By default, all `MeterBinder`
beans will be automatically applied to the micrometer `MeterRegistry.Config`.
[[production-ready-metrics-per-meter-properties]]
=== Customizing individual meters
=== Customizing individual metrics
If you need to apply customizations to specific `Meter` instances you can use the
`io.micrometer.core.instrument.config.MeterFilter` interface. By default, all
`MeterFilter` beans will be automatically applied to the micrometer
@ -1273,6 +1543,8 @@ all meter IDs beginning with `com.example`, you can do the following:
@@ -1273,6 +1543,8 @@ all meter IDs beginning with `com.example`, you can do the following:
In addition to `MeterFilter` beans, it's also possible to apply a limited set of
customization on a per-meter basis using properties. Per-meter customizations apply to
@ -1311,6 +1583,42 @@ and percentiles" section] of the micrometer documentation.
@@ -1311,6 +1583,42 @@ and percentiles" section] of the micrometer documentation.
[[production-ready-metrics-endpoint]]
=== Metrics endpoint
Spring Boot provides a `metrics` endpoint that can be used diagnostically to examine the
metrics collected by an application. The endpoint is not available by default and must be
exposed, see <<production-ready-endpoints-exposing-endpoints,exposing endpoints>> for more
details.
Navigating to `/actuator/metrics` displays a list of available meter names. You can drill
down to view information about a particular meter by providing its name as a selector,
e.g. `/actuator/metrics/jvm.memory.max`.
[TIP]
====
The name you use here should match the name used in the code, not the name after it has
been naming-convention normalized for a monitoring system it is shipped to. In other
words, if `jvm.memory.max` appears as `jvm_memory_max` in Prometheus because of its snake
case naming convention, you should still use `jvm.memory.max` as the selector when
inspecting the meter in the `metrics` endpoint.
====
You can also add any number of `tag=KEY:VALUE` query parameters to the end of the URL to