Merge branch '2.3.x'
Closes gh-22630
This commit is contained in:
@@ -1468,14 +1468,7 @@ You can apply customizations to particular registry implementations by being mor
|
||||
}
|
||||
----
|
||||
|
||||
With that setup in place you can inject `MeterRegistry` in your components and register metrics:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::{code-examples}/actuate/metrics/SampleBean.java[tag=example]
|
||||
----
|
||||
|
||||
Spring Boot also <<production-ready-metrics-meter,configures built-in instrumentation>> (i.e. `MeterBinder` implementations) that you can control via configuration or dedicated annotation markers.
|
||||
Spring Boot also <<production-ready-metrics-meter,configures built-in instrumentation>> that you can control via configuration or dedicated annotation markers.
|
||||
|
||||
|
||||
|
||||
@@ -2113,8 +2106,16 @@ To register custom metrics, inject `MeterRegistry` into your component, as shown
|
||||
include::{code-examples}/actuate/metrics/MetricsMeterRegistryInjectionExample.java[tag=component]
|
||||
----
|
||||
|
||||
If you find that you repeatedly instrument a suite of metrics across components or applications, you may encapsulate this suite in a `MeterBinder` implementation.
|
||||
If you metrics depend on other beans, it is recommend that you use a `MeterBinder` to register them, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::{code-examples}/actuate/metrics/SampleMeterBinderConfiguration.java[tag=example]
|
||||
----
|
||||
|
||||
Using a `MeterBinder` ensures that the correct dependency relationships are set up and that the bean is available when the metric's value is retrieved.
|
||||
By default, metrics from all `MeterBinder` beans will be automatically bound to the Spring-managed `MeterRegistry`.
|
||||
A `MeterBinder` implementation can also be useful if you find that you repeatedly instrument a suite of metrics across components or applications..
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user