Back to Skywalking

APISIX monitoring

docs/en/setup/backend/backend-apisix-monitoring.md

11.0.07.3 KB
Original Source

APISIX monitoring

APISIX performance metrics

SkyWalking uses the OpenTelemetry Collector to transfer metrics exported by the Apache APISIX prometheus plugin to the SkyWalking OpenTelemetry receiver. The OAP Server then processes the metrics with Meter Analysis Language rules.

Data flow

  1. The APISIX prometheus plugin exports APISIX metrics.
  2. The OpenTelemetry Collector Prometheus receiver scrapes the APISIX metrics endpoint and sends the metrics to the SkyWalking OAP Server through OTLP.
  3. The OAP Server applies the APISIX MAL rules and stores the resulting service, instance, and endpoint metrics.

Set up

  1. Enable the APISIX prometheus plugin.
  2. Configure the OpenTelemetry Collector Prometheus receiver to scrape the APISIX metrics endpoint. The APISIX E2E test provides a repository-local Collector configuration.
  3. Configure the SkyWalking OpenTelemetry receiver.

APISIX entities in SkyWalking

The APISIX MAL rule creates a service in the APISIX layer. APISIX data-plane nodes are represented as instances. Matched routes and upstream nodes are represented as endpoints with route/ and upstream/ prefixes.

Specify the SkyWalking service name

The APISIX MAL rule reads the skywalking_service label and prefixes the resulting service name with APISIX::. Add the label through static_configs in the Collector Prometheus receiver:

yaml
receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: apisix-monitoring
          metrics_path: /apisix/prometheus/metrics
          static_configs:
            - targets:
                - apisix:9091
              labels:
                skywalking_service: example_service_name

Keep job_name: apisix-monitoring unless you also update the APISIX MAL filter in OAP. If skywalking_service is absent or blank, the MAL rule uses APISIX, resulting in the default service name APISIX::APISIX.

Do not use the OpenTelemetry service.name resource attribute to name the service. The Collector's Prometheus receiver converts the Prometheus job label into service.name, and the SkyWalking OpenTelemetry receiver maps service.name back to job_name — the very label the APISIX MAL rule filters on. Setting service.name therefore changes the filter key rather than the service name, and the rule stops matching, so no APISIX metrics are produced. skywalking_service exists precisely because service.name is already taken.

Supported metrics

Monitoring PanelUnitMetric NameCatalogDescriptionData Source
HTTP Request Trendmeter_apisix_sv_http_requestsServiceRequest rate across the APISIX serviceAPISIX Prometheus plugin
HTTP Connectionsmeter_apisix_sv_http_connectionsServiceCurrent connections grouped by stateAPISIX Prometheus plugin
HTTP Status Trendmeter_apisix_sv_http_status_matchedServiceMatched request rate grouped by HTTP status codeAPISIX Prometheus plugin
HTTP Latencymsmeter_apisix_sv_http_latency_matchedServiceMatched request latency grouped by type and percentileAPISIX Prometheus plugin
HTTP BandwidthKBmeter_apisix_sv_bandwidth_matchedServiceMatched ingress and egress bandwidthAPISIX Prometheus plugin
Non-matched Status Trendmeter_apisix_sv_http_status_unmatchedServiceNon-matched request rate grouped by HTTP status codeAPISIX Prometheus plugin
Non-matched Latencymsmeter_apisix_sv_http_latency_unmatchedServiceRequest latency for traffic that did not match a routeAPISIX Prometheus plugin
Non-matched BandwidthKBmeter_apisix_sv_bandwidth_unmatchedServiceBandwidth for traffic that did not match a routeAPISIX Prometheus plugin
HTTP Request Trendmeter_apisix_instance_http_requestsInstanceRequest rate for an APISIX data-plane nodeAPISIX Prometheus plugin
HTTP Connectionsmeter_apisix_instance_http_connectionsInstanceCurrent connections for a node, grouped by stateAPISIX Prometheus plugin
HTTP Status Trendmeter_apisix_instance_http_status_matchedInstanceMatched request rate for a node, grouped by HTTP status codeAPISIX Prometheus plugin
HTTP Latencymsmeter_apisix_instance_http_latency_matchedInstanceMatched request latency for a nodeAPISIX Prometheus plugin
HTTP BandwidthKBmeter_apisix_instance_bandwidth_matchedInstanceMatched ingress and egress bandwidth for a nodeAPISIX Prometheus plugin
Shared DictMBmeter_apisix_instance_shared_dict_capacity_bytesInstanceShared dictionary capacity for a nodeAPISIX Prometheus plugin
Shared DictMBmeter_apisix_instance_shared_dict_free_space_bytesInstanceFree shared dictionary space for a nodeAPISIX Prometheus plugin
etcd Reachablemeter_apisix_instance_etcd_reachableInstanceWhether a node can reach etcdAPISIX Prometheus plugin
etcd Indexesmeter_apisix_instance_etcd_indexesInstanceLatest etcd modification index observed by a nodeAPISIX Prometheus plugin
Non-matched Trafficmeter_apisix_instance_http_status_unmatchedInstanceNon-matched request rate for a node, grouped by HTTP status codeAPISIX Prometheus plugin
Non-matched Trafficmsmeter_apisix_instance_http_latency_unmatchedInstanceNon-matched request latency for a nodeAPISIX Prometheus plugin
Non-matched TrafficKBmeter_apisix_instance_bandwidth_unmatchedInstanceNon-matched bandwidth for a nodeAPISIX Prometheus plugin
HTTP Status Trendmeter_apisix_endpoint_http_statusEndpointRequest rate for a route or upstream node, grouped by HTTP status codeAPISIX Prometheus plugin
HTTP Latencymsmeter_apisix_endpoint_http_latencyEndpointRequest latency for a route or upstream nodeAPISIX Prometheus plugin
HTTP BandwidthKBmeter_apisix_endpoint_bandwidthEndpointIngress and egress bandwidth for a route or upstream nodeAPISIX Prometheus plugin

For Dashboard widget semantics and display units, see the Horizon UI APISIX Dashboard reference.

Customizations

The APISIX metric definitions and expressions are in /config/otel-rules/apisix.yaml of your OAP installation. In the source tree the same file is oap-server/server-starter/src/main/resources/otel-rules/apisix.yaml.

Each metric name in the table above is the rule's metricPrefix (meter_apisix) joined to the name of its entry in that file — the entry named sv_http_requests produces meter_apisix_sv_http_requests.

The Horizon UI bundled APISIX Dashboard is maintained in the apache/skywalking-horizon-ui repository; the OAP backend no longer hosts the UI Dashboard JSON.