How to Monitor GraphQL APIs with Vigilmon
GraphQL APIs use a single endpoint (/graphql) for all operations — but that single endpoint can fail in ways that are invisible to standard uptime monitors. This guide explains how to monitor GraphQL APIs effectively with Vigilmon.
The Challenge with GraphQL Monitoring
A standard uptime monitor that sends a GET request to /graphql will usually see a 200 OK — even when the API is completely broken — because GraphQL servers often return 200 for all responses, including errors:
{
"errors": [
{
"message": "Database connection failed",
"locations": [{"line": 1, "column": 1}]
}
]
}
HTTP status 200, but the API is down.
The solution: use a dedicated introspection query or a lightweight ping query as your health check, and verify the response body — not just the HTTP status code.
Option 1: Health Query Approach (Recommended)
Add a dedicated health query to your GraphQL schema:
type Query {
_health: HealthStatus!
}
type HealthStatus {
status: String!
timestamp: String!
}
// Resolver
const resolvers = {
Query: {
_health: async (_, __, context) => {
// Optionally check database
await context.db.raw('SELECT 1');
return {
status: 'ok',
timestamp: new Date().toISOString(),
};
},
},
};
Now you can monitor with a POST request to /graphql with this body:
{"query": "{ _health { status timestamp } }"}
The expected response:
{"data":{"_health":{"status":"ok","timestamp":"2026-08-04T..."}}}}
Option 2: Introspection-Based Monitoring
If you can't modify the schema, use a minimal introspection query that any valid GraphQL server answers:
{"query": "{__typename}"}
Expected response:
{"data":{"__typename":"Query"}}
This is the lightest possible GraphQL query. If it fails, your GraphQL server is down.
Note: Some production schemas disable introspection. If yours does, create a health query (Option 1) or use a lightweight real query.
Setting Up a Vigilmon Monitor for GraphQL
Vigilmon supports custom POST requests with JSON bodies and response body matching:
- Log in at vigilmon.online
- Click Add Monitor
- Set URL to
https://api.yourapp.com/graphql - Set Monitor Type to HTTP/HTTPS
- Set HTTP Method to POST
- Set Request Body (Content-Type:
application/json):
{"query": "{ _health { status } }"}
Or for introspection:
{"query": "{__typename}"}
- Set Expected Status Code to
200 - Set Response Body Must Contain to
"status":"ok"(for health query) or"__typename"(for introspection) - Add any required Request Headers (e.g.,
Authorization: Bearer your-tokenif the health query requires auth) - Click Save
Handling Authentication
If your GraphQL health query requires authentication:
Bearer Token (Static)
Add a request header in Vigilmon:
Authorization: Bearer your-static-monitor-token
Generate a dedicated monitoring service account token with minimal permissions.
API Key
X-API-Key: your-monitoring-api-key
Anonymous Health Endpoint
The cleanest approach: make your _health query public (no authentication required) but return only non-sensitive status information. This avoids storing credentials in your monitoring tool.
Monitor Multiple GraphQL Operations
For a production GraphQL API, consider monitoring more than just the health query:
Monitor the Schema Introspection
{"query": "{__schema{queryType{name}}}"}
Verifies the schema is complete and not partially broken.
Monitor a Real Query
For critical queries (e.g., product listings, user profile), create a monitor that executes a lightweight version of the real query:
{"query": "{ products(limit: 1) { id name } }"}
Set Response Body Must Contain: "products" — verifies the resolver chain works end-to-end including database access.
GraphQL Subscriptions Monitoring
Vigilmon monitors HTTP/HTTPS endpoints, not WebSocket connections. For GraphQL subscriptions (WebSocket-based), monitor the underlying WebSocket server's HTTP upgrade endpoint:
https://api.yourapp.com/graphql
Alternatively, monitor a REST health endpoint alongside your GraphQL API.
Multi-Region Consensus for GraphQL
Vigilmon's multi-region consensus model is especially valuable for GraphQL APIs:
- GraphQL resolver chains can have partial failures (some resolvers work, some don't)
- Single-region checks might miss transient resolver failures
- Multi-region checks from 3+ global probes confirm that your API is genuinely unavailable, not just slow for one probe's network path
An alert fires only when 3+ independent probe nodes simultaneously report failure — eliminating false alerts from transient network issues.
Example: Full GraphQL Monitoring Stack
| Monitor | Endpoint | Body | Checks |
|---|---|---|---|
| Health query | /graphql |
{"query": "{ _health { status } }"} |
Resolvers + DB |
| Schema check | /graphql |
{"query": "{__typename}"} |
Schema integrity |
| Critical query | /graphql |
{"query": "{ products(limit:1) { id } }"} |
Product resolver |
| SSL cert | /graphql |
— | Auto via HTTPS monitor |
Setting Up Alerts
- In Vigilmon → Alert Channels → Add Channel
- Add Email, Slack, PagerDuty, or custom webhook
- Configure: "Alert after 2 consecutive failures from 2+ regions"
When your GraphQL API starts returning errors (or truly goes unreachable), you'll know within 2 minutes — before users start filing tickets.
Heartbeat Monitoring for GraphQL Subscriptions Workers
If your app uses a separate process to maintain subscription connections or process GraphQL queues, add a Vigilmon heartbeat:
// In your subscription worker, after each successful cycle
await fetch(`https://vigilmon.online/api/heartbeat/${process.env.VIGILMON_HEARTBEAT_ID}`);
Conclusion
GraphQL's single-endpoint architecture makes standard uptime monitoring misleading — a 200 OK doesn't mean your resolvers work. The right approach: monitor with a POST request that executes a real query and verify the response body contains valid data.
Vigilmon's support for custom POST bodies, response body matching, and custom headers makes it well-suited for GraphQL API monitoring.
Start monitoring your GraphQL API with Vigilmon — free tier, 2-minute setup.
Top comments (0)