Add property for common key/values on observations

- Deprecates 'management.metrics.tags.*'

Closes gh-33241
This commit is contained in:
Moritz Halbritter
2023-06-13 09:28:58 +02:00
parent 214f06083b
commit 5b06224af5
8 changed files with 171 additions and 14 deletions

View File

@@ -1100,19 +1100,8 @@ These use the global registry that is not Spring-managed.
[[actuator.metrics.customizing.common-tags]]
==== Common Tags
Common tags are generally used for dimensional drill-down on the operating environment, such as host, instance, region, stack, and others.
Commons tags are applied to all meters and can be configured, as the following example shows:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
metrics:
tags:
region: "us-east-1"
stack: "prod"
----
The preceding example adds `region` and `stack` tags to all meters with a value of `us-east-1` and `prod`, respectively.
You can configure common tags using the <<actuator#actuator.observability.common-key-values, configprop:management.observations.key-values[] property>>.
NOTE: The order of common tags is important if you use Graphite.
As the order of common tags cannot be guaranteed by using this approach, Graphite users are advised to define a custom `MeterFilter` instead.

View File

@@ -9,9 +9,9 @@ To create your own observations (which will lead to metrics and traces), you can
include::code:MyCustomObservation[]
NOTE: Low cardinality tags will be added to metrics and traces, while high cardinality tags will only be added to traces.
NOTE: Low cardinality key-values will be added to metrics and traces, while high cardinality key-values will only be added to traces.
Beans of type `ObservationPredicate`, `GlobalObservationConvention` and `ObservationHandler` will be automatically registered on the `ObservationRegistry`.
Beans of type `ObservationPredicate`, `GlobalObservationConvention`, `ObservationFilter` and `ObservationHandler` will be automatically registered on the `ObservationRegistry`.
You can additionally register any number of `ObservationRegistryCustomizer` beans to further configure the registry.
For more details please see the https://micrometer.io/docs/observation[Micrometer Observation documentation].
@@ -21,4 +21,20 @@ For JDBC, the https://github.com/jdbc-observations/datasource-micrometer[Datasou
Read more about it https://jdbc-observations.github.io/datasource-micrometer/docs/current/docs/html/[in the reference documentation].
For R2DBC, the https://github.com/spring-projects-experimental/r2dbc-micrometer-spring-boot[Spring Boot Auto Configuration for R2DBC Observation] creates observations for R2DBC query invocations.
[[actuator.observability.common-key-values]]
=== Common Key-Values
Common key-values are generally used for dimensional drill-down on the operating environment, such as host, instance, region, stack, and others.
Commons key-values are applied to all observations as low cardinality key-values and can be configured, as the following example shows:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
observations:
key-values:
region: "us-east-1"
stack: "prod"
----
The preceding example adds `region` and `stack` key-values to all observations with a value of `us-east-1` and `prod`, respectively.
The next sections will provide more details about logging, metrics and traces.