docs: use --hive-usage-* variants for the gateway usage reporting (#6612)

This commit is contained in:
Denis Badurina 2025-03-12 19:06:38 +01:00 committed by GitHub
parent 86dd49b5fc
commit 14c8a624ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 26 deletions

View file

@ -27,18 +27,27 @@ Usage: hive-gateway [options] [command]
Federated GraphQL Gateway
Options:
--fork <count> count of workers to spawn. uses "12" (available parallelism) workers when NODE_ENV is "production", otherwise "1" (the main) worker (default: 1 (env: FORK)
-c, --config-path <path> path to the configuration file. defaults to the following files respectively in the current working directory: gateway.ts, gateway.mts, gateway.cts, gateway.js, gateway.mjs, gateway.cjs (env: CONFIG_PATH)
-h, --host <hostname> host to use for serving (default: "0.0.0.0" (default: "0.0.0.0")
-p, --port <number> port to use for serving (default: 4000 (env: PORT)
--polling <duration> schema polling interval in human readable duration (default: "10s") (env: POLLING)
--fork <count> count of workers to spawn. uses "24" (available parallelism) workers when NODE_ENV is "production",
otherwise "1" (the main) worker (default: 1) (env: FORK)
-c, --config-path <path> path to the configuration file. defaults to the following files respectively in the current working
directory: gateway.ts, gateway.mts, gateway.cts, gateway.js, gateway.mjs, gateway.cjs (env:
CONFIG_PATH)
-h, --host <hostname> host to use for serving (default: 0.0.0.0)
-p, --port <number> port to use for serving (default: 4000) (env: PORT)
--polling <duration> schema polling interval in human readable duration (default: 10s) (env: POLLING)
--no-masked-errors don't mask unexpected errors in responses
--masked-errors mask unexpected errors in responses (default: true)
--hive-registry-token <token> Hive registry token for usage metrics reporting (env: HIVE_REGISTRY_TOKEN)
--hive-persisted-documents-endpoint <endpoint> [EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents. requires the "--hive-persisted-documents-token <token>" option
--hive-persisted-documents-token <token> [EXPERIMENTAL] Hive persisted documents CDN endpoint token. requires the "--hive-persisted-documents-endpoint <endpoint>" option
--hive-usage-target <target> Hive registry target to which the usage data should be reported to. requires the
"--hive-usage-access-token <token>" option (env: HIVE_USAGE_TARGET)
--hive-usage-access-token <token> Hive registry access token for usage metrics reporting. requires the "--hive-usage-target <target>"
option (env: HIVE_USAGE_ACCESS_TOKEN)
--hive-persisted-documents-endpoint <endpoint> [EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents. requires the
"--hive-persisted-documents-token <token>" option
--hive-persisted-documents-token <token> [EXPERIMENTAL] Hive persisted documents CDN endpoint token. requires the
"--hive-persisted-documents-endpoint <endpoint>" option
--hive-cdn-endpoint <endpoint> Hive CDN endpoint for fetching the schema (env: HIVE_CDN_ENDPOINT)
--hive-cdn-key <key> Hive CDN API key for fetching the schema. implies that the "schemaPathOrUrl" argument is a url (env: HIVE_CDN_KEY)
--hive-cdn-key <key> Hive CDN API key for fetching the schema. implies that the "schemaPathOrUrl" argument is a url (env:
HIVE_CDN_KEY)
--apollo-graph-ref <graphRef> Apollo graph ref of the managed federation graph (<YOUR_GRAPH_ID>@<VARIANT>) (env: APOLLO_GRAPH_REF)
--apollo-key <apiKey> Apollo API key to use to authenticate with the managed federation up link (env: APOLLO_KEY)
--disable-websockets Disable WebSockets support
@ -47,9 +56,12 @@ Options:
--help display help for command
Commands:
supergraph [options] [schemaPathOrUrl] serve a Federation supergraph provided by a compliant composition tool such as Mesh Compose or Apollo Rover
subgraph [schemaPathOrUrl] serve a Federation subgraph that can be used with any Federation compatible router like Apollo Router/Gateway
proxy [options] [endpoint] serve a proxy to a GraphQL API and add additional features such as monitoring/tracing, caching, rate limiting, security, and more
supergraph [options] [schemaPathOrUrl] serve a Federation supergraph provided by a compliant composition tool such as Mesh Compose or Apollo
Rover
subgraph [schemaPathOrUrl] serve a Federation subgraph that can be used with any Federation compatible router like Apollo
Router/Gateway
proxy [options] [endpoint] serve a proxy to a GraphQL API and add additional features such as monitoring/tracing, caching, rate
limiting, security, and more
help [command] display help for command
```

View file

@ -29,8 +29,9 @@ Before proceeding, make sure you have
```sh filename="Run Hive Gateway with Usage Reporting enabled." {4}
hive-gateway supergraph \
http://cdn.graphql-hive.com/artifacts/v1/12713322-4f6a-459b-9d7c-8aa3cf039c2e/supergraph \
--hive-cdn-key "YOUR HIVE CDN KEY" \
--hive-registry-token "YOUR HIVE REGISTRY TOKEN"
--hive-cdn-key "<hive_cdn_access_key>" \
--hive-usage-target "<hive_usage_target>" \
--hive-usage-access-token "<hive_usage_access_token>"
```
</Tabs.Tab>
@ -43,8 +44,9 @@ hive-gateway supergraph \
docker run --rm --name hive-gateway -p 4000:4000 \
ghcr.io/graphql-hive/gateway supergraph \
http://cdn.graphql-hive.com/artifacts/v1/12713322-4f6a-459b-9d7c-8aa3cf039c2e/supergraph \
--hive-cdn-key "YOUR HIVE CDN KEY" \
--hive-registry-token "YOUR HIVE REGISTRY TOKEN"
--hive-cdn-key "<hive_cdn_access_key>" \
--hive-usage-target "<hive_usage_target>" \
--hive-usage-access-token "<hive_usage_access_token>"
```
</Tabs.Tab>
@ -56,8 +58,9 @@ docker run --rm --name hive-gateway -p 4000:4000 \
```sh filename="Run Hive Gateway with Usage Reporting enabled." {4}
npx hive-gateway supergraph \
http://cdn.graphql-hive.com/artifacts/v1/12713322-4f6a-459b-9d7c-8aa3cf039c2e/supergraph \
--hive-cdn-key "YOUR HIVE CDN KEY" \
--hive-registry-token "YOUR HIVE REGISTRY TOKEN"
--hive-cdn-key "<hive_cdn_access_key>" \
--hive-usage-target "<hive_usage_target>" \
--hive-usage-access-token "<hive_usage_access_token>"
```
</Tabs.Tab>
@ -75,6 +78,8 @@ export const gatewayConfig = defineConfig({
type: 'hive',
// The registry token provided by Hive Registry
token: '<token>'
// The registry target which the usage data should be reported to
target: '<target>'
/**
* Other options
*

View file

@ -609,7 +609,8 @@ guide, we can simply re-use the registry token we already use for the CLI.
hive-gateway supergraph \
"<hive_cdn_endpoint>" \
--hive-cdn-key "<hive_cdn_access_key>" \
--hive-registry-token "<hive_registry_token>"
--hive-usage-target "<hive_usage_target>" \
--hive-usage-access-token "<hive_usage_access_token>"
```
| Parameter | Description |
@ -632,7 +633,8 @@ docker run --name hive-gateway -rm \
ghcr.io/graphql-hive/gateway supergraph \
"<hive_cdn_endpoint>" \
--hive-cdn-key "<hive_cdn_access_key>" \
--hive-registry-token "<hive_registry_token>"
--hive-usage-target "<hive_usage_target>" \
--hive-usage-access-token "<hive_usage_access_token>"
```
| Parameter | Description |
@ -651,14 +653,16 @@ docker run --name hive-gateway -rm \
npx hive-gateway supergraph \
"<hive_cdn_endpoint>" \
--hive-cdn-key "<hive_cdn_access_key>" \
--hive-registry-token "<hive_registry_token>"
--hive-usage-target "<hive_usage_target>" \
--hive-usage-access-token "<hive_usage_access_token>"
```
| Parameter | Description |
| ----------------------- | ------------------------------------------- |
| `<hive_cdn_endpoint>` | The endpoint of your Hive target |
| `<hive_cdn_access_key>` | The Hive CDN access key |
| `<hive_registry_token>` | The Hive registry token for usage reporting |
| Parameter | Description |
| --------------------------- | ---------------------------------------------------------------------- |
| `<hive_cdn_endpoint>` | The endpoint of your Hive target |
| `<hive_cdn_access_key>` | The Hive CDN access key |
| `<hive_usage_target>` | The Hive registry target to which the usage data should be reported to |
| `<hive_usage_access_token>` | The Hive registry token for usage reporting |
</Tabs.Tab>