# HuaweiService.apm
#### Scenario: Monitoring application performance data``监控应用性能数据``
| Description | Api | Reference |
---|---|---
Android: ANR data, startup data, screen data, HTTP/HTTPS network performance data, foreground and background activity data
``Android:ANR数据、启动数据、屏幕数据、HTTP/HTTPS网络性能数据、前台和后台活动数据``|Basic functions, no interface involved
``基础功能,不涉及接口``|
iOS: Application startup performance data, application screen performance data, HTTP/HTTPS network performance data.
``iOS:应用启动性能数据、应用屏幕性能数据、HTTP/HTTPS网络性能数据。``|Basic functions, no interface involved
``基础功能,不涉及接口``|
Web: page and network performance data.
``Web:页面和网络性能数据。``|Basic functions, no interface involved
``基础功能,不涉及接口``|
#### Scenario: Adding custom tracking records``添加自定义跟踪记录``
| Description | Api | Reference |
---|---|---
Creates a custom trace. traceName indicates the trace name.
``创建自定义跟踪记录;启动自定义跟踪;停止自定义跟踪记录,添加自定义属性,添加自定义指标``|createCustomTrace(String traceName) |[apms](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/apms)
Starts a custom trace.
``启动、停止自定义跟踪记录``|start()、stop() |[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
Sets the attribute names and values of a custom trace.
``设置自定义跟踪记录属性名称和属性值。``|putProperty(String propertyName, String propertyValue) |[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
Removes an existing attribute from a CustomTrace instance.
``从CustomTrace实例中移除已存在属性。`` |removeProperty(String propertyName) |[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
Obtains a custom attribute value.
``获取自定义属性值。``|getProperty(String propertyName)|[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
Adds an indicator value for a custom trace.
``增加自定义跟踪记录指标的指标值。`` |incrementMeasure(String measureName, long measureValue)|[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
Obtains an indicator value for a custom trace.
``获取自定义跟踪记录指标值。`` |getMeasure(String measureName)|[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
Adds an indicator for a custom trace.
``添加自定义跟踪记录指标。``|putMeasure(String measureName, long measureValue) |[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
Obtains all attributes of a custom trace.
``获取自定义跟踪记录的所有属性。`` |getTraceProperties() |[customtrace](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/customtrace)
#### Scenario: Time-consuming tracking method``跟踪方法耗时``
| Description | Api | Reference |
---|---|---
Creates a custom trace. traceName indicates the trace name.
``跟踪方法耗时``|@AddCustomTrace(name = "onCreateCustomTrace", enabled = true)|[apms](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/apms)
C# properties\[AddCustomTrace("onCreateCustomTrace", true)\]
#### Scenario: Adding monitoring indicators for specific network requests``添加针对特定网络请求的监控指标``
| Description | Api | Reference |
---|---|---
Creates a network request indicator instance to collect network performance data.
``创建网络请求指标实例,用于采集网络性能数据。``|createNetworkMeasure(String url, String httpMethod) |[apms](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/apms)
Sets the request start time/end time and reports network request indicators and custom attribute dat
``启动,停止网络请求指标``|start()、stop() |[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Sets the response code of a request.
``设置请求的响应码。``|setStatusCode(int statusCode)|[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Sets the request body size.
``设置请求体大小。``|setBytesSent(long btyesSent)|[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Sets the response body size.
``设置响应体大小。``|setBytesReceived(long bytesReceived) |[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Sets the response body type specified by contentType.
``设置响应体contentType类型。``|setContentType(String contentType)|[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Sets the custom attribute name and value of a network request.
``设置网络请求的自定义属性名称和属性值。`` |putProperty(String propertyName, String propertyValue)|[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Removes an existing attribute from a NetworkMeasure instance.
``从NetworkMeasure实例中移除已存在属性。`` |removeProperty(String propertyName)|[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Obtains all attributes from a NetworkMeasure instance.
``从NetworkMeasure实例中获取所有属性。``|getProperties()|[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
Obtains a custom attribute value.
``获取自定义属性值。``|getProperty(String propertyName)|[networkmeasure](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/networkmeasure)
#### Scenario: View debug log``查看调试日志``
| Description | Api | Reference |
---|---|---
View APM SDK logs
``查看APM SDK日志``|android:name="apms\_debug\_log\_enabled"
android:value="false" />|
View APM plugin log
``查看APM插件日志``|gradlew app:assembleDebug --debug --stacktrace |
#### Scenario: Disable ANR monitoring``停用ANR监控``
| Description | Api | Reference |
---|---|---
Sets whether to enable APM to collect performance monitoring data. If this parameter is set to false, APM stops collecting app performance data. The default value is true.
``启用ARM监控、停用ANR监控``|enableAnrMonitor(boolean enable)|[apms](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/apms)
#### Scenario: Disable APM performance monitoring``停用APM性能监控``
| Description | Api | Reference |
---|---|---
Sets whether to enable APM to collect performance monitoring data. If this parameter is set to false, APM stops collecting app performance data. The default value is true.
``启用APM监控、停用APM监控``|enableCollection(boolean enable)|[apms](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/apms)
#### Scenario: Scene frame rendering and loading performance monitoring``APM Game Plugin服务入口``
| Description | Api | Reference |
---|---|---
Start APM Game Plugin service.
``开始APM Game Plugin服务``|start()|
Stop APM Game Plugin service.
``停止APM Game Plugin服务``|stop()|
Start recording scene loading time.
``开始记录场景加载时间``|startLoadingScene(GameAttribute gameAttribute)|
Stop recording scene loading time.
``停止记录场景加载时间``|stopLoadingScene(string scene)|
Save current game properties.
``保存当前游戏属性``|setCurrentGameAttribute(GameAttribute gameAttribute)|
Set the reporting frequency of game performance data, unit: minute.
``设置游戏性能数据上报频率,单位:分钟``|setReportMinRate(int intervalMin)|
Whether to enable APM Game Plugin service.
``是否启用APM Game Plugin服务``|enableGamePlugin(boolean enabled)|