WeChat API
Background
To build a more powerful Mini Program ecosystem and simplify Mini Program development, WeChat officially provides a rich set of API interfaces, including login, payment, scanning, and more. These official WeChat interfaces are often critical capabilities that directly affect the normal operation of business. For example, the payment interface may fail due to WeChat official interface exceptions or incorrect payment parameters returned by the merchant's order system, making monitoring the success rate of WeChat interface calls essential.
Support Information
Default Monitored Interfaces
By default, the payment interface (requestPayment), scanning interface (scanCode), and full-screen image preview (previewImage) are automatically monitored. Users only need to use the agent version 1.2.0 or above to automatically collect data.
Custom Monitored Interfaces
This module can monitor all Mini Program APIs provided by WeChat. Users can specify which interfaces they want to monitor (without the wx. prefix) through the hookApis configuration during agent initialization based on their needs.
Example (monitoring only the requestPayment interface):
const monitor = require('./agent/tingyun-mp-agent.js');
monitor.config({
...,
hookApis: ['requestPayment']
})
Note:
-
For the
requestinterface, it is monitored by a separate request module, and this configuration will be ignored. -
Custom monitored interfaces can only track success and failure counts when success and fail callbacks are provided; otherwise, only the call count can be monitored.
Metrics Description
| Metric Name | Definition |
|---|---|
| Interface Call Count | Number of times the interface is called |
| Interface Call Success Rate | (Number of successful interface calls / Total number of interface calls) * 100% |
| Affected User Count | Number of users who experienced at least one failure when calling the interface during their Mini Program session (from opening to actively closing or timing out). |
| Failed User Count | Number of users who never successfully called the interface during their Mini Program session, having failed in one or more attempts until leaving. |
Report Description
Interface List
The list displays the interface name, call count, error count, success rate, affected user count, and failed user count. Users can search by interface name and sort by various metrics.
Interface Details
This module displays the analysis of interface call details, including the interface call success rate trend and records of each interface call request. Users can search by user ID or IP to query call records.
-
Details List
Displays user details for interface calls, including three types: success, failure, and cancellation.