From 4b05dbf4a257ec0c05701851b3b386e7e63b1663 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 6 Apr 2021 14:59:13 -0700 Subject: [PATCH] Polish --- .../web/embedded/TomcatWebServerFactoryCustomizer.java | 2 +- .../src/docs/asciidoc/production-ready-features.adoc | 5 ++++- .../mongo/SampleCommandTagsProviderConfiguration.java | 3 +-- .../webapplications/webflux/ExceptionHandlingController.java | 3 +-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java index c0971cc06f..068956e133 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java @@ -148,7 +148,7 @@ public class TomcatWebServerFactoryCustomizer factory.addConnectorCustomizers((connector) -> { ProtocolHandler handler = connector.getProtocolHandler(); if (handler instanceof AbstractProtocol) { - final AbstractProtocol protocol = (AbstractProtocol) handler; + AbstractProtocol protocol = (AbstractProtocol) handler; protocol.setKeepAliveTimeout((int) keepAliveTimeout.toMillis()); } }); diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc index 1c26e7ba03..4b7220ee36 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc @@ -2234,6 +2234,8 @@ To replace the default tags, provide a `@Bean` that implements `WebFluxTagsProvi TIP: In some cases, exceptions handled in controllers and handler functions are not recorded as request metrics tags. Applications can opt-in and record exceptions by <>. + + [[production-ready-metrics-jersey-server]] ==== Jersey Server Metrics When Micrometer's `micrometer-jersey2` module is on the classpath, auto-configuration enables the instrumentation of requests handled by the Jersey JAX-RS implementation. @@ -2428,7 +2430,7 @@ To replace the default metric tags, define a `MongoMetricsCommandTagsProvider` b [source,java,indent=0] ---- -include::{include-productionreadyfeatures}/metrics/mongo/SampleCommandTagsProviderConfiguration.java[tag=*] +include::{include-productionreadyfeatures}/metrics/mongo/SampleCommandTagsProviderConfiguration.java[] ---- To disable the auto-configured command metrics, set the following property: @@ -2481,6 +2483,7 @@ To disable the auto-configured connection pool metrics, set the following proper ---- + [[production-ready-metrics-custom]] === Registering custom metrics To register custom metrics, inject `MeterRegistry` into your component, as shown in the following example: diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/mongo/SampleCommandTagsProviderConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/mongo/SampleCommandTagsProviderConfiguration.java index 62262bfcef..1ff43fce10 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/mongo/SampleCommandTagsProviderConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/mongo/SampleCommandTagsProviderConfiguration.java @@ -16,7 +16,6 @@ package org.springframework.boot.docs.productionreadyfeatures.metrics.mongo; -// tag::code[] import com.mongodb.event.CommandEvent; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandTagsProvider; @@ -33,7 +32,7 @@ public class SampleCommandTagsProviderConfiguration { } } -// end::code[] +// @chomp:file class CustomCommandTagsProvider implements MongoMetricsCommandTagsProvider { diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/webapplications/webflux/ExceptionHandlingController.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/webapplications/webflux/ExceptionHandlingController.java index a3914a59fe..ba4f0f236b 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/webapplications/webflux/ExceptionHandlingController.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/webapplications/webflux/ExceptionHandlingController.java @@ -28,9 +28,8 @@ public class ExceptionHandlingController { @GetMapping("/profile") public Rendering userProfile() { - // .. - throw new IllegalStateException(); // ... + throw new IllegalStateException(); } @ExceptionHandler(IllegalStateException.class)