Temporarily revert to Micrometer context-propagation M4

See gh-459
This commit is contained in:
rstoyanchev
2022-09-01 08:43:46 +01:00
parent fe7eb1d649
commit 4868ab4d49
8 changed files with 9 additions and 9 deletions

View File

@@ -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"

View File

@@ -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(

View File

@@ -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) {

View File

@@ -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();
}

View File

@@ -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)

View File

@@ -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));

View File

@@ -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))

View File

@@ -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);