Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .changeset/cold-bags-confess.md
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
Copy link
Member

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.


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,
},
});
```
3 changes: 2 additions & 1 deletion e2e/cloudflare-workers/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ compatibility_date = "2024-01-01"
"@graphql-tools/wrap" = "../../packages/wrap/src/index.ts"
"@graphql-tools/batch-delegate" = "../../packages/batch-delegate/src/index.ts"
"@graphql-tools/delegate" = "../../packages/delegate/src/index.ts"
"@graphql-hive/signal" = "../../packages/signal/src/index.ts"
"@graphql-hive/signal" = "../../packages/signal/src/index.ts"
"@graphql-hive/logger" = "../../packages/logger/src/index.ts"
2 changes: 1 addition & 1 deletion e2e/self-hosting-hive/self-hosting-hive.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Self Hosting Hive', () => {
/\[hiveSupergraphFetcher\] GET .* succeeded with status 200/,
);
expect(gwLogs).toMatch(
/\[useHiveConsole\] \[hive\]\[usage\]\[agent\] POST .* succeeded with status 200/,
/\[useHiveConsole\] POST .*\/usage .* succeeded with status 200/,
);
});
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"vitest": "3.2.4"
},
"resolutions": {
"@graphql-hive/core": "0.16.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874",
Copy link
Member

Choose a reason for hiding this comment

The 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:^",
Expand Down
Loading
Loading