stayallive/lighthouse-graphql-hive
Integrates GraphQL Hive with Laravel Lighthouse: report schema usage and operations, validate schemas, and manage schema publishing from your GraphQL server.
composer require stayallive/lighthouse-graphql-hive
php artisan vendor:publish --tag=lighthouse-graphql-hive-config
Grab a reporting/ingest token from your Hive project (Settings → Access Tokens), then configure the environment:
HIVE_TOKEN=...
HIVE_ENDPOINT=https://api.graphql-hive.com
HIVE_REPORTING_ENABLED=true
HIVE_SAMPLE_RATE=1
HIVE_CLIENT_NAME="${APP_NAME}"
HIVE_CLIENT_VERSION=1.0.0
Lighthouse must have tracing enabled and pointed at the Hive driver. Edit config/lighthouse.php:
'tracing' => [
'enabled' => env('LIGHTHOUSE_TRACING_ENABLED', true),
// Use the exact tracer class documented in the package README —
// Lighthouse v5 and v6 expose different tracing contracts.
'driver' => Stayallive\LighthouseGraphQLHive\Tracing\HiveTracer::class,
],
First use case: execute a named query against /graphql, then open Hive → Operations. You should see the operation name, latency, error rate, and client name/version. If it's silent, check storage/logs for the Hive client and confirm a schema version is published in that Hive target.
Where to look first:
config/lighthouse-graphql-hive.php — endpoint, token, sampling, client metadata.config/lighthouse.php — tracing block; this is the switch that actually turns reporting on/off.HIVE_REPORTING_ENABLED=false). Never reuse a prod ingest token in CI or feature branches — bad operations will pollute prod metrics.HIVE_SAMPLE_RATE=0.1 on high-traffic APIs; Hive extrapolates counts and percentiles. Avoid sampling to zero in production — you lose the signal you installed the package for.HIVE_CLIENT_VERSION from a build/commit env var so Hive can tie error spikes to deploys. Set HIVE_CLIENT_NAME per service if you run multiple GraphQL apps.hive CLI in CI (or graphql-hive/php for OTel-native flows). Wire CI to publish on schema changes so reported operations aren't orphaned.HIVE_ENDPOINT to your instance; ensure egress from web and Octane workers, and TLS is trusted.graphql-hive/php), the rates compound and your dashboard silently under-reports. Pick one sampling layer.composer.json to avoid surprise breakage on composer update..env or config/lighthouse.php, run php artisan config:cache (or config:clear) — stale caches are the #1 cause of "reports suddenly stopped."query Foo { ... }) so per-operation metrics are actionable.terminate (some test harnesses, misconfigured FPM/Octane setups) will silently drop data. Disable reporting in phpunit.xml.HIVE_ENDPOINT at a logging proxy or attach a Guzzle middleware to inspect the outbound payload; Hive returns structured JSON errors for malformed requests.HIVE_CLIENT_VERSION is your only way to correlate which build produced which operations during an incident.How can I help you explore Laravel packages today?