Metrics via Prometheus
Available on: Enterprise Edition
Enable metrics endpoint
By default the Prometheus metrics endpoint is disabled. To enable Prometheus metrics, configure the environment variable below:
HASURA_GRAPHQL_ENABLED_APIS=metadata,graphql,config,metrics
Secure the Prometheus metrics endpoint with a secret:
HASURA_GRAPHQL_METRICS_SECRET=<secret>
curl 'http://127.0.0.1:8080/v1/metrics' -H 'Authorization: Bearer <secret>'
Note
- The metrics endpoint should be configured with a secret to prevent misuse and should not be exposed over the internet.
Metrics exported
Name | Description | Type | Labels |
hasura_http_connections | Current number of active HTTP connections (excluding WebSocket connections) | Gauge | none |
hasura_websocket_connections | Current number of active WebSocket connections | Gauge | none |
hasura_active_subscriptions | Current number of active subscriptions | Gauge | none |
hasura_graphql_requests_total | Number of GraphQL requests received (excluding subscriptions) | Counter | • "operation_type": query|mutation|unknown • The "unknown" operation type will be returned for queries that fail authorization, parsing, or certain validations • "response_status": success|failed |
hasura_graphql_execution_time_seconds | Execution time of successful GraphQL requests (excluding subscriptions) | Histogram Buckets: 0.01, 0.03, 0.1, 0.3, 1, 3, 10 | • "operation_type": query|mutation |
hasura_event_queue_time_seconds | Queue time for an event already in the processing queue | Histogram Buckets: 0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100 | none |
hasura_event_fetch_time_per_batch_seconds | Latency of fetching a batch of events | Histogram Buckets: 0.0001, 0.0003, 0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 1, 3, 10 | none |
hasura_event_webhook_processing_time_seconds | The time between when an HTTP worker picks an event for delivery to the time its response is updated in the DB | Histogram Buckets: 0.01, 0.03, 0.1, 0.3, 1, 3, 10 | none |
hasura_event_processing_time_seconds | The time taken for an event to be delivered since it's been created (if first attempt) or retried (after first attempt). | Histogram Buckets: 0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100 | none |
hasura_event_trigger_http_workers | Current number of active event trigger HTTP workers | Gauge | none |
hasura_postgres_connections | Current number of active PostgreSQL connections | Gauge | • "source_name": name of the database • "conn_info": connection url string (password omitted) or name of the connection url environment variable • "role": primary|replica |
Note
The GraphQL request execution time:
- Uses wall-clock time, so it includes time spent waiting on I/O.
- Includes authorization, parsing, validation, planning, and execution (calls to databases, remote schemas).