Adjust code and POM to accomodate for micrometer/observability changes
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -28,7 +28,15 @@
|
|||||||
<maven-checkstyle-plugin.includeTestSourceDirectory>true
|
<maven-checkstyle-plugin.includeTestSourceDirectory>true
|
||||||
</maven-checkstyle-plugin.includeTestSourceDirectory>
|
</maven-checkstyle-plugin.includeTestSourceDirectory>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.micrometer</groupId>
|
||||||
|
<artifactId>context-propagation</artifactId>
|
||||||
|
<version>1.0.0-RC1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -17,14 +17,14 @@
|
|||||||
package org.springframework.cloud.function.observability;
|
package org.springframework.cloud.function.observability;
|
||||||
|
|
||||||
import io.micrometer.common.docs.KeyName;
|
import io.micrometer.common.docs.KeyName;
|
||||||
import io.micrometer.observation.docs.DocumentedObservation;
|
import io.micrometer.observation.docs.ObservationDocumentation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Marcin Grzejszczak
|
* @author Marcin Grzejszczak
|
||||||
* @author Oleg Zhurakousky
|
* @author Oleg Zhurakousky
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
*/
|
*/
|
||||||
enum FunctionObservation implements DocumentedObservation {
|
enum FunctionObservation implements ObservationDocumentation {
|
||||||
/**
|
/**
|
||||||
* Observation created around a function execution.
|
* Observation created around a function execution.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class ObservationFunctionAroundWrapper extends FunctionAroundWrapper {
|
|||||||
FunctionContext context = new FunctionContext(targetFunction).withInput(message);
|
FunctionContext context = new FunctionContext(targetFunction).withInput(message);
|
||||||
Object invocationMessage = context.getModifiedInput();
|
Object invocationMessage = context.getModifiedInput();
|
||||||
Object result = Observation
|
Object result = Observation
|
||||||
.createNotStarted(FunctionObservation.FUNCTION_OBSERVATION.getName(), context, this.observationRegistry)
|
.createNotStarted(FunctionObservation.FUNCTION_OBSERVATION.getName(), () -> context, this.observationRegistry)
|
||||||
.contextualName(FunctionObservation.FUNCTION_OBSERVATION.getContextualName())
|
.contextualName(FunctionObservation.FUNCTION_OBSERVATION.getContextualName())
|
||||||
.observe(() -> {
|
.observe(() -> {
|
||||||
Object r = message == null ? targetFunction.get() : targetFunction.apply(invocationMessage);
|
Object r = message == null ? targetFunction.get() : targetFunction.apply(invocationMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user