Skip to content

Added supplier for DataLoaderDispatcherInstrumentationOptions (fix #98) #113

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

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

oliemansm
Copy link
Member

@marshi
This allows you to configure the options you want to use when constructing a DataLoaderDispatcherInstrumentation:

GraphQLQueryInvoker.newBuilder().
    .withDataLoaderDispatcherInstrumentationOptions(DataLoaderDispatcherInstrumentationOptions.newOptions().includeStatistics(true))
    .build();

These options are then used here:

protected Instrumentation getInstrumentation(Object context) {
   if (context instanceof GraphQLContext) {
       return ((GraphQLContext) context).getDataLoaderRegistry()
                .map(registry -> {
                    List<Instrumentation> instrumentations = new ArrayList<>();
                   instrumentations.add(getInstrumentation.get());
                   instrumentations.add(new DataLoaderDispatcherInstrumentation(registry, dataLoaderDispatcherInstrumentationOptionsSupplier.get()));
                    return new ChainedInstrumentation(instrumentations);
                })
               .map(Instrumentation.class::cast)
               .orElse(getInstrumentation.get());
   }
   return getInstrumentation.get();
}

@oliemansm oliemansm added this to the 6.2.0 milestone Oct 6, 2018
@marshi
Copy link

marshi commented Oct 8, 2018

this is exactly what i want to do.
thank you for great enhancement .

@oliemansm oliemansm merged commit 77526ec into master Oct 8, 2018
@oliemansm oliemansm deleted the feature/98-dataloader-options branch May 11, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants