Skip to main content

Version: latest

Monitor Metrics

API7 Gateway provides two ways to monitor traffic:

  • A built-in Monitoring page in the Dashboard for at-a-glance status checks with no extra infrastructure.
  • A Prometheus scrape endpoint on the data plane for long-term storage, custom queries, and integration with Grafana or any Prometheus-compatible alerting stack.

Approach 1: Built-in Monitoring Page

The Dashboard's Monitoring section displays the most critical real-time metrics:

MetricDescription
QPSQueries per second, indicating the current load.
LatencyRequest processing time (average, p90, p99).
Error RateThe percentage of requests returning 4xx or 5xx status codes.
ThroughputInbound and outbound data volume.

To access this page, sign in to the Dashboard and navigate to Monitoring.

Approach 2: Prometheus Scrape Endpoint

For deep, historical monitoring and custom dashboards, enable the prometheus plugin as a global rule. The data plane then exposes metrics at http://<data-plane>:9091/apisix/prometheus/metrics for any Prometheus-compatible scraper.

Step 1: Enable the Prometheus Plugin Globally

curl -k "https://localhost:7443/apisix/admin/global_rules/prometheus?gateway_group_id={group_id}" -X PUT \
-H "X-API-KEY: ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"plugins": {
"prometheus": {}
}
}'

Step 2: Verify the Endpoint

Send a request through any route to generate metrics, then scrape the Prometheus endpoint on the data plane:

curl http://127.0.0.1:9091/apisix/prometheus/metrics

You should see Prometheus-formatted metrics including counters, gauges, and histograms emitted by the gateway. The 9091 port is the data plane's metrics listener; if you run the data plane in Docker, ensure the port is published to the host (-p 9091:9091) before scraping from outside the container.

Step 3: Configure Prometheus to Scrape

Add the data plane to your Prometheus scrape_configs. For example:

prometheus.yml
scrape_configs:
- job_name: api7-gateway
metrics_path: /apisix/prometheus/metrics
static_configs:
- targets:
- 127.0.0.1:9091

Key Metrics

When building dashboards or alerts, focus on these metrics emitted by the prometheus plugin:

  • apisix_http_status — counter of responses by status code (label code).
  • apisix_http_latency — histogram of request latency (label type distinguishes request, upstream, and apisix).
  • apisix_bandwidth — counter of bytes sent and received (label type).
  • apisix_nginx_http_current_connections — gauge of active connections (label state).

For the full list of metric names, label cardinality, and tuning options, see prometheus.

Additional Resources

API7.ai Logo

The digital world is connected by APIs,
API7.ai exists to make APIs more efficient, reliable, and secure.

Sign up for API7 newsletter

Product

API7 Gateway

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2026. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the Apache Software Foundation