mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-08 10:19:13 +00:00
Polish "Disable Micrometer global registry in tests by default"
See gh-51142
This commit is contained in:
+3
@@ -64,6 +64,9 @@ management:
|
||||
use-global-registry: false
|
||||
----
|
||||
|
||||
NOTE: In tests that use `spring-boot-micrometer-metrics-test`, the global registry is disabled by default.
|
||||
If you want to use the global registry in such a test, annotate it with javadoc:org.springframework.boot.micrometer.metrics.test.autoconfigure.AutoConfigureMetrics[format=annotation] using `useGlobalRegistry = true`, or set the configprop:management.metrics.use-global-registry[] property explicitly to `true`.
|
||||
|
||||
You can register any number of javadoc:org.springframework.boot.micrometer.metrics.autoconfigure.MeterRegistryCustomizer[] beans to further configure the registry, such as applying common tags, before any meters are registered with the registry:
|
||||
|
||||
include-code::commontags/MyMeterRegistryConfiguration[]
|
||||
|
||||
+3
@@ -244,6 +244,9 @@ If you need to export metrics to a different backend as part of an integration t
|
||||
If you annotate xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-tests[a sliced test] with javadoc:org.springframework.boot.micrometer.metrics.test.autoconfigure.AutoConfigureMetrics[format=annotation], it auto-configures an in-memory javadoc:io.micrometer.core.instrument.MeterRegistry[].
|
||||
Data exporting in sliced tests is not supported with the javadoc:org.springframework.boot.micrometer.metrics.test.autoconfigure.AutoConfigureMetrics[format=annotation] annotation.
|
||||
|
||||
Meter registries are not added to the xref:actuator/metrics.adoc#actuator.metrics.getting-started[global registry] by default in tests.
|
||||
If you need the global registry in a test, annotate it with javadoc:org.springframework.boot.micrometer.metrics.test.autoconfigure.AutoConfigureMetrics[format=annotation] using `useGlobalRegistry = true`, or set the configprop:management.metrics.use-global-registry[] property explicitly to `true`.
|
||||
|
||||
|
||||
|
||||
[[testing.spring-boot-applications.tracing]]
|
||||
|
||||
Reference in New Issue
Block a user