diff --git a/build.gradle.kts b/build.gradle.kts index a85dcda..f29e440 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -66,7 +66,7 @@ dependencies { implementation("com.netflix.graphql.dgs:graphql-dgs-spring-graphql-starter") implementation("com.netflix.graphql.dgs:graphql-dgs-extended-scalars") implementation("org.springframework.boot:spring-boot-starter-websocket") - implementation("name.nkonev.multipart-spring-graphql:multipart-spring-graphql:1.1.4") + implementation("name.nkonev.multipart-spring-graphql:multipart-spring-graphql:1.+") implementation("org.springframework.boot:spring-boot-starter-web") implementation("net.datafaker:datafaker:2.+") implementation("com.github.ben-manes.caffeine:caffeine") diff --git a/src/main/java/com/example/demo/directives/UppercaseDirective.java b/src/main/java/com/example/demo/directives/UppercaseDirective.java index edec196..8a73287 100644 --- a/src/main/java/com/example/demo/directives/UppercaseDirective.java +++ b/src/main/java/com/example/demo/directives/UppercaseDirective.java @@ -13,10 +13,7 @@ public class UppercaseDirective implements SchemaDirectiveWiring { @Override public GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment env) { - GraphQLFieldsContainer fieldsContainer = env.getFieldsContainer(); - GraphQLFieldDefinition fieldDefinition = env.getFieldDefinition(); - - DataFetcher originalDataFetcher = env.getCodeRegistry().getDataFetcher(fieldsContainer, fieldDefinition); + DataFetcher originalDataFetcher = env.getFieldDataFetcher(); DataFetcher dataFetcher = DataFetcherFactories.wrapDataFetcher( originalDataFetcher, (dataFetchingEnvironment, value) -> { @@ -27,7 +24,7 @@ public GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment beginExecution(InstrumentationExecutionParameters parameters) { - TracingState tracingState = parameters.getInstrumentationState(); + public @Nullable InstrumentationContext beginExecution(InstrumentationExecutionParameters parameters, InstrumentationState state) { + TracingState tracingState = (TracingState) state; tracingState.startTime = System.currentTimeMillis(); - return super.beginExecution(parameters); + return super.beginExecution(parameters, state); } @Override - public DataFetcher instrumentDataFetcher(DataFetcher dataFetcher, InstrumentationFieldFetchParameters parameters) { + public @NotNull DataFetcher instrumentDataFetcher(DataFetcher dataFetcher, InstrumentationFieldFetchParameters parameters, InstrumentationState state) { // We only care about user code if(parameters.isTrivialDataFetcher()) { return dataFetcher; @@ -56,12 +61,12 @@ public DataFetcher instrumentDataFetcher(DataFetcher dataFetcher, Instrume } @Override - public CompletableFuture instrumentExecutionResult(ExecutionResult executionResult, InstrumentationExecutionParameters parameters) { - TracingState tracingState = parameters.getInstrumentationState(); + public @NotNull CompletableFuture instrumentExecutionResult(ExecutionResult executionResult, InstrumentationExecutionParameters parameters, InstrumentationState state) { + TracingState tracingState = (TracingState) state; long totalTime = System.currentTimeMillis() - tracingState.startTime; LOGGER.info("Total execution time: {}ms", totalTime); - return super.instrumentExecutionResult(executionResult, parameters); + return super.instrumentExecutionResult(executionResult, parameters, state); } private String findDatafetcherTag(InstrumentationFieldFetchParameters parameters) {