Skip to content

Commit

Permalink
Merge branch '1.11.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatan-ivanov committed Sep 23, 2023
2 parents 80c20e1 + e50fe21 commit fb4a726
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@
*/
final class NoopObservationRegistry implements ObservationRegistry {

/**
* Instance of {@link NoopObservationRegistry}.
*/
static final NoopObservationRegistry INSTANCE = new NoopObservationRegistry();

static final ObservationRegistry FOR_SCOPES = ObservationRegistry.create();

private final ObservationConfig observationConfig = NoopObservationConfig.INSTANCE;

private NoopObservationRegistry() {
NoopObservationRegistry() {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static ObservationRegistry create() {
/**
* No-op implementation of {@link ObservationRegistry}.
*/
ObservationRegistry NOOP = NoopObservationRegistry.INSTANCE;
ObservationRegistry NOOP = new NoopObservationRegistry();

/**
* When previously set will allow to retrieve the {@link Observation} at any point in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,12 @@ void observeWithFunction() {
}
};
AtomicReference<Context> passedContextHolder = new AtomicReference<>();
result = Observation.createNotStarted("service", supplier, NoopObservationRegistry.INSTANCE)
result = Observation.createNotStarted("service", supplier, ObservationRegistry.NOOP)
.observeWithContext((ctx) -> {
passedContextHolder.set(ctx);
return "World";
});
assertThat(passedContextHolder).as("passed a noop context").hasValue(NoopObservation.NOOP.getContext());
assertThat(passedContextHolder).as("passed a noop context").hasValue(Observation.NOOP.getContext());
assertThat(contextCreated).isFalse();
assertThat(result).isEqualTo("World");
}
Expand Down

0 comments on commit fb4a726

Please sign in to comment.