Skip to content

Commit 4868ab4

Browse files
committed
Temporarily revert to Micrometer context-propagation M4
See gh-459
1 parent fe7eb1d commit 4868ab4

8 files changed

+9
-9
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ configure(moduleProjects) {
7676
dependency "jakarta.persistence:jakarta.persistence-api:3.0.0"
7777
dependency "jakarta.servlet:jakarta.servlet-api:5.0.0"
7878
dependency "com.google.code.findbugs:jsr305:3.0.2"
79-
dependency "io.micrometer:context-propagation:1.0.0-SNAPSHOT"
79+
dependency "io.micrometer:context-propagation:1.0.0-M4"
8080
dependency "org.assertj:assertj-core:3.23.1"
8181
dependency "com.jayway.jsonpath:json-path:2.7.0"
8282
dependency "org.skyscreamer:jsonassert:1.5.0"

spring-graphql/src/main/java/org/springframework/graphql/data/method/InvocableHandlerMethodSupport.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private Object handleReturnValue(GraphQLContext graphQLContext, @Nullable Object
114114
return CompletableFuture.supplyAsync(
115115
() -> {
116116
try {
117-
return ContextSnapshot.captureFrom(graphQLContext).wrap((Callable<?>) result).call();
117+
return ContextSnapshot.capture(graphQLContext).wrap((Callable<?>) result).call();
118118
}
119119
catch (Exception ex) {
120120
throw new IllegalStateException(

spring-graphql/src/main/java/org/springframework/graphql/execution/ContextDataFetcherDecorator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private ContextDataFetcherDecorator(
7070
@Override
7171
public Object get(DataFetchingEnvironment environment) throws Exception {
7272

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

7676
if (this.subscription) {

spring-graphql/src/main/java/org/springframework/graphql/execution/DataFetcherExceptionResolverAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private List<GraphQLError> resolveInternal(Throwable exception, DataFetchingEnvi
9898
return resolveToMultipleErrors(exception, env);
9999
}
100100
try {
101-
return ContextSnapshot.captureFrom(env.getGraphQlContext())
101+
return ContextSnapshot.capture(env.getGraphQlContext())
102102
.wrap(() -> resolveToMultipleErrors(exception, env))
103103
.call();
104104
}

spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultBatchLoaderRegistry.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public DataLoaderOptions getOptionsOrDefault(
190190
@Override
191191
public CompletionStage<List<V>> load(List<K> keys, BatchLoaderEnvironment environment) {
192192
GraphQLContext graphQLContext = environment.getContext();
193-
ContextSnapshot snapshot = ContextSnapshot.captureFrom(graphQLContext);
193+
ContextSnapshot snapshot = ContextSnapshot.capture(graphQLContext);
194194
try {
195195
return snapshot.wrap(() ->
196196
this.loader.apply(keys, environment)
@@ -245,7 +245,7 @@ public DataLoaderOptions getOptionsOrDefault(
245245
@Override
246246
public CompletionStage<Map<K, V>> load(Set<K> keys, BatchLoaderEnvironment environment) {
247247
GraphQLContext graphQLContext = environment.getContext();
248-
ContextSnapshot snapshot = ContextSnapshot.captureFrom(graphQLContext);
248+
ContextSnapshot snapshot = ContextSnapshot.capture(graphQLContext);
249249
try {
250250
return snapshot.wrap(() ->
251251
this.loader.apply(keys, environment)

spring-graphql/src/main/java/org/springframework/graphql/execution/DefaultExecutionGraphQlService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public final Mono<ExecutionGraphQlResponse> execute(ExecutionGraphQlRequest requ
7777
request.configureExecutionInput(RESET_EXECUTION_ID_CONFIGURER);
7878
}
7979
ExecutionInput executionInput = request.toExecutionInput();
80-
ContextSnapshot.captureFrom(contextView).updateContext(executionInput.getGraphQLContext());
80+
ContextSnapshot.capture(contextView).updateContext(executionInput.getGraphQLContext());
8181
ExecutionInput updatedExecutionInput = registerDataLoaders(executionInput);
8282
return Mono.fromFuture(this.graphQlSource.graphQl().executeAsync(updatedExecutionInput))
8383
.map(result -> new DefaultExecutionGraphQlResponse(updatedExecutionInput, result));

spring-graphql/src/main/java/org/springframework/graphql/execution/ExceptionResolversExceptionHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public DataFetcherExceptionHandlerResult onException(DataFetcherExceptionHandler
7070
public CompletableFuture<DataFetcherExceptionHandlerResult> handleException(DataFetcherExceptionHandlerParameters params) {
7171
Throwable exception = unwrapException(params);
7272
DataFetchingEnvironment env = params.getDataFetchingEnvironment();
73-
ContextSnapshot snapshot = ContextSnapshot.captureFrom(env.getGraphQlContext());
73+
ContextSnapshot snapshot = ContextSnapshot.capture(env.getGraphQlContext());
7474
try {
7575
return Flux.fromIterable(this.resolvers)
7676
.flatMap(resolver -> resolver.resolveException(exception, env))

spring-graphql/src/main/java/org/springframework/graphql/execution/SubscriptionExceptionResolverAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public boolean isThreadLocalContextAware() {
8383
public final Mono<List<GraphQLError>> resolveException(Throwable exception) {
8484
if (this.threadLocalContextAware) {
8585
return Mono.deferContextual(contextView -> {
86-
ContextSnapshot snapshot = ContextSnapshot.captureFrom(contextView);
86+
ContextSnapshot snapshot = ContextSnapshot.capture(contextView);
8787
try {
8888
List<GraphQLError> errors = snapshot.wrap(() -> resolveToMultipleErrors(exception)).call();
8989
return Mono.justOrEmpty(errors);

0 commit comments

Comments
 (0)