Temporarily revert to Micrometer context-propagation M4
See gh-459
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -114,7 +114,7 @@ public abstract class InvocableHandlerMethodSupport extends HandlerMethod {
|
||||
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(
|
||||
|
||||
@@ -70,7 +70,7 @@ final class ContextDataFetcherDecorator implements DataFetcher<Object> {
|
||||
@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) {
|
||||
|
||||
@@ -98,7 +98,7 @@ public abstract class DataFetcherExceptionResolverAdapter implements DataFetcher
|
||||
return resolveToMultipleErrors(exception, env);
|
||||
}
|
||||
try {
|
||||
return ContextSnapshot.captureFrom(env.getGraphQlContext())
|
||||
return ContextSnapshot.capture(env.getGraphQlContext())
|
||||
.wrap(() -> resolveToMultipleErrors(exception, env))
|
||||
.call();
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class DefaultBatchLoaderRegistry implements BatchLoaderRegistry {
|
||||
@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)
|
||||
@@ -245,7 +245,7 @@ public class DefaultBatchLoaderRegistry implements BatchLoaderRegistry {
|
||||
@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)
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DefaultExecutionGraphQlService implements ExecutionGraphQlService {
|
||||
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));
|
||||
|
||||
@@ -70,7 +70,7 @@ class ExceptionResolversExceptionHandler implements 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))
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class SubscriptionExceptionResolverAdapter implements Subscripti
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user