Skip to content

InstrumentationContext onDispatched not called for parsing #1620

Closed

Description

@Keisuki

Describe the bug
For a couple of the methods on Instrumentation (beginParse and beginValidation) the onDispatched method on the returned InstrumentationContext is not called.

To Reproduce
My Instrumentation, which is later passed into a GraphQL instance:

public class TestInstrumentation extends SimpleInstrumentation {
  @Override
  public InstrumentationContext<Document> beginParse(InstrumentationExecutionParameters parameters) {
    return new InstrumentationContext<>() {
      @Override
      public void onDispatched(CompletableFuture<Document> result) {
        System.out.println("Dispatched");
      }

      @Override
      public void onCompleted(Document result, Throwable t) {
        System.out.println("Completed");
      }
    };
  }
}

Expected:

Dispatched
Completed

Actual:

Completed

Activity

  1. Keisuki commented on Aug 14, 2019

    @Keisuki
    Author

    This appears to apply to beginExecution also.

  2. bbakerman commented on Aug 17, 2019

    @bbakerman
    Member

    Yeah this is an oversight because the actions here are not asynchronous. That is they have no clear dispatch and later completion.

    I agree for consistency they should happen even if its happening synchronously.

    As a workaround I guess you should do you call back work in the onCompleted callback until we get this fixed.

  3. Keisuki commented on Aug 19, 2019

    @Keisuki
    Author

    For now, I am calling onDispatch before returning the InstrumentationContext from the Instrumentation, as I don't need the future. That way will be easiest to modify back into how it should be, should this be fixed.

  4. github-actions commented on Jan 4, 2024

    @github-actions
    Contributor

    Hello, this issue has been inactive for 60 days, so we're marking it as stale. If you would like to continue this discussion, please comment within the next 30 days or we'll close the issue.

  5. dondonz commented on Jan 6, 2024

    @dondonz
    Member

    Fixed by #2730

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions