Skip to content

Commit 5949d25

Browse files
committed
Polishing.
Reformat code. Fix typo. See #2591 Original pull request: #2592
1 parent 1069ede commit 5949d25

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Diff for: src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -130,27 +130,28 @@ public Tracer.Span nextSpan(TraceContext traceContext) {
130130
return postProcessSpan(createObservation(traceContext));
131131
}
132132

133-
private Observation createObservation(@Nullable TraceContext traceContext) {
134-
return RedisObservation.REDIS_COMMAND_OBSERVATION.observation(observationRegistry,
135-
() -> {
136-
LettuceObservationContext context = new LettuceObservationContext(serviceName);
137-
if (traceContext instanceof MicrometerTraceContext micrometerTraceContext) {
138-
context.setParentObservation(micrometerTraceContext.observation);
139-
}
140-
return context;
141-
});
133+
private Observation createObservation(@Nullable TraceContext parentContext) {
134+
135+
return RedisObservation.REDIS_COMMAND_OBSERVATION.observation(observationRegistry, () -> {
136+
137+
LettuceObservationContext context = new LettuceObservationContext(serviceName);
138+
139+
if (parentContext instanceof MicrometerTraceContext traceContext) {
140+
context.setParentObservation(traceContext.observation());
141+
}
142+
return context;
143+
});
142144
}
143145

144146
private Tracer.Span postProcessSpan(Observation observation) {
145147

146-
return !observation.isNoop()
147-
? new MicrometerSpan(observation.observationConvention(observationConvention))
148+
return !observation.isNoop() ? new MicrometerSpan(observation.observationConvention(observationConvention))
148149
: NoOpSpan.INSTANCE;
149150
}
150151
}
151152

152153
/**
153-
* No-op {@link Span} implemementation.
154+
* No-op {@link Span} implementation.
154155
*/
155156
static class NoOpSpan extends Tracer.Span {
156157

0 commit comments

Comments
 (0)