Auto-configure observatibility beans in sliced tests
If @AutoConfigureObservability is applied to a sliced test, it auto-configures: - An in-memory MeterRegistry - A no-op Tracer - An ObservationRegistry Closes gh-38568
This commit is contained in:
@@ -255,6 +255,11 @@ If such test needs access to an `MBeanServer`, consider marking it dirty as well
|
||||
include::code:MyJmxTests[]
|
||||
|
||||
|
||||
[[features.testing.spring-boot-applications.observations]]
|
||||
==== Using Observations
|
||||
If you annotate <<features#features.testing.spring-boot-applications.autoconfigured-tests, a sliced test>> with `@AutoConfigureObservability`, it auto-configures an `ObservationRegistry`.
|
||||
|
||||
|
||||
|
||||
[[features.testing.spring-boot-applications.metrics]]
|
||||
==== Using Metrics
|
||||
@@ -262,6 +267,9 @@ Regardless of your classpath, meter registries, except the in-memory backed, are
|
||||
|
||||
If you need to export metrics to a different backend as part of an integration test, annotate it with `@AutoConfigureObservability`.
|
||||
|
||||
If you annotate <<features#features.testing.spring-boot-applications.autoconfigured-tests, a sliced test>> with `@AutoConfigureObservability`, it auto-configures an in-memory `MeterRegistry`.
|
||||
Data exporting in sliced tests is not supported with the `@AutoConfigureObservability` annotation.
|
||||
|
||||
|
||||
|
||||
[[features.testing.spring-boot-applications.tracing]]
|
||||
@@ -272,6 +280,9 @@ If you need those components as part of an integration test, annotate the test w
|
||||
|
||||
If you have created your own reporting components (e.g. a custom `SpanExporter` or `SpanHandler`) and you don't want them to be active in tests, you can use the `@ConditionalOnEnabledTracing` annotation to disable them.
|
||||
|
||||
If you annotate <<features#features.testing.spring-boot-applications.autoconfigured-tests, a sliced test>> with `@AutoConfigureObservability`, it auto-configures a no-op `Tracer`.
|
||||
Data exporting in sliced tests is not supported with the `@AutoConfigureObservability` annotation.
|
||||
|
||||
|
||||
|
||||
[[features.testing.spring-boot-applications.mocking-beans]]
|
||||
|
||||
Reference in New Issue
Block a user