Monitor Metrics
Monitor API7 Gateway metrics via the built-in Dashboard page or by scraping the Prometheus endpoint exposed by the data plane.
API7 Gateway provides two ways to monitor traffic:
- A built-in Monitoring page in API7 Dashboard for at-a-glance status checks with no extra infrastructure.
- A Prometheus-format endpoint on the data plane for inspecting raw gateway metrics. For Prometheus ingestion on the current release line, use DP Manager remote write.
Prerequisites
Approach 1: Built-in Monitoring Page
The Dashboard's Monitoring section displays the most critical real-time metrics:
| Metric | Description |
|---|---|
| QPS | Queries per second, indicating the current load. |
| Latency | Request processing time (average, p90, p99). |
| Error Rate | The percentage of requests returning 4xx or 5xx status codes. |
| Throughput | Inbound and outbound data volume. |
To access this page, sign in to the Dashboard and navigate to Monitoring.
Approach 2: Prometheus Scrape Endpoint
Enable the prometheus (opens in Plugin Hub docs) plugin as a global rule to expose raw metrics at http://<data-plane>:9091/apisix/prometheus/metrics. The current release line emits a duplicate metric family that Prometheus rejects, so use DP Manager remote write for ingestion until your gateway includes a fix.
Step 1: Enable the Prometheus Plugin Globally
curl -k "https://localhost:7443/apisix/admin/global_rules/prometheus?gateway_group_id={gateway_group_id}" -X PUT \
-H "X-API-KEY: ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"plugins": {
"prometheus": {}
}
}'global_rules:
prometheus: {}adc sync -f adc.yamlStep 2: Verify the Endpoint
Send a request through any route to generate metrics, then inspect the endpoint on the data plane:
curl http://127.0.0.1:9091/apisix/prometheus/metricsYou should see Prometheus-formatted metrics including counters, gauges, and histograms emitted by the gateway.
The metrics listener binds to 127.0.0.1 by default, so nothing outside the container or pod
can reach it — and publishing the port is not enough on its own. Running with -p 9091:9091
against the default configuration still refuses the connection, because Docker is forwarding to a
listener that only accepts loopback traffic from inside the container.
For a collector verified to accept the current endpoint, change the bind address in the
gateway's config.yaml and restart it:
plugin_attr:
prometheus:
export_addr:
ip: 0.0.0.0
port: 9091Then publish or expose the port as usual. Treat 9091 as an internal port: it is unauthenticated,
so restrict it to your monitoring network rather than exposing it alongside proxy traffic.
If you would rather not open it at all, the DP Manager's remote-write channel carries the same metrics without a direct scrape target — see Use an Existing Prometheus.
Step 3: Configure Prometheus to Scrape a Patched Gateway
Only use this scrape configuration after verifying that your gateway no longer emits duplicate metric families. Add the data plane to your Prometheus scrape_configs. For example:
scrape_configs:
- job_name: api7-gateway
metrics_path: /apisix/prometheus/metrics
static_configs:
- targets:
- 127.0.0.1:9091Key Metrics
When building dashboards or alerts, focus on these metrics emitted by the prometheus plugin:
apisix_http_status— counter of responses by status code (labelcode).apisix_http_latency— histogram of request latency (labeltypedistinguishesrequest,upstream, andapisix).apisix_bandwidth— counter of bytes sent and received (labeltype).apisix_nginx_http_current_connections— gauge of active connections (labelstate).
For the full list of metric names, label cardinality, and tuning options, see prometheus (opens in Plugin Hub docs). The data plane metrics above are only part of the picture: the control plane components (Dashboard, DP Manager, Developer Portal) expose their own Prometheus metrics on separate status ports, and AI Gateway adds a further apisix_llm_*/apisix_ai_cache_* family for AI request types — see the Metrics Catalog for the complete, per-component reference.
Additional Resources
- Metrics Catalog for every data-plane and control-plane metric family, including the control-plane-only
api7_dashboard_*/api7_dp_manager_*/api7_developer_portal_*/etcd_*series and the AI Gatewayapisix_llm_*/apisix_ai_cache_*families. - Configure Alerts based on metric thresholds.
- Configure Distributed Tracing to investigate latency spikes surfaced in the metrics.
- Configure Centralized Logging to correlate metric anomalies with log entries.
See Metrics Catalog for metric families, labels, and version-specific availability.