Cocos platform integrated AGC performance management (two)-performance management SDK integration

Cocos platform integrated AGC performance management (two)-performance management SDK integration

After mastering how to publish Cocos applications to Huawei AppGallery Connect (hereinafter referred to as AGC), you can monitor the performance data of Cocos applications through AGC integrated performance management. At present, the performance management SDK only supports the Android platform, and then take this as an example to experience the access process

Cocos Creator configuration

  1. Access the required AGC related services in the Cocos service panel. This time we select the performance management service and enable it.
    Insert picture description here

  2. After clicking Enable, it will jump to the association interface. Before accessing related services, you need to associate the App first, click the "Associate" button, and select Create in the pop-up box.
    Insert picture description here

  3. On the Cocos console that jumped to, create a new game according to personal needs.
    Insert picture description here

  4. After the creation is complete, you can return to the Cocos Creator interface to create a new one, refresh and select to associate the application.
    Insert picture description here

AGC configuration

  1. Log in to AppGallery Connect and find the previous article Cocos Platform Integrated AGC Performance Management (1) -Game App created in Cocos application release .

  2. Click "Quality-Performance Management", click "Open Service" in the upper right corner to activate the performance management service.
    Insert picture description here

  3. After opening the service, go back to the project setting interface and download the latest project configuration json file.
    Insert picture description here

  4. Put the json file just downloaded in the Setting folder of the Cocos project.
    Insert picture description here

Package and run

Due to the current performance management service of Huawei, there is no JS SDK, so if you want to see the performance data of the application, you need to package the application and install it on the Android device to run. The following describes the operation steps related to application packaging and running:

  1. Package the current Cocos application. In the Cocos menu panel, click Project -> Build Release -> select HUAWEI AppGallery Connect, and configure the corresponding package name.

Note: The configured package name needs to be consistent with the package name of the Huawei AGC console, that is, the package name in the json file in the previous step. Otherwise, a compilation error will be reported.
Insert picture description here

  1. After the build and compilation are successful, you can see the corresponding APK file in the project's \build\jsb-link\publish\android path.
    Insert picture description here

  2. To install the file on the Android device, you can directly use the adb install -r packageName.apk command to install in cmd.

  3. Open the application, click the relevant button, and check whether there is a log corresponding to APMS: The following log indicates the integrated function of the performance management service, and then you can go to the AGC interface to view the performance data.
    Insert picture description here

View application performance data

After the application is running, you can view the performance data of the application under the "Quality -> Performance Management" page on the AGC interface (you can view it after about 5 minutes after the application is running). For the specific content of each performance data, you can refer to the official document: View application performance data .
Insert picture description here

Performance management service function extension

Huawei's AGC performance management service, in addition to the basic application performance monitoring function, also provides the function of custom tracking parameters, which can easily monitor the performance in specific scenarios, such as application login scenarios, application pages without response for a long time, etc. .

  1. Custom tracking parameters:
huawei.agc.apms.apmsService.startCustomTrace("traceID");
  1. Set custom tracking record attribute name and attribute value:
huawei.agc.apms.apmsService.putCustomTraceProperty(traceID, pName, pValue);
  1. For each network request, create a network request indicator instance to collect network performance data:
let id = huawei.agc.apms.apmsService.initNetworkMeasure(url, "POST");
console.log("createNetworkMeasure, id = ", id);

For more details, please see:

Cocos integrated AGC performance management quick start:https://docs.cocos.com/creator/manual/zh/cocos-service/agc-apm.html

AGC Performance Management Development Document:https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-Guides/agc-apms-introduction

Cocos platform integrated AGC performance management (1)-Cocos application release:https://developer.huawei.com/consumer/cn/forum/topicview?fid=0101271690375130218&tid=0203359161844040878&pid=0303359161844040067


Original link:https://developer.huawei.com/consumer/cn/forum/topicview?tid=0203364307861000095&fid=0101271690375130218
Author: Drum Chao

Guess you like

Origin blog.51cto.com/14772288/2539628