-
Notifications
You must be signed in to change notification settings - Fork 25
feat(gateway): add support for new Hive CDN mirror and circuit breaker #1738
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
Open
EmrysMyrddin
wants to merge
8
commits into
main
Choose a base branch
from
hive-cdn-mirror
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cbb2d78
feat(gateway): add support for new Hive CDN mirror and circuit breaker
EmrysMyrddin f6395ed
add mirror and circuit breaker to persisted documents
EmrysMyrddin 761959d
fix missing circuit breaker when usage report entabled
EmrysMyrddin 8deb1d4
add changeset
EmrysMyrddin c46a189
format
EmrysMyrddin bac47b3
fix tests
EmrysMyrddin dc5e9ec
fix e2e tests for hive usage
EmrysMyrddin bad695e
try to fix wrangler config
EmrysMyrddin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
| '@graphql-hive/gateway-runtime': minor | ||
| --- | ||
|
|
||
| ## New Hive CDN mirror and circuit breaker | ||
|
|
||
| Hive CDN introduced a new CDN mirror and circuit breaker to mitigate the risk related to Cloudflare | ||
| services failures. | ||
|
|
||
| You can now provide multiple endpoint in Hive Console related features, and configure the circuit | ||
| breaker handling CDN failure and how it switches to the CDN mirror. | ||
|
|
||
| ### Usage | ||
|
|
||
| To enable this feature, please provide the mirror endpoint in `supergraph` and `persistedDocument` | ||
| options: | ||
|
|
||
| ```diff | ||
| import { defineConfig } from '@graphql-hive/gateway' | ||
|
|
||
| export const gatewayConfig = defineConfig({ | ||
| supergraph: { | ||
| type: 'hive', | ||
| - endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/...../supergraph', | ||
| + endpoint: [ | ||
| + 'https://cdn.graphql-hive.com/artifacts/v1/...../supergraph', | ||
| + 'https://cdn-mirror.graphql-hive.com/artifacts/v1/...../supergraph' | ||
| + ] | ||
| }, | ||
|
|
||
| persistedDocuments: { | ||
| - endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/...', | ||
| + endpoint: [ | ||
| + 'https://cdn.graphql-hive.com/artifacts/v1/...', | ||
| + 'https://cdn-mirror.graphql-hive.com/artifacts/v1/...' | ||
| + ] | ||
| } | ||
| }) | ||
| ``` | ||
|
|
||
| ### Configuration | ||
|
|
||
| The circuit breaker has production ready default configuration, but you customize its behavior: | ||
|
|
||
| ```ts | ||
| import { defineConfig, CircuitBreakerConfiguration } from '@graphql-hive/gateway'; | ||
|
|
||
| const circuitBreaker: CircuitBreakerConfiguration = { | ||
| resetTimeout: 30_000; // 30s | ||
| errorThresholdPercentage: 50; | ||
| volumeThreshold: 5; | ||
| } | ||
|
|
||
| export const gatewayConfig = defineConfig({ | ||
| supergraph: { | ||
| type: 'hive', | ||
| endpoint: [...], | ||
| circuitBreaker, | ||
| }, | ||
|
|
||
| persistedDocuments: { | ||
| type: 'hive', | ||
| endpoint: [...], | ||
| circuitBreaker, | ||
| }, | ||
| }); | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,7 @@ | |
| "vitest": "3.2.4" | ||
| }, | ||
| "resolutions": { | ||
| "@graphql-hive/core": "0.16.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this released? Do we want the alpha? |
||
| "@graphql-mesh/types": "0.104.13", | ||
| "@graphql-mesh/utils": "0.104.13", | ||
| "@graphql-tools/delegate": "workspace:^", | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First line should be the name of the changeset, dont title it, it will look weird when listing all changesets.