Skip to content

Support for progressive overrides described in the Apollo 2.7 release. #2469

@benevolent-donut

Description

@benevolent-donut

Component(s)

router

Is your feature request related to a problem? Please describe.

@override's all-or-nothing approach makes it challenging to safely migrate a monolith to use Cosmo Router. Once the schema is composed with @override, 100% of traffic immediately routes to the new service with no ability to gradually roll out (1% → 25% → 100%) or validate with a small percentage of production traffic first.

Describe the solution you'd like

Implement Apollo Federation 2.7's progressive override.

type Query {
 user(id: ID!): User @override(from: "monolith", label: "percent(25)")
}

Implementation:

  1. Composition: Parse and store label parameter in supergraph metadata
  2. Runtime: Router evaluates label per-request and routes accordingly
  3. Support built-in percent(X) syntax at minimum

Describe alternatives you've considered

The following approach is the only viable alternative that I've considered.

HTTP middleware that introspects request body:

  • Custom @overridePercentage(pct: Int) directive that adds override context to custom HTTP round trippers.
  • Parse requests bound for downstreams, determine fields eligible for percentage routing, then route based on the configured percentage.
  • Not ideal: requires parsing every request, completely works around cosmo/router's federation implementation.

Additional context

  • Apollo introduced this in Federation 2.7 (April 2024)
  • Documentation
  • Blog post
  • Current limitation: graphql-go-tools generates query plans at composition time, would need runtime evaluation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions