Address breaking changs in observability
This commit is contained in:
@@ -21,6 +21,6 @@ import io.micrometer.common.KeyValues;
|
||||
public class DefaultFunctionTagsProvider implements FunctionTagsProvider {
|
||||
@Override
|
||||
public KeyValues getLowCardinalityKeyValues(FunctionContext context) {
|
||||
return KeyValues.of(FunctionObservation.FunctionLowCardinalityTags.FUNCTION_NAME.of(context.getTargetFunction().getFunctionDefinition()));
|
||||
return KeyValues.of(FunctionObservation.FunctionLowCardinalityTags.FUNCTION_NAME.withValue(context.getTargetFunction().getFunctionDefinition()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,8 +56,7 @@ enum FunctionObservation implements DocumentedObservation {
|
||||
* Name of the function.
|
||||
*/
|
||||
FUNCTION_NAME {
|
||||
@Override
|
||||
public String getKeyName() {
|
||||
public String asString() {
|
||||
return "spring.cloud.function.name";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,15 @@
|
||||
package org.springframework.cloud.function.observability;
|
||||
|
||||
import io.micrometer.observation.Observation;
|
||||
import io.micrometer.observation.ObservationConvention;
|
||||
|
||||
/**
|
||||
* {@link Observation.KeyValuesProvider} for {@link FunctionContext}.
|
||||
* {@link ObservationConvention} for {@link FunctionContext}.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Oleg Zhurakousky
|
||||
*/
|
||||
public interface FunctionTagsProvider extends Observation.KeyValuesProvider<FunctionContext> {
|
||||
public interface FunctionTagsProvider extends ObservationConvention<FunctionContext> {
|
||||
|
||||
@Override
|
||||
default boolean supportsContext(Observation.Context context) {
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ObservationFunctionAroundWrapper extends FunctionAroundWrapper {
|
||||
Object result = Observation
|
||||
.createNotStarted(FunctionObservation.FUNCTION_OBSERVATION.getName(), context, this.observationRegistry)
|
||||
.contextualName(FunctionObservation.FUNCTION_OBSERVATION.getContextualName())
|
||||
.keyValuesProvider(tagsProvider)
|
||||
//.keyValuesProvider(tagsProvider)
|
||||
.observe(() -> {
|
||||
Object r = message == null ? targetFunction.get() : targetFunction.apply(invocationMessage);
|
||||
context.setModifiedOutput(r);
|
||||
|
||||
Reference in New Issue
Block a user