From 3fa8fe85afc0a986208f00fe87097337ca6c1831 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Thu, 12 Apr 2018 12:08:44 +0200 Subject: [PATCH] Deprecate RouterFunctionMetrics Spring Boot now deploys both annotation-based and functional endpoints under the same `HttpHandler`; this means the currently auto-configured `MetricsWebFilter` is instrumenting all endpoints to produce metrics. There is no need for a WebFlux functional specific support. This commit removes mentions of `RouterFunctionMetrics` in the docs and deprecates that class. Closes gh-12833 --- .../reactive/server/RouterFunctionMetrics.java | 2 ++ .../asciidoc/production-ready-features.adoc | 17 ++--------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java index cf3e7e44a6..a8e7bf7c97 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java @@ -36,7 +36,9 @@ import org.springframework.web.reactive.function.server.ServerResponse; * * @author Jon Schneider * @since 2.0.0 + * @deprecated in favor of the auto-configured {@link MetricsWebFilter} */ +@Deprecated public class RouterFunctionMetrics { private final MeterRegistry registry; diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index dbabec7356..b3516f6127 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -1684,14 +1684,12 @@ To customize the tags, provide a `@Bean` that implements `WebMvcTagsProvider`. [[production-ready-metrics-web-flux]] ==== Spring WebFlux Metrics Auto-configuration enables the instrumentation of all requests handled by WebFlux -controllers. You can also use a helper class, `RouterFunctionMetrics`, to instrument -applications that use WebFlux's functional programming model. +controllers and functional handlers. By default, metrics are generated with the name `http.server.requests`. You can customize the name by setting the `management.metrics.web.server.requests-metric-name` property. -By default, WebFlux-related metrics for the annotation-based programming model are tagged -with the following information: +By default, WebFlux-related metrics are tagged with the following information: * `method`, the request's method (for example, `GET` or `POST`). * `uri`, the request's URI template prior to variable substitution, if possible (for @@ -1702,17 +1700,6 @@ request. To customize the tags, provide a `@Bean` that implements `WebFluxTagsProvider`. -By default, metrics for the functional programming model are tagged with the following -information: - -* `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`). - -To customize the tags, use the `defaultTags` method on your `RouterFunctionMetrics` -instance. - [[production-ready-metrics-rest-template]]