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

DO NOT MERGE : This POC shows what a new GraphQLEngine might look like #3348

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bbakerman
Copy link
Member

@bbakerman bbakerman commented Oct 16, 2023

This PR introduces GraphQlEngine interface that represents execution better than the ExecutionStrategy code.

It's truly generic and leaves the implementation up to the implementor - unlike the abstract ExecutionStrategy code that requires you to use its exact algo.

Of course Instrumentation of the field fetches etc... are really tied to how the engine runs and hence this breaks the Instrumentation of the parts before "engine execution" out and creates an engine specific OriginalEngineInstrumentation for the ES specific parts.

The naming here sucks in many ways as do the packages but I wanted to make the smallest useful breaking change. We can discuss if we want to break things by moving things around more. At the end of the day the instrumentation of engine is specific to the engine. It just is.

This is discussed in #3331

This is currently on failing these tests

ExecutionContextBuilderTest
ExecutionTest

they are mostly because they deeply test the innards of code that has changed and I didnt spend the time yet to re-test with the new behavior.

So in a general sense most of the graphql code base is working.

@bbakerman bbakerman added breaking change requires a new major version to be relased Not to be merged spikes or other stuff that should never or not yet to be merged labels Oct 16, 2023
* The parameters that are passed to {@link GraphQLEngine}s
*/
@PublicApi
public class EngineParameters {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is pretty much a copy of ExecutionStrategyParameters but I felt that is too tied to the old ES way


public interface GraphQLEngine {

Instrumentation getInstrumentation();
Copy link
Member Author

Choose a reason for hiding this comment

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

Instrumentation is engine specific - it has to be

if (logNotSafe.isDebugEnabled()) {
logNotSafe.debug("Executing '{}' query operation: '{}' using '{}' execution strategy", executionContext.getExecutionId(), operation, executionStrategy.getClass().getName());
}
result = executionStrategy.execute(executionContext, parameters);
Copy link
Member Author

Choose a reason for hiding this comment

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

this now needs to happen inside the engine. They pick what to execute

@@ -43,24 +44,24 @@
*/
@SuppressWarnings("deprecation")
@PublicApi
public class ChainedInstrumentation implements Instrumentation {
public class ChainedInstrumentation implements OriginalEngineInstrumentation {
Copy link
Member Author

Choose a reason for hiding this comment

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

this area is where I need the most feedback - nominally a ChainedInstrumentation that is NOT on the original would be useful but its always going to have to have a specific class.

Maybe I make a ``ChainedOriginalInstrumentation extends ChainedInstrumentation` some how

@@ -199,183 +199,6 @@ default InstrumentationContext<ExecutionResult> beginExecuteOperation(Instrument
return beginExecuteOperation(parameters.withNewState(state));
}

/**
Copy link
Member Author

Choose a reason for hiding this comment

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

The removed methods are specific to the ES code base

…tion is done differently now - they can be passed around but detection is done when used
…tion is done differently now - tweaked tests
@andimarek
Copy link
Member

Lets test this design (or any ES design change) with:

  • Batched execution engined: batching without dataloader
  • Java 21 specific engine
  • Nadel?
  • Engines based ENFs.

Other notes:

  • ExecutionContext is to specific at the moment.
  • Make the current engine non API.
  • Common code across engines is probably very helpful but hard.

@dondonz dondonz added the keep-open Tells Stale Bot to keep PRs and issues open label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change requires a new major version to be relased keep-open Tells Stale Bot to keep PRs and issues open Not to be merged spikes or other stuff that should never or not yet to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants