Skip to main content
Version: v2.x

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

NameDescriptionTypeLabels
hasura_http_connectionsCurrent number of active HTTP connections (excluding WebSocket connections)Gaugenone
hasura_websocket_connectionsCurrent number of active WebSocket connectionsGaugenone
hasura_active_subscriptionsCurrent number of active subscriptionsGaugenone
hasura_graphql_requests_totalNumber 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_secondsExecution 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_secondsQueue time for an event already in the processing queueHistogram

Buckets: 0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100
none
hasura_event_fetch_time_per_batch_secondsLatency of fetching a batch of eventsHistogram

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_secondsThe time between when an HTTP worker picks an event for delivery to the time its response is updated in the DBHistogram

Buckets: 0.01, 0.03, 0.1, 0.3, 1, 3, 10
none
hasura_event_trigger_http_workersCurrent number of active event trigger HTTP workersGaugenone
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).