An overview of feature subgraphs, feature flags, and implementing your first feature flag.
Feature Flag and Feature Subgraphs
Traffic splitting
@override
directive on some number of fields in the old schema without automatically enabling it for all clients. Instead, we can send a small percentage of traffic to the new subgraph in a “shadow mode” and monitor its performance. This means that the new subgraph is used to compute the result of the GraphQL Operation, but the result is not returned to the client. Instead, we compare the result from the newly introduced subgraph with the result of the existing Monolith in terms of correctness and performance.
If everything goes well, you can enable the feature flag for 1% of your users, keep monitoring, and gradually increase the percentage of traffic that is sent to the new subgraph. If something goes wrong, we can disable the feature flag for all users without deploying a new version of the API.
After rolling out the feature to 100% of your users, it can be continually monitored in production until there is confidence to publish the new subgraph schema without the feature flag. You can then remove the feature flag as well as any remaining obsolete logic and declarations from the monolith.
X-Feature-Flag
header to the name of the feature flag to enable it./v1/graphql
and /v2/graphql
. This way, existing clients can continue to use the old schema until they are ready to switch to the new schema, and the contract is never broken. Moreover, new clients could automatically use the latest version of the schema, including all feature flags.