Apply user-provided ObservationConventions in auto-configurations
Prior to this commit, we would advise developers, as migration path from Spring Boot 2.0-x metrics, to create `GlobalObservationConvention` beans for the observations they want to customize (observation name or key values). `GlobalObservationConvention` are currently applied **in addition** to the chosen convention in some cases, so this does not work well with this migration path. Instead, instrumentations always provide a default convention but also a way to configure a custom convention for their observations. Spring Boot should inject custom convention beans in the relevant auto-configurations. Fixes gh-33285
This commit is contained in:
@@ -769,7 +769,7 @@ By default, Spring MVC related metrics are tagged with the following information
|
||||
|===
|
||||
|
||||
To add to the default tags, provide a `@Bean` that extends `DefaultServerRequestObservationConvention` from the `org.springframework.http.observation` package.
|
||||
To replace the default tags, provide a `@Bean` that implements `GlobalObservationConvention<ServerRequestObservationContext>`.
|
||||
To replace the default tags, provide a `@Bean` that implements `ServerRequestObservationConvention`.
|
||||
|
||||
|
||||
TIP: In some cases, exceptions handled in web controllers are not recorded as request metrics tags.
|
||||
@@ -809,7 +809,7 @@ By default, WebFlux related metrics are tagged with the following information:
|
||||
|===
|
||||
|
||||
To add to the default tags, provide a `@Bean` that extends `DefaultServerRequestObservationConvention` from the `org.springframework.http.observation.reactive` package.
|
||||
To replace the default tags, provide a `@Bean` that implements `GlobalObservationConvention<ServerRequestObservationContext>`.
|
||||
To replace the default tags, provide a `@Bean` that implements `ServerRequestObservationConvention`.
|
||||
|
||||
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 <<web#web.reactive.webflux.error-handling, setting handled exceptions as request attributes>>.
|
||||
|
||||
Reference in New Issue
Block a user