Commit c171fbf
authored
Implement SWIP-12: WeChat & Alipay Mini Program monitoring (#13835)
## Implement SWIP-12: WeChat & Alipay Mini Program monitoring (#13835)
Adds end-to-end OAP support for WeChat and Alipay Mini Program observability via the
[SkyAPM mini-program-monitor](https://github.com/SkyAPM/mini-program-monitor) SDK. Both
runtimes report through standard OTLP (metrics + logs) plus SkyWalking native trace
segments — no new receivers, no new SPIs.
### Highlights
- Two new layers: `WECHAT_MINI_PROGRAM(48)` and `ALIPAY_MINI_PROGRAM(49)`.
- Two new JavaScript component ids registered in `component-libraries.yml`:
`WeChat-MiniProgram(10002)` and `AliPay-MiniProgram(10003)`.
- Mini-program services / instances / endpoints are produced by **MAL** (OTLP metrics)
and **LAL** (OTLP logs) — not by trace analysis. Client-side (exit-only) segments
flow through the standard `RPCAnalysisListener` pipeline unchanged, same pattern as
browser and iOS layers; `service_cpm` / `service_resp_time` / `endpoint_cpm` do not
populate under mini-program layers by design.
- One MAL enhancement applies generally: `TimeUnit` added to `MALCodegenHelper.ENUM_FQCN`
so rule YAML can write `.histogram("le", TimeUnit.MILLISECONDS)` for SDKs that emit
bucket bounds in ms (e.g. mini-program's `miniprogram.request.duration`).
### OAP server
- `Layer.java`: add `WECHAT_MINI_PROGRAM(48, true)` and `ALIPAY_MINI_PROGRAM(49, true)`.
- `component-libraries.yml`: register `WeChat-MiniProgram: 10002`, `AliPay-MiniProgram: 10003`.
- `MALCodegenHelper.ENUM_FQCN`: register `TimeUnit → java.util.concurrent.TimeUnit`.
- Four MAL rule files under `otel-rules/miniprogram/` — per-platform × per-scope:
- `wechat-mini-program.yaml` (service + endpoint variants)
- `wechat-mini-program-instance.yaml`
- `alipay-mini-program.yaml` (subset — Alipay lacks `route` / `script` / `packageLoad` / `first_paint`)
- `alipay-mini-program-instance.yaml`
- Top-level `filter` gates each file to the correct `miniprogram.platform`.
- Each rule explicitly chains `.service(...)` / `.endpoint(...)` — `expSuffix` stays
empty in the mixed-scope files so a tail `.service(...)` does not override the
endpoint scope (APISIX pattern).
- Histogram percentile rule uses `.histogram("le", TimeUnit.MILLISECONDS)` so the
bucket-family `le` labels are kept in ms (no default SECONDS × 1000 rescale).
- `request_cpm` metric is derived from the histogram's `_count` family via `.sum()`
(DELTA temporality — MAL's per-minute bucketing sums per-flush counts directly,
no `.rate()` / `.increase()` needed).
- One LAL rule `lal/miniprogram.yaml` using `layer: auto` — one file produces both
layers via `sourceAttribute("miniprogram.platform")` dispatch. Extractor emits a
`miniprogram_error_count` counter sample per error log.
- Two log-MAL rules for `error_count`:
- `log-mal-rules/miniprogram-wechat.yaml` — gated on `miniprogram_platform == 'wechat'`
- `log-mal-rules/miniprogram-alipay.yaml` — gated on `miniprogram_platform == 'alipay'`
- Split into two files because `Rules.loadRules` uses `Yaml.loadAs` (single-document).
- `application.yml` defaults updated:
- `enabledOtelMetricsRules` appends `miniprogram/*`
- `lalFiles` appends `miniprogram`
- `malFiles` appends `miniprogram-wechat,miniprogram-alipay`
- `test/e2e-v2/cases/storage/expected/config-dump.yml` mirrored.
### UI
- Menu (`ui-initialized-templates/menu.yaml`): two new entries under the existing
`Mobile` group — `WeChat Mini Program` and `Alipay Mini Program`. i18n keys
`mobile_wechat_mini_program` / `mobile_alipay_mini_program` are pending in a
follow-up `apache/skywalking-booster-ui` PR; the keys fall back to the raw YAML
`title` until that lands.
- Eight new dashboard JSONs:
- `wechat_mini_program/{root,service,instance,endpoint}.json`
- `alipay_mini_program/{root,service,instance,endpoint}.json`
- Each root uses `isRoot: true` with a `ServiceList` widget (4 metric columns).
- Service dashboard uses a `Tab` with Overview / Instance / Endpoint / Trace / Log
sub-tabs. Alipay service dashboard omits the WeChat-only perf widgets.
### Docs
- `docs/en/setup/backend/backend-wechat-mini-program-monitoring.md` and
`backend-alipay-mini-program-monitoring.md`: user-facing setup guides covering
prerequisites (SDK ≥ v0.4.0), OAP configuration, SDK init snippet, metric catalog,
error-log categories, entity model (incl. the `serviceInstance == serviceVersion`
operator recommendation), SDK-version compatibility, and platform-specific
limitations.
- `docs/menu.yml`: two new entries under `Mobile Monitoring`.
- `docs/en/changes/changes.md`: entries under `#### OAP Server` and `#### Documentation`.
### Tests
- Two new e2e cases under `test/e2e-v2/cases/miniprogram/{wechat,alipay}/` drive the
published `ghcr.io/skyapm/mini-program-monitor/sim-{wechat,alipay}:v0.4.1` image in
`MODE=timed DURATION_MS=60000 SCENARIO=demo` against OAP wired with the new rules.
WeChat: 11 verify cases (service under layer, service/instance/endpoint perf gauges,
request_cpm, request_duration_percentile, error_count, LAL-persisted logs). Alipay:
8 verify cases (subset matching Alipay's metric surface).
- Listener unit tests (`RPCAnalysisListenerTest`,
`EndpointDepFromCrossThreadAnalysisListenerTest`) are unchanged from master
semantics.
### Follow-ups
- `apache/skywalking-booster-ui` PR for `mobile_wechat_mini_program` /
`mobile_alipay_mini_program` i18n keys (menu labels fall back until this lands).
- Submodule bump once booster-ui PR lands.1 parent 681a5be commit c171fbf
File tree
41 files changed
+2646
-84
lines changed- .claude/skills
- new-monitoring-feature
- run-e2e
- .github/workflows
- docs
- en
- changes
- setup/backend
- swip
- oap-server
- analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/v2/compiler
- server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis
- server-starter/src/main/resources
- lal
- log-mal-rules
- otel-rules/miniprogram
- ui-initialized-templates
- alipay_mini_program
- wechat_mini_program
- test/e2e-v2/cases
- miniprogram
- alipay
- expected
- wechat
- expected
- storage/expected
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+2646
-84
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
| |||
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
66 | 104 | | |
67 | 105 | | |
68 | 106 | | |
| |||
112 | 150 | | |
113 | 151 | | |
114 | 152 | | |
115 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
116 | 156 | | |
117 | 157 | | |
118 | 158 | | |
| |||
169 | 209 | | |
170 | 210 | | |
171 | 211 | | |
| 212 | + | |
| 213 | + | |
172 | 214 | | |
173 | 215 | | |
174 | 216 | | |
| |||
227 | 269 | | |
228 | 270 | | |
229 | 271 | | |
230 | | - | |
| 272 | + | |
231 | 273 | | |
232 | 274 | | |
233 | 275 | | |
| |||
250 | 292 | | |
251 | 293 | | |
252 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
253 | 307 | | |
254 | 308 | | |
255 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
200 | 221 | | |
201 | 222 | | |
202 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
645 | 649 | | |
646 | 650 | | |
647 | 651 | | |
| |||
0 commit comments