Skip to content

Commit

Permalink
Temporarily revert to Micrometer context-propagation M4
Browse files Browse the repository at this point in the history
See gh-459
  • Loading branch information
rstoyanchev committed Sep 1, 2022
1 parent fe7eb1d commit 4868ab4
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ configure(moduleProjects) {
dependency "jakarta.persistence:jakarta.persistence-api:3.0.0"
dependency "jakarta.servlet:jakarta.servlet-api:5.0.0"
dependency "com.google.code.findbugs:jsr305:3.0.2"
dependency "io.micrometer:context-propagation:1.0.0-SNAPSHOT"
dependency "io.micrometer:context-propagation:1.0.0-M4"
dependency "org.assertj:assertj-core:3.23.1"
dependency "com.jayway.jsonpath:json-path:2.7.0"
dependency "org.skyscreamer:jsonassert:1.5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private Object handleReturnValue(GraphQLContext graphQLContext, @Nullable Object
return CompletableFuture.supplyAsync(
() -> {
try {
return ContextSnapshot.captureFrom(graphQLContext).wrap((Callable<?>) result).call();
return ContextSnapshot.capture(graphQLContext).wrap((Callable<?>) result).call();
}
catch (Exception ex) {
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private ContextDataFetcherDecorator(
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {

ContextSnapshot snapshot = ContextSnapshot.captureFrom(environment.getGraphQlContext());
ContextSnapshot snapshot = ContextSnapshot.capture(environment.getGraphQlContext());
Object value = snapshot.wrap(() -> this.delegate.get(environment)).call();

if (this.subscription) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private List<GraphQLError> resolveInternal(Throwable exception, DataFetchingEnvi
return resolveToMultipleErrors(exception, env);
}
try {
return ContextSnapshot.captureFrom(env.getGraphQlContext())
return ContextSnapshot.capture(env.getGraphQlContext())
.wrap(() -> resolveToMultipleErrors(exception, env))
.call();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public DataLoaderOptions getOptionsOrDefault(
@Override
public CompletionStage<List<V>> load(List<K> keys, BatchLoaderEnvironment environment) {
GraphQLContext graphQLContext = environment.getContext();
ContextSnapshot snapshot = ContextSnapshot.captureFrom(graphQLContext);
ContextSnapshot snapshot = ContextSnapshot.capture(graphQLContext);
try {
return snapshot.wrap(() ->
this.loader.apply(keys, environment)
Expand Down Expand Up @@ -245,7 +245,7 @@ public DataLoaderOptions getOptionsOrDefault(
@Override
public CompletionStage<Map<K, V>> load(Set<K> keys, BatchLoaderEnvironment environment) {
GraphQLContext graphQLContext = environment.getContext();
ContextSnapshot snapshot = ContextSnapshot.captureFrom(graphQLContext);
ContextSnapshot snapshot = ContextSnapshot.capture(graphQLContext);
try {
return snapshot.wrap(() ->
this.loader.apply(keys, environment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public final Mono<ExecutionGraphQlResponse> execute(ExecutionGraphQlRequest requ
request.configureExecutionInput(RESET_EXECUTION_ID_CONFIGURER);
}
ExecutionInput executionInput = request.toExecutionInput();
ContextSnapshot.captureFrom(contextView).updateContext(executionInput.getGraphQLContext());
ContextSnapshot.capture(contextView).updateContext(executionInput.getGraphQLContext());
ExecutionInput updatedExecutionInput = registerDataLoaders(executionInput);
return Mono.fromFuture(this.graphQlSource.graphQl().executeAsync(updatedExecutionInput))
.map(result -> new DefaultExecutionGraphQlResponse(updatedExecutionInput, result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public DataFetcherExceptionHandlerResult onException(DataFetcherExceptionHandler
public CompletableFuture<DataFetcherExceptionHandlerResult> handleException(DataFetcherExceptionHandlerParameters params) {
Throwable exception = unwrapException(params);
DataFetchingEnvironment env = params.getDataFetchingEnvironment();
ContextSnapshot snapshot = ContextSnapshot.captureFrom(env.getGraphQlContext());
ContextSnapshot snapshot = ContextSnapshot.capture(env.getGraphQlContext());
try {
return Flux.fromIterable(this.resolvers)
.flatMap(resolver -> resolver.resolveException(exception, env))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public boolean isThreadLocalContextAware() {
public final Mono<List<GraphQLError>> resolveException(Throwable exception) {
if (this.threadLocalContextAware) {
return Mono.deferContextual(contextView -> {
ContextSnapshot snapshot = ContextSnapshot.captureFrom(contextView);
ContextSnapshot snapshot = ContextSnapshot.capture(contextView);
try {
List<GraphQLError> errors = snapshot.wrap(() -> resolveToMultipleErrors(exception)).call();
return Mono.justOrEmpty(errors);
Expand Down

0 comments on commit 4868ab4

Please sign in to comment.