Undeprecate 'management.metrics.tags'

Closes gh-38583
This commit is contained in:
Moritz Halbritter 2023-12-13 08:26:11 +01:00
parent 35eba69996
commit c50172d5c7
3 changed files with 12 additions and 5 deletions

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
/**
@ -79,8 +78,6 @@ public class MetricsProperties {
return this.enable;
}
@Deprecated(since = "3.2.0", forRemoval = true)
@DeprecatedConfigurationProperty(replacement = "management.observations.key-values", since = "3.2.0")
public Map<String, String> getTags() {
return this.tags;
}

View File

@ -50,7 +50,6 @@ public class PropertiesMeterFilter implements MeterFilter {
private final MeterFilter mapFilter;
@SuppressWarnings("removal")
public PropertiesMeterFilter(MetricsProperties properties) {
Assert.notNull(properties, "Properties must not be null");
this.properties = properties;

View File

@ -1111,8 +1111,19 @@ 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:
You can configure common tags using the <<actuator#actuator.observability.common-key-values, configprop:management.observations.key-values[] property>>.
[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.
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.