pull/25943/head
Phillip Webb 4 years ago
parent e7314623cb
commit 4b05dbf4a2

@ -148,7 +148,7 @@ public class TomcatWebServerFactoryCustomizer
factory.addConnectorCustomizers((connector) -> { factory.addConnectorCustomizers((connector) -> {
ProtocolHandler handler = connector.getProtocolHandler(); ProtocolHandler handler = connector.getProtocolHandler();
if (handler instanceof AbstractProtocol) { if (handler instanceof AbstractProtocol) {
final AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler; AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
protocol.setKeepAliveTimeout((int) keepAliveTimeout.toMillis()); protocol.setKeepAliveTimeout((int) keepAliveTimeout.toMillis());
} }
}); });

@ -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. 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 <<spring-boot-features.adoc#boot-features-webflux-error-handling, setting handled exceptions as request parameters>>. Applications can opt-in and record exceptions by <<spring-boot-features.adoc#boot-features-webflux-error-handling, setting handled exceptions as request parameters>>.
[[production-ready-metrics-jersey-server]] [[production-ready-metrics-jersey-server]]
==== Jersey Server Metrics ==== 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. 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] [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: 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]] [[production-ready-metrics-custom]]
=== Registering custom metrics === Registering custom metrics
To register custom metrics, inject `MeterRegistry` into your component, as shown in the following example: To register custom metrics, inject `MeterRegistry` into your component, as shown in the following example:

@ -16,7 +16,6 @@
package org.springframework.boot.docs.productionreadyfeatures.metrics.mongo; package org.springframework.boot.docs.productionreadyfeatures.metrics.mongo;
// tag::code[]
import com.mongodb.event.CommandEvent; import com.mongodb.event.CommandEvent;
import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandTagsProvider; import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandTagsProvider;
@ -33,7 +32,7 @@ public class SampleCommandTagsProviderConfiguration {
} }
} }
// end::code[] // @chomp:file
class CustomCommandTagsProvider implements MongoMetricsCommandTagsProvider { class CustomCommandTagsProvider implements MongoMetricsCommandTagsProvider {

@ -28,9 +28,8 @@ public class ExceptionHandlingController {
@GetMapping("/profile") @GetMapping("/profile")
public Rendering userProfile() { public Rendering userProfile() {
// ..
throw new IllegalStateException();
// ... // ...
throw new IllegalStateException();
} }
@ExceptionHandler(IllegalStateException.class) @ExceptionHandler(IllegalStateException.class)

Loading…
Cancel
Save