Skip to content

[spring-server] enable support for specifying instrumentation order #395

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
Sep 30, 2019

Conversation

dariuszkuc
Copy link
Collaborator

📝 Description

graphql-java allows for applying various Instrumentations to the GraphQL execution. If multilple instrumentations are to be applied they need to be wrapped in an instance of ChainedInstrumentation that has an explicit order of the instrumentations.

In order to simplify Spring configuration we should allow users to either create a single instrumentation bean (could be a chained one) or multiple instrumentation beans and then automatically wrap them in chained instrumentation if necessary. Unfortunately, by default graphql-java Instrumentation does not specify order in which it should be applied (as it is generally explicitly configured). In order to support proper ordering of the instrumentations we can simply check if they implement Ordered interface and use their order value OR default to order of 0 otherwise (unordered behavior).

@dariuszkuc dariuszkuc added changes: patch Changes require a patch version type: enhancement New feature or request labels Sep 28, 2019
`graphql-java` allows for applying various `Instrumentations` to the GraphQL execution. If multilple instrumentations are to be applied they need to be wrapped in an instance of `ChainedInstrumentation` that has an explicit order of the instrumentations.

In order to simplify Spring configuration we should allow users to either create a single instrumentation bean (could be a chained one) or multiple instrumentation beans and then automatically wrap them in chained instrumentation if necessary. Unfortunately, by default `graphql-java` `Instrumentation` does not specify order in which it should be applied (as it is generally explicitly configured). In order to support proper ordering of the instrumentations we can simply check if they implement `Ordered` interface and use their order value OR default to order of `0` otherwise (unordered behavior).
@dariuszkuc dariuszkuc force-pushed the sorted_instrumentations branch from 8a95fd0 to eddcece Compare September 28, 2019 17:50
@codecov-io
Copy link

Codecov Report

Merging #395 into master will decrease coverage by 0.23%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #395      +/-   ##
============================================
- Coverage     97.62%   97.38%   -0.24%     
+ Complexity      324      323       -1     
============================================
  Files           104      104              
  Lines          1223     1226       +3     
  Branches        198      199       +1     
============================================
  Hits           1194     1194              
- Misses            9       11       +2     
- Partials         20       21       +1
Impacted Files Coverage Δ Complexity Δ
...iagroup/graphql/spring/GraphQLAutoConfiguration.kt 89.47% <100%> (+1.97%) 6 <0> (ø) ⬇️
...hql/exceptions/CouldNotGetNameOfKClassException.kt 0% <0%> (-100%) 0% <0%> (-1%)
...p/graphql/generator/extensions/kClassExtensions.kt 91.66% <0%> (-8.34%) 0% <0%> (ø)
.../graphql/spring/execution/GraphQLContextFactory.kt 100% <0%> (+50%) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e38e11...eddcece. Read the comment docs.

@tapaderster tapaderster merged commit f96fc4e into ExpediaGroup:master Sep 30, 2019
@dariuszkuc dariuszkuc deleted the sorted_instrumentations branch October 17, 2019 18:52
dariuszkuc added a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
…xpediaGroup#395)

`graphql-java` allows for applying various `Instrumentations` to the GraphQL execution. If multilple instrumentations are to be applied they need to be wrapped in an instance of `ChainedInstrumentation` that has an explicit order of the instrumentations.

In order to simplify Spring configuration we should allow users to either create a single instrumentation bean (could be a chained one) or multiple instrumentation beans and then automatically wrap them in chained instrumentation if necessary. Unfortunately, by default `graphql-java` `Instrumentation` does not specify order in which it should be applied (as it is generally explicitly configured). In order to support proper ordering of the instrumentations we can simply check if they implement `Ordered` interface and use their order value OR default to order of `0` otherwise (unordered behavior).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: patch Changes require a patch version type: enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants