Rename property.

This commit is contained in:
Olga Maciaszek-Sharma
2024-11-18 17:51:26 +01:00
parent 3a259ec8c8
commit d5d2b78be1
5 changed files with 19 additions and 18 deletions

View File

@@ -508,9 +508,9 @@ Additional information regarding the service instances, request data, and respon
NOTE: For `WebClient` and `RestClient`-backed load-balancing, we use `uriTemplate` for the `uri` tag whenever available.
TIP: It is possible to disable adding `uri` tag by setting `spring.cloud.loadbalancer.metrics.include-uri-tag` to `false`.
TIP: It is possible to disable adding `path` to `uri` tag by setting `spring.cloud.loadbalancer.stats.include-path` to `false`.
WARNING: As with `RestTemplate`-backed load-balancing, we don't have access to `uriTemplate`, full path is always used in the `uri` tag. In order to avoid high cardinality issues, if path is a high cardinality value (for example, `/orders/\{id\}`, where `id` takes a big number of values), it is strongly recommended to disable adding `uri` tag by setting `spring.cloud.loadbalancer.metrics.include-uri-tag` to `false`.
WARNING: As with `RestTemplate`-backed load-balancing, we don't have access to `uriTemplate`, full path is always used in the `uri` tag. In order to avoid high cardinality issues, if path is a high cardinality value (for example, `/orders/\{id\}`, where `id` takes a big number of values), it is strongly recommended to disable adding path to `uri` tag by setting `spring.cloud.loadbalancer.stats.include-path` to `false`.
NOTE: For some implementations, such as `BlockingLoadBalancerClient`, request and response data might not be available, as we establish generic types from arguments and might not be able to determine the types and read the data.

View File

@@ -66,6 +66,7 @@
|spring.cloud.loadbalancer.retry.retryable-exceptions | `+++{}+++` | A `Set` of `Throwable` classes that should trigger a retry.
|spring.cloud.loadbalancer.retry.retryable-status-codes | `+++{}+++` | A `Set` of status codes that should trigger a retry.
|spring.cloud.loadbalancer.service-discovery.timeout | | String representation of Duration of the timeout for calls to service discovery.
|spring.cloud.loadbalancer.stats.include-path | `+++true+++` | Indicates whether the {@code path} should be added to {@code uri} tag in metrics. When {@link RestTemplate} is used to execute load-balanced requests with high cardinality paths, setting it to {@code false} is recommended.
|spring.cloud.loadbalancer.stats.micrometer.enabled | `+++false+++` | Enables Spring Cloud LoadBalancer Micrometer stats.
|spring.cloud.loadbalancer.sticky-session.add-service-instance-cookie | `+++false+++` | Indicates whether a cookie with the newly selected instance should be added by LoadBalancer.
|spring.cloud.loadbalancer.sticky-session.instance-id-cookie-name | `+++sc-lb-instance-id+++` | The name of the cookie holding the preferred instance id.

View File

@@ -103,7 +103,7 @@ public class LoadBalancerProperties {
/**
* Properties for LoadBalancer metrics.
*/
private Metrics metrics = new Metrics();
private Stats stats = new Stats();
public HealthCheck getHealthCheck() {
return healthCheck;
@@ -170,12 +170,12 @@ public class LoadBalancerProperties {
this.callGetWithRequestOnDelegates = callGetWithRequestOnDelegates;
}
public Metrics getMetrics() {
return metrics;
public Stats getStats() {
return stats;
}
public void setMetrics(Metrics metrics) {
this.metrics = metrics;
public void setStats(Stats stats) {
this.stats = stats;
}
public static class StickySession {
@@ -553,21 +553,21 @@ public class LoadBalancerProperties {
}
public static class Metrics {
public static class Stats {
/**
* Indicates whether the `uri` tag should be added to metrics. When
* {@link RestTemplate} is used to execute load-balanced requests with high
* cardinality paths, setting it to {@code false} is recommended.
* Indicates whether the {@code path} should be added to {@code uri} tag in
* metrics. When {@link RestTemplate} is used to execute load-balanced requests
* with high cardinality paths, setting it to {@code false} is recommended.
*/
private boolean includeUriTag = true;
private boolean includePath = true;
public boolean isIncludeUriTag() {
return includeUriTag;
public boolean isIncludePath() {
return includePath;
}
public void setIncludeUriTag(boolean includeUriTag) {
this.includeUriTag = includeUriTag;
public void setIncludePath(boolean includePath) {
this.includePath = includePath;
}
}

View File

@@ -84,7 +84,7 @@ class LoadBalancerTags {
}
private String getPath(RequestData requestData) {
if (!properties.getMetrics().isIncludeUriTag()) {
if (!properties.getStats().isIncludePath()) {
return UNKNOWN;
}
Optional<Object> uriTemplateValue = Optional.ofNullable(requestData.getAttributes())

View File

@@ -96,7 +96,7 @@ class MicrometerStatsLoadBalancerLifecycleTests {
void shouldNotAddPathValueWhenDisabled() {
ReactiveLoadBalancer.Factory<ServiceInstance> factory = mock(ReactiveLoadBalancer.Factory.class);
LoadBalancerProperties properties = new LoadBalancerProperties();
properties.getMetrics().setIncludeUriTag(false);
properties.getStats().setIncludePath(false);
when(factory.getProperties("test")).thenReturn(properties);
MicrometerStatsLoadBalancerLifecycle statsLifecycle = new MicrometerStatsLoadBalancerLifecycle(meterRegistry,
factory);