Skip to main content

Version: 3.10.x

a7-plugin-skywalking

Overview

The skywalking plugin integrates API7 EE with Apache SkyWalking for distributed tracing. It creates entry and exit spans for each request, reports them to SkyWalking OAP via HTTP, and enables service topology visualization and performance analysis.

When to Use

  • Trace requests across microservices via SkyWalking
  • Visualize service topology and dependency maps
  • Analyze per-route and per-service latency
  • Correlate traces with logs using skywalking-logger

Plugin Configuration Reference (Route/Service)

FieldTypeRequiredDefaultDescription
sample_rationumberNo1Sampling rate from 0.00001 to 1 (1 = trace all)

Global Configuration (Gateway Group)

In API7 EE, global settings like the SkyWalking endpoint are typically configured at the gateway group level.

FieldTypeDefaultDescription
service_namestring"APISIX"Service name in SkyWalking UI
service_instance_namestring"APISIX Instance Name"Instance name (use $hostname for dynamic)
endpoint_addrstringhttp://127.0.0.1:12800SkyWalking OAP HTTP endpoint
report_intervalinteger3Reporting interval in seconds

Step-by-Step: Enable SkyWalking Tracing

1. Ensure SkyWalking OAP is reachable

Verify your SkyWalking OAP server is running and accessible from the API7 EE gateway nodes.

2. Configure gateway group settings

Configure the skywalking plugin attributes in your API7 EE gateway group.

3. Enable on a route

Enable tracing for gateway group default:

a7 route create --gateway-group default -f - <<'EOF'
{
"id": "traced-api",
"uri": "/api/*",
"plugins": {
"skywalking": {
"sample_ratio": 1
}
},
"upstream": {
"type": "roundrobin",
"nodes": [{"host": "backend", "port": 8080, "weight": 1}]
}
}
EOF

4. Send a request and view traces

curl http://localhost:9080/api/hello

View traces in SkyWalking UI at the configured address.

Common Patterns

Partial sampling (production)

{
"plugins": {
"skywalking": {
"sample_ratio": 0.1
}
}
}

Traces 10% of requests. Sufficient for production traffic analysis without excessive overhead.

Trace-log correlation with skywalking-logger

{
"plugins": {
"skywalking": {
"sample_ratio": 1
},
"skywalking-logger": {
"endpoint_addr": "http://skywalking-oap:12800"
}
}
}

Associates access logs with trace IDs in the SkyWalking UI.

Enable globally via Global Rule

a7 global_rule create --gateway-group default -f - <<'EOF'
{
"id": "skywalking-global",
"plugins": {
"skywalking": {
"sample_ratio": 0.5
}
}
}
EOF

Span Structure

The plugin creates two spans per request:

  • entrySpan: From request arrival to response completion
  • exitSpan: From upstream call start to response received

Troubleshooting

SymptomCauseFix
No traces in SkyWalking UIWrong endpoint_addrVerify OAP is reachable from gateway nodes
Missing service in topologyservice_name mismatchCheck service name in gateway group config
High overheadsample_ratio: 1 in productionLower to 0.01-0.1 for high-traffic routes
Traces not correlatedBackend not instrumentedInstall SkyWalking agent in upstream services
Config not appliedWrong gateway group specifiedEnsure --gateway-group matches the desired cluster

Config Sync Example

version: "1"
gateway_group: default
routes:
- id: traced-api
uri: /api/*
plugins:
skywalking:
sample_ratio: 1
upstream:
type: roundrobin
nodes:
- host: backend
port: 8080
weight: 1

This page is generated from a7-plugin-skywalking/SKILL.md in the api7/a7 repository. Browse all skills on the AI Agent Skills page.

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