Skip to content
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

Avoid passing in empty ChainedInstrumentation #992

Merged
merged 1 commit into from
Apr 19, 2022
Merged

Conversation

kilink
Copy link
Member

@kilink kilink commented Apr 18, 2022

When no Instrumentation beans are supplied, avoid passing in a ChainedInstrumentation
instance containing an empty list of Instrumentations. Doing so would result in some
unnecessary overhead, as the builder's internal checkInstrumentationDefaultState method
will attempt to add its own default instrumentation.

Not that I did actually see this show up in flame graphs, for a case where I had no instrumentation registered, it was spending time in ChainedInstrumentation's internals, looking up state in a HashMap, etc. This is because by passing in an empty ChainedInstrumentation, we end up with the default DataLoaderDispatcherInstrumentation instance wrapped unnecessarily in a ChainedInstrumentation.

When no Instrumentation beans are supplied, avoid passing in a ChainedInstrumentation
instance containing an empty list of Instrumentations. Doing so would result in some
unnecessary overhead, as the builder's internal checkInstrumentationDefaultState method
will attempt to add its own default instrumentation.
.queryExecutionStrategy(queryExecutionStrategy)
.mutationExecutionStrategy(mutationExecutionStrategy)
.subscriptionExecutionStrategy(SubscriptionExecutionStrategy())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SubscriptionExecutionStrategy(this.defaultExceptionHandler) is what gets aded by default if no execution strategy is supplied for subscriptions; it seems better to rely on the builder's default, imo, unless we were doing this to avoid having the defaultExceptionHandler set?

@berngp berngp merged commit 02924c1 into master Apr 19, 2022
@berngp berngp deleted the instrumentation-fix branch April 19, 2022 01:52
@berngp
Copy link
Contributor

berngp commented Apr 19, 2022

Thanks @kilink

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.

None yet

2 participants