Polish "Disable metrics export in integration tests"
See gh-21658
This commit is contained in:
@@ -1428,6 +1428,13 @@ For example, to disable Datadog:
|
||||
management.metrics.export.datadog.enabled=false
|
||||
----
|
||||
|
||||
You can also disable all registries unless stated otherwise by the registry-specific property, as shown in the following example:
|
||||
|
||||
[source,properties,indent=0,configprops]
|
||||
----
|
||||
management.metrics.export.defaults.enabled=false
|
||||
----
|
||||
|
||||
Spring Boot will also add any auto-configured registries to the global static composite registry on the `Metrics` class unless you explicitly tell it not to:
|
||||
|
||||
[source,properties,indent=0,configprops]
|
||||
|
||||
@@ -6638,6 +6638,14 @@ include::{test-examples}/jmx/SampleJmxTests.java[tag=test]
|
||||
|
||||
|
||||
|
||||
[[boot-features-testing-spring-boot-applications-metrics]]
|
||||
==== Using Metrics
|
||||
Regardless of your classpath, meter registries, except the in-memory backed, are not auto-configured when using `@SpringBootTest`.
|
||||
|
||||
If you need to export metrics to a different backend as part of an integration test, annotate it with `@AutoConfigureMetrics`.
|
||||
|
||||
|
||||
|
||||
[[boot-features-testing-spring-boot-applications-mocking-beans]]
|
||||
==== Mocking and Spying Beans
|
||||
When running tests, it is sometimes necessary to mock certain components within your application context.
|
||||
|
||||
Reference in New Issue
Block a user