Skip to content

Commit e244221

Browse files
committed
GH-1318 - Adapt nullability after upgrade to Micrometer Tracing 1.6 M1.
1 parent 284e63d commit e244221

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spring-modulith-observability/src/main/java/org/springframework/modulith/observability/support/ModulePassingObservationFilter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import io.micrometer.observation.Observation.ContextView;
2020
import io.micrometer.observation.ObservationFilter;
2121

22+
import java.util.Objects;
23+
2224
/**
2325
* Ensures that {@link ModulithObservations.LowKeys#MODULE_KEY} gets propagated from parent to child.
2426
*
@@ -38,9 +40,11 @@ public Observation.Context map(Observation.Context context) {
3840
if (isModuleKeyValueAbsentInCurrent(context) && isModuleKeyValuePresentInParent(context)) {
3941

4042
var moduleKey = ModulithObservations.LowKeys.MODULE_KEY;
43+
var parent = Objects.requireNonNull(context.getParentObservation());
44+
var moduleValue = Objects.requireNonNull(parent.getContextView()
45+
.getLowCardinalityKeyValue(moduleKey.asString()));
4146

42-
return context.addLowCardinalityKeyValue(moduleKey.withValue(context.getParentObservation().getContextView()
43-
.getLowCardinalityKeyValue(moduleKey.asString()).getValue()));
47+
return context.addLowCardinalityKeyValue(moduleKey.withValue(moduleValue.getValue()));
4448
}
4549

4650
return context;

0 commit comments

Comments
 (0)