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

Breaking: remove the query_planner service #1552

Merged
merged 16 commits into from
Aug 22, 2022
Merged

Conversation

o0Ignition0o
Copy link
Contributor

@o0Ignition0o o0Ignition0o commented Aug 19, 2022

Fixes #1545

@github-actions

This comment has been minimized.

@o0Ignition0o o0Ignition0o marked this pull request as ready for review August 19, 2022 13:42
@o0Ignition0o o0Ignition0o changed the title wip: remove query_planner service Breaking: remove the query_planner service Aug 19, 2022
@@ -41,6 +42,11 @@ impl BridgeQueryPlanner {
introspection: Option<Arc<Introspection>>,
configuration: Arc<Configuration>,
) -> Result<Self, QueryPlannerError> {
// The variables deduplication parameter lives in the traffic_shaping section of the config
let deduplicate_variables = configuration
.plugin_configuration("apollo.traffic_shaping")
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be a (static) method of the traffic shaping plugin? To notice it easily if something changes in that plugin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm not really sure how, but there's probably a way for me to ask traffic_shaping to give me its settings once i ve passed a configuration in Oo

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this config really be in traffic_shaping?

Copy link
Contributor

Choose a reason for hiding this comment

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

something simple like:

impl TrafficShaping {
  fn get_configuration_deduplicate_variables(configuration: &Configuration) -> bool {
     configuration
            .plugin_configuration("apollo.traffic_shaping").map(|conf| conf.get("deduplicate_variables") == Some(&serde_json::Value::Bool(true)))
            .unwrap_or_default()
  }
}

Just to have the code related to this part of the configuration in the plugin so we don't miss something if config options change

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this config really be in traffic_shaping?

I don't think so, while its goal is to reduce the size of subgraph requests and responses, it's more related to query plan execution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see.

RE: traffic_shaping yml config: I think we should revisit this as part of #1500

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 5b5612a

@Geal
Copy link
Contributor

Geal commented Aug 19, 2022

removing code feels nice :)

apollo-router/src/services/mod.rs Outdated Show resolved Hide resolved
@@ -41,6 +42,11 @@ impl BridgeQueryPlanner {
introspection: Option<Arc<Introspection>>,
configuration: Arc<Configuration>,
) -> Result<Self, QueryPlannerError> {
// The variables deduplication parameter lives in the traffic_shaping section of the config
let deduplicate_variables = configuration
.plugin_configuration("apollo.traffic_shaping")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this config really be in traffic_shaping?

@BrynCooke
Copy link
Contributor

BrynCooke commented Aug 19, 2022

I guess the team already discussed and agreed on removal, just want to highlight that it was at one point thought that query plan caching could eventually be configurable via plugin. I think this'll close down this opportunity.

Was the option of introducing a plugin internal trait discussed. This would allow us to keep things clean architecturally. Thinking specifically of query dedup here.

@o0Ignition0o
Copy link
Contributor Author

Was the option of introducing a plugin internal trait discussed. This would allow us to keep things clean architecturally. Thinking specifically of query dedup here.

Yes it was, and we're still very much open to adding one if needs be! I'd be very happy to discuss it next week.

@Geal
Copy link
Contributor

Geal commented Aug 19, 2022

What was supposed to be modifiable by a plugin in plan caching? There's nothing preventing us from introducing new plugin hook points in the future.

Trying to leverage the plugin architecture is a good goal because it allows to separate concerns cleanly, but it does not make sense for every feature. Caching and query deduplication in particular should be implemented as part of the underlying service, or as a layer above a clonable service like SubgraphService. Because if it is done as a plugin, it forces us to reintroduce a Buffer and the related reliability issues.
The plugin model is useful but it must not be the only way to add features to the router

@abernix abernix added this to the vNEXT milestone Aug 22, 2022
@o0Ignition0o o0Ignition0o merged commit f7f0ba8 into main Aug 22, 2022
@o0Ignition0o o0Ignition0o deleted the igni/query_planner_ectomy branch August 22, 2022 09:07
@Geal Geal mentioned this pull request Aug 22, 2022
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.

Remove query_planner_service from the public plugin API
5 participants