Allow configuration of auto-timed metrics

When `management.metrics.web.server.auto-time-requests` is enabled
(default=true), Spring Boot collects metrics on controller methods even
when they are not annotated with `@Timed`.

When this happens, created metrics are based on the default
`@Timed` configuration and there is no way to customize the
configuration of those auto-timed controller metrics.

This commit adds default configurations to auto-timed requests on both
client and server sides.

See gh-15988
This commit is contained in:
Tadaya Tsuyukubo
2019-04-17 17:46:06 -07:00
committed by Stephane Nicoll
parent 3d814a5288
commit 4df6f5dee0
20 changed files with 417 additions and 73 deletions

View File

@@ -1801,7 +1801,7 @@ application's absolute start time
[[production-ready-metrics-spring-mvc]]
==== Spring MVC Metrics
Auto-configuration enables the instrumentation of requests handled by Spring MVC. When
`management.metrics.web.server.auto-time-requests` is `true`, this instrumentation occurs
`management.metrics.web.server.request.auto-time.enabled` is `true`, this instrumentation occurs
for all requests. Alternatively, when set to `false`, you can enable instrumentation by
adding `@Timed` to a request-handling method:
@@ -1896,7 +1896,7 @@ To customize the tags, provide a `@Bean` that implements `WebFluxTagsProvider`.
[[production-ready-metrics-jersey-server]]
==== Jersey Server Metrics
Auto-configuration enables the instrumentation of requests handled by the Jersey JAX-RS
implementation. When `management.metrics.web.server.auto-time-requests` is `true`, this
implementation. When `management.metrics.web.server.request.auto-time.enabled` is `true`, this
instrumentation occurs for all requests. Alternatively, when set to `false`, you can
enable instrumentation by adding `@Timed` to a request-handling method: