How-to guide
GraphQL API monitoring
GraphQL puts everything behind one endpoint and usually answers 200 even when things fail. Monitoring has to look inside the response and at each operation.
3 min read13 sectionsUpdated
On this page
Errors live in the body
A GraphQL server typically returns HTTP 200 with partial data and an errors array. A status-only uptime check will report success while users see failures.
{
"data": { "order": null },
"errors": [{ "message": "Payment service unavailable", "path": ["order", "payment"], "extensions": { "code": "UPSTREAM_TIMEOUT" } }]
}POST https://api.example.com/graphql
header content-type: application/json
body {"operationName":"Health","query":"query Health { viewer { id } status { db cache } }"}
expect status = 200
expect body does not contain "\"errors\""
expect body contains "\"db\":\"ok\""
expect time < 1000 msMeasure per operation
Every request goes to POST /graphql, so URL-based metrics show one meaningless row. Require clients to send an operationName and use it as the span name or a metric label (it is low-cardinality). Then you get request rate, error rate and p95 per operation: GetProduct, CreateOrder, SearchCatalog.
Trace resolvers
OpenTelemetry instrumentation for GraphQL servers (for example @opentelemetry/instrumentation-graphql for Node.js) creates spans for parsing, validation and resolvers. Watch for:
- Resolver N+1: a list field whose child resolver queries the database once per item. Use a DataLoader to batch.
- Slow fields: one expensive field requested by many queries.
- Deep queries: nested selections multiplying work.
In VitalRix
API monitoring supports POST bodies, headers and assertions on the response body, including multi-step flows that pass values between requests. APM shows latency and errors per span name from OpenTelemetry traces, so operation-named spans become rows you can sort and alert on.
import DataLoader from 'dataloader';
// one loader per request: batches all customer lookups made while resolving a query
const customerLoader = new DataLoader(async (ids: readonly string[]) => {
const rows = await db.customers.findMany({ where: { id: { in: [...ids] } } });
const byId = new Map(rows.map((r) => [r.id, r]));
return ids.map((id) => byId.get(id) ?? null);
});
const resolvers = {
Order: { customer: (order) => customerLoader.load(order.customerId) },
};Should GraphQL errors return 500?
Most servers return 200 for field-level errors and reserve non-200 codes for transport problems. Monitor the errors array either way.
How do I find slow GraphQL queries?
Trace resolvers, group by operation name and sort by p95. The slow trace shows which resolver and which database call dominate.
Check it now, free
- Response time checker: Measure TTFB with DNS, connect, TLS and server time.
Related reading
- How to monitor Supabase: How to monitor a Supabase backend: Postgres health and slow queries, auth and REST API availability, edge function errors, connection limits and alerts.
- WordPress monitoring: uptime, speed and errors: Monitor a WordPress site: uptime with content checks, login and admin, Core Web Vitals, PHP errors, plugin updates, SSL expiry and backups.
- Monitoring APIs for mobile apps: Monitor the backend of a mobile app: API latency and errors per endpoint, failures by app version, push and sync jobs and regional performance.
- What is API testing?: API testing explained: functional, contract, load and security tests, what to assert on, tools, and running API checks continuously in production as monitoring.
- Best synthetic monitoring tools: Choose a synthetic monitoring tool in 2026: API and browser checks, scripting, locations, private networks and CI use, with well-known options compared.
- How to monitor a Next.js app: How to monitor a Next.js app in production: uptime checks, Core Web Vitals, server and edge errors, OpenTelemetry traces for SSR and API routes, and alerts.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.