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

feat(gateway): Implement new supergraphSdl() config option for dynamic gateway updates (version 2 port) #1371

Merged
merged 4 commits into from
Jan 11, 2022

Commits on Jan 11, 2022

  1. feat(gateway): Implement new supergraphSdl() config option for dyna…

    …mic gateway updates (#1246)
    
    (copied from the changelog entry)
    
    This change improves the `supergraphSdl` configuration option to provide a clean and flexible interface for updating gateway schema on load and at runtime. This PR brings a number of updates and deprecations to the gateway. Previous options for loading the gateway's supergraph (`serviceList`, `localServiceList`, `experimental_updateServiceDefinitions`, `experimental_supergraphSdl`) are all deprecated going forward. The migration paths all point to the updated `supergraphSdl` configuration option.
    
    The most notable change here is the introduction of the concept of a `SupergraphManager` (one new possible type of `supergraphSdl`). This interface (when implemented) provides a means for userland code to update the gateway supergraph dynamically, perform subgraph healthchecks, and access subgraph datasources. All of the mentioned deprecated configurations now either use an implementation of a `SupergraphManager` internally or export one to be configured by the user (`IntrospectAndCompose` and `LocalCompose`).
    
    For now: all of the mentioned deprecated configurations will still continue to work as expected. Their usage will come with deprecation warnings advising a switch to `supergraphSdl`.
    * `serviceList` users should switch to the now-exported `IntrospectAndCompose` class.
    * `localServiceList` users should switch to the similar `LocalCompose` class.
    * `experimental_{updateServiceDefinitions|supergraphSdl}` users should migrate their implementation to a custom `SupergraphSdlHook` or `SupergraphManager`.
    
    Since the gateway itself is no longer responsible for composition:
    * `experimental_didUpdateComposition` has been renamed more appropriately to `experimental_didUpdateSupergraph` (no signature change)
    * `experimental_compositionDidFail` hook is removed
    
    `experimental_pollInterval` is deprecated and will issue a warning. Its renamed equivalent is `pollIntervalInMs`.
    
    Some defensive code around gateway shutdown has been removed which was only relevant to users who are running the gateway within `ApolloServer` before v2.18. If you are still running one of these versions, server shutdown may not happen as smoothly.
    trevor-scheer committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    41dd9f3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2cf9810 View commit details
    Browse the repository at this point in the history
  3. track the generated sdl rather than the result, this is the one that'…

    …s actually consumed by gateway
    trevor-scheer committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    65a9f74 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6c7eec8 View commit details
    Browse the repository at this point in the history