-
Notifications
You must be signed in to change notification settings - Fork 1.2k
added missing call to onDispatched for instrumentation context of beginExecution - resolves #1620 #2722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
bsara
wants to merge
1
commit into
graphql-java:master
from
bsara:issue-1620-add-missing-onDispatched
Closed
added missing call to onDispatched for instrumentation context of beginExecution - resolves #1620 #2722
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -513,15 +513,24 @@ public CompletableFuture<ExecutionResult> executeAsync(ExecutionInput executionI | |
| InstrumentationExecutionParameters inputInstrumentationParameters = new InstrumentationExecutionParameters(executionInput, this.graphQLSchema, instrumentationState); | ||
| executionInput = instrumentation.instrumentExecutionInput(executionInput, inputInstrumentationParameters); | ||
|
|
||
| CompletableFuture<ExecutionResult> beginExecutionCF = new CompletableFuture<>(); | ||
| InstrumentationExecutionParameters instrumentationParameters = new InstrumentationExecutionParameters(executionInput, this.graphQLSchema, instrumentationState); | ||
| InstrumentationContext<ExecutionResult> executionInstrumentation = instrumentation.beginExecution(instrumentationParameters); | ||
| executionInstrumentation.onDispatched(beginExecutionCF); | ||
|
|
||
| GraphQLSchema graphQLSchema = instrumentation.instrumentSchema(this.graphQLSchema, instrumentationParameters); | ||
|
|
||
| CompletableFuture<ExecutionResult> executionResult = parseValidateAndExecute(executionInput, graphQLSchema, instrumentationState); | ||
| // | ||
| // finish up instrumentation | ||
| executionResult = executionResult.whenComplete(executionInstrumentation::onCompleted); | ||
| executionResult = executionResult.whenComplete((result, throwable) -> { | ||
| if (throwable != null) { | ||
| beginExecutionCF.completeExceptionally(throwable); | ||
| } else { | ||
| beginExecutionCF.complete(result); | ||
| } | ||
| executionInstrumentation.onCompleted(result, throwable); | ||
| }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah that is better than what I proposed |
||
| // | ||
| // allow instrumentation to tweak the result | ||
| executionResult = executionResult.thenCompose(result -> instrumentation.instrumentExecutionResult(result, instrumentationParameters)); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix - it is indeed missing. But its slightly wrong in this fix
Tthis should be before the method
parseValidateAndExecuteThe idea of
onDispacthedis indicate that an instrumented stage is now really underway with a CF promise to it being completed.With a sync process like this it should be immediately after its called. That is its dispatched immediately. Near zero nanos later.
It should be this
That is its dispatched IMMEDIATELY and the CF given on that is completed at the end
Can you change your PR and take this code please. This is the right fix
this will change the test below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. I'll make the change. Thank you for the quick turn around.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't seem to get the tests to run locally for me (something with the gradle daemon). Could I get approval for this to run the tests? I don't want to move this from draft status until I can successfully test it, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to run the tests inside IDEA - albeit
.gradlew clean buildalso works for meI have approved the build and hence the github actions will run the builds