Lesson 9 of 9 · 25m
Operating GraphQL in Production
Schema registry workflows, client-aware rollout, observability, and the day-two practices that keep a graph evolvable instead of brittle.
The tutorial ends when the server starts. Production begins when three teams need to change the schema without breaking mobile clients from last year, and the incident commander needs to know which query shape caused the database spike. A mature GraphQL platform is mostly process wrapped around a type system.
Treat the schema as a versioned artifact
Every proposed schema should go through automated checks before merge:
rover subgraph check production-graph --name accounts --schema schema.graphqlFor non-federated graphs the same idea applies: compare the proposed SDL with the published contract, classify breaking changes, and fail unless the change is explicitly approved. Composition checks, lint rules, and examples belong in CI next to unit tests.
Know which clients use which fields
A schema registry is not just storage for SDL. It should ingest operation traffic metadata so you can answer: "Is anyone still querying Member.email?" Aggregate by operation hash, client name/version, field, and error rate. This turns deprecation from a hope into a measurable migration.
field Member.email
last_seen: 2026-11-28T14:03Z
clients: ios/4.8.2, web/2026.11.20
operations_7d: 184Removal is safe when usage is zero or owned by a client you control and can update.
Roll out additive change in the right order
The safe order is usually:
- Deploy server support for the new field or behavior.
- Verify the field in production with synthetic operations.
- Release clients that consume it.
- Migrate traffic away from the old field.
- Deprecate, monitor, then remove.
If an enum value is being added, reverse part of the logic: clients must tolerate unknown values before the server emits the new value. Mobile release lag is a schema constraint whether you like it or not.
Observability must understand operation shape
A single /graphql route makes ordinary HTTP metrics nearly useless. Log and aggregate:
- Operation name and hash, not raw variables.
- Client name/version.
- Query cost and depth.
- Resolver hotspots and loader batch statistics.
- Error codes by path.
- Cache hit rates and downstream dependency latency.
Example structured log:
{
"operation": "WorkspaceDashboard",
"hash": "sha256:9aa1",
"client": "web/2026.11.29",
"cost": 742,
"db_queries": 14,
"errors": 0,
"duration_ms": 118
}Never log passwords, tokens, or sensitive variables. Redaction is part of telemetry design.
Create operational escape valves
Production systems need controlled ways to degrade: feature flags for expensive fields, per-client cost budgets, emergency disablement of optional subgraphs, and synthetic probes for critical operations. If a downstream provider is failing, return a designed partial response rather than turning the entire graph into an outage.
Contract-test real client operations
Store representative operations from web, mobile, and partner clients in a contract test suite. Run them in CI against schema changes and important resolver changes. These tests catch differences static analysis misses: nullability assumptions, error shape handling, pagination behavior, and authorization regressions.
Field notes
- Operation names should be stable product contracts; anonymous queries make observability and governance miserable.
- Schema changes need rollout plans when clients are versioned artifacts, especially mobile apps.
- Keep sample variables in tests realistic enough to exercise batching and pagination.
- GraphQL gateways are critical infrastructure: monitor CPU, memory, parse time, and planning latency separately.
- The healthiest graphs are boring to operate because their contracts and failure modes were designed before the incident.
Was this lesson helpful?