diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerObservationContext.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerObservationContext.java index 12ecd8c2..52bc0718 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerObservationContext.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerObservationContext.java @@ -29,7 +29,7 @@ public class CircuitBreakerObservationContext extends Observation.Context { private final Type type; /** - * Creates a new instance of {@link CircuitBreakerDocumentedObservation}. + * Creates a new instance of {@link CircuitBreakerObservationDocumentation}. * @param type type of wrapped object */ public CircuitBreakerObservationContext(Type type) { diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerDocumentedObservation.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerObservationDocumentation.java similarity index 92% rename from spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerDocumentedObservation.java rename to spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerObservationDocumentation.java index e66a6d14..c6b124d4 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerDocumentedObservation.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/CircuitBreakerObservationDocumentation.java @@ -19,9 +19,9 @@ package org.springframework.cloud.client.circuitbreaker.observation; import io.micrometer.common.docs.KeyName; import io.micrometer.observation.Observation; import io.micrometer.observation.ObservationConvention; -import io.micrometer.observation.docs.DocumentedObservation; +import io.micrometer.observation.docs.ObservationDocumentation; -enum CircuitBreakerDocumentedObservation implements DocumentedObservation { +enum CircuitBreakerObservationDocumentation implements ObservationDocumentation { /** * Observation created when we wrap a Supplier passed to the CircuitBreaker. @@ -76,7 +76,7 @@ enum CircuitBreakerDocumentedObservation implements DocumentedObservation { // } }; - enum LowCardinalityTags implements KeyName { + public enum LowCardinalityTags implements KeyName { /** * Defines the type of wrapped lambda. diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/DefaultCircuitBreakerObservationConvention.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/DefaultCircuitBreakerObservationConvention.java index d61dbbb0..60368cc3 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/DefaultCircuitBreakerObservationConvention.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/DefaultCircuitBreakerObservationConvention.java @@ -28,11 +28,14 @@ import io.micrometer.common.KeyValues; */ public class DefaultCircuitBreakerObservationConvention implements CircuitBreakerObservationConvention { - static final DefaultCircuitBreakerObservationConvention INSTANCE = new DefaultCircuitBreakerObservationConvention(); + /** + * Don't know why this needs to be public. + */ + public static final DefaultCircuitBreakerObservationConvention INSTANCE = new DefaultCircuitBreakerObservationConvention(); @Override public KeyValues getLowCardinalityKeyValues(CircuitBreakerObservationContext context) { - return KeyValues.of(CircuitBreakerDocumentedObservation.LowCardinalityTags.OBJECT_TYPE + return KeyValues.of(CircuitBreakerObservationDocumentation.LowCardinalityTags.OBJECT_TYPE .withValue(context.getType().name().toLowerCase(Locale.ROOT))); } diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedFunction.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedFunction.java index ca2ea09a..806bddf5 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedFunction.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedFunction.java @@ -37,8 +37,9 @@ class ObservedFunction implements Function { ObservedFunction(CircuitBreakerObservationConvention customConvention, CircuitBreakerObservationContext context, String conextualName, ObservationRegistry observationRegistry, Function toRun) { this.delegate = toRun; - this.observation = CircuitBreakerDocumentedObservation.CIRCUIT_BREAKER_SUPPLIER_OBSERVATION.observation( - customConvention, DefaultCircuitBreakerObservationConvention.INSTANCE, context, observationRegistry); + this.observation = CircuitBreakerObservationDocumentation.CIRCUIT_BREAKER_SUPPLIER_OBSERVATION.observation( + customConvention, DefaultCircuitBreakerObservationConvention.INSTANCE, () -> context, + observationRegistry); this.observation.contextualName(conextualName); } diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedSupplier.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedSupplier.java index 016d6e0d..69b56c9b 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedSupplier.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/observation/ObservedSupplier.java @@ -37,8 +37,9 @@ class ObservedSupplier implements Supplier { ObservedSupplier(CircuitBreakerObservationConvention customConvention, CircuitBreakerObservationContext context, String contextualName, ObservationRegistry observationRegistry, Supplier toRun) { this.delegate = toRun; - this.observation = CircuitBreakerDocumentedObservation.CIRCUIT_BREAKER_SUPPLIER_OBSERVATION.observation( - customConvention, DefaultCircuitBreakerObservationConvention.INSTANCE, context, observationRegistry); + this.observation = CircuitBreakerObservationDocumentation.CIRCUIT_BREAKER_SUPPLIER_OBSERVATION.observation( + customConvention, DefaultCircuitBreakerObservationConvention.INSTANCE, () -> context, + observationRegistry); this.observation.contextualName(contextualName); }