Skip to content

Move operation limits enforcement into a layer #7611

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

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

goto-bus-stop
Copy link
Member

An example of the refactoring unlocked by #7610.

Operation limits enforcement can be done in a layer at the supergraph service. This way it's a composable piece of functionality that we can add or remove in a single-line code change. This also means it's done a bit earlier in the pipeline. And that we don't need to thread the generated query metrics through the query planner service just to be able to put it in context. Because we don't need a bunch of hardcoded bits in the query planner service to do this, we can actually move all operation limits code into the limits plugin.

@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Jun 5, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 98e453b33aa2d2d7240a296c

type Service = EnforceOperationLimits<S>;

fn layer(&self, inner: S) -> Self::Service {
EnforceOperationLimits {
Copy link
Member Author

Choose a reason for hiding this comment

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

We could also use one of the .map_future-style layers here to implement the service. I think it's a pretty good exercise to get into writing our own services though, once you understand them it's not that hard... and we all need to understand them to work with tower effectively.

Base automatically changed from renee/move-parsed-document-hack to dev June 5, 2025 14:36
@goto-bus-stop goto-bus-stop force-pushed the renee/operation-limits-as-a-layer branch from edfc3f9 to ead890c Compare June 5, 2025 14:43
Copy link
Contributor

github-actions bot commented Jun 5, 2025

@goto-bus-stop, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

@goto-bus-stop goto-bus-stop force-pushed the renee/operation-limits-as-a-layer branch from ead890c to fbdda50 Compare June 10, 2025 12:31
@apollo-librarian
Copy link

apollo-librarian bot commented Jun 10, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 3 changed, 0 removed
* (developer-tools)/apollo-mcp-server/(latest)/command-reference.mdx
* (developer-tools)/rover/commands/dev.mdx
* graphos/schema-design/federated-schemas/reference/moving-to-federation-2.mdx

Build ID: 0206cb525df1b27561168acd

URL: https://www.apollographql.com/docs/deploy-preview/0206cb525df1b27561168acd

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