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

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

Merged
merged 4 commits into from
Mar 12, 2025
Merged
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
36 changes: 24 additions & 12 deletions packages/web/docs/src/content/api-reference/gateway-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

```
Expand Down
17 changes: 11 additions & 6 deletions packages/web/docs/src/content/gateway/usage-reporting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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
*
Expand Down
20 changes: 12 additions & 8 deletions packages/web/docs/src/content/get-started/apollo-federation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
Expand All @@ -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>

Expand Down
Loading