Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AGCAPMSService

Hierarchy

Index

Properties

support

support: boolean

Methods

enableAnrMonitor

  • enableAnrMonitor(enable: boolean): void
  • en

    Sets whether to enable the ANR monitoring function. The default value is true, indicating that ANR monitoring is enabled, and data is reported. To disable ANR monitoring, set this parameter to false

    zh

    设置ANR监控开关。开关的默认值为true(打开),表示启用ANR监控并上报数据。如果需要停用ANR监控能力,可将开关值设为false(关闭)

    example
    huawei.agc.apms.apmsService.enableAnrMonitor(true);
    

    Parameters

    • enable: boolean

      enable

    Returns void

enableCollection

  • enableCollection(enable: boolean): void
  • en

    Enables or disables APM. The default value is true, indicating that APM app performance data collection is enabled. To disable app performance data collection of APM, set this parameter to false

    zh

    设置APM服务开关。开关的默认值为true(打开),表示启用APM应用性能数据采集。如果需要停用APM应用性能数据采集,可将开关值设为false(关闭)

    example
    huawei.agc.apms.apmsService.enableCollection(true);
    

    Parameters

    • enable: boolean

      enable

    Returns void

getCustomTraceMeasure

  • getCustomTraceMeasure(name: string, measureName: string): number
  • en

    Get custom tracking index values.

    zh

    获取自定义属性值

    example
    let traceID = "testTrace";
    let mName = "MeasureName";
    
    let measureValue = huawei.agc.apms.apmsService.getCustomTraceMeasure(traceID, mName);
    console.log("mValue = ", measureValue);
    

    Parameters

    • name: string

      Record name

    • measureName: string

      Custom record tracking indicator name

    Returns number

    Custom tracking index value

getCustomTraceProperties

  • getCustomTraceProperties(name: string): any
  • en

    Get all the attributes of the custom tracking record.

    zh

    获取自定义跟踪记录的所有属性

    example
    let traceID = "testTrace";
    
    let tProp = huawei.agc.apms.apmsService.getCustomTraceProperties(traceID);
    console.log("tProp = ", JSON.stringify(tProp));
    

    Parameters

    • name: string

      Record name

    Returns any

    Store all attribute key-value pairs

getCustomTraceProperty

  • getCustomTraceProperty(name: string, propertyName: string): string
  • en

    Get custom attribute values.

    zh

    获取自定义属性值

    example
    let traceID = "testTrace";
    let pName = "product";
    let propertValue = huawei.agc.apms.apmsService.getCustomTraceProperty(traceID, pName);
    console.log("pValue = ", propertValue);
    

    Parameters

    • name: string

      Record name

    • propertyName: string

      Custom attribute name

    Returns string

    Custom attribute value

getNetworkMeasureProperties

  • getNetworkMeasureProperties(id: string): any
  • en

    Get all attributes from the NetworkMeasure instance

    zh

    从 NetworkMeasure 实例中获取所有属性

    example
    let mProp = huawei.agc.apms.apmsService.getNetworkMeasureProperties(id);
    console.log("mProp = ", mProp);
    

    Parameters

    • id: string

      Network request id

    Returns any

    Store all attribute key-value pairs

getNetworkMeasureProperty

  • getNetworkMeasureProperty(id: string, propertyName: string): string
  • en

    Obtains a custom attribute value.

    zh

    从 NetworkMeasure 实例中获取指定属性

    example
    let pName = "propName";
    let nMeasure = huawei.agc.apms.apmsService.getNetworkMeasureProperty(id, pName);
    console.log("nMeasure = ", nMeasure);
    

    Parameters

    • id: string

      Network request id

    • propertyName: string

      Custom attribute name

    Returns string

    Custom attribute value

incrementCustomTraceMeasure

  • incrementCustomTraceMeasure(name: string, measureName: string, measureValue: number): void
  • en

    Increase the index value of the custom tracking index. If the indicator does not exist, a new indicator will be created. If the custom tracking record is not started or stopped, the interface does not take effect.

    zh

    增加自定义跟踪记录指标的指标值。如果指标不存在,将创建一个新指标。如果自定义跟踪记录未启动或已停止,接口不生效。

    example
    let traceID = "testTrace";
    let mName = "MeasureName";
    let mValue = 12000;
    
    huawei.agc.apms.apmsService.incrementCustomTraceMeasure (traceID, mName, mValue);
    

    Parameters

    • name: string

      Record name

    • measureName: string

      The name of the custom tracking indicator to increase the value of the indicator

    • measureValue: number

      Increased index value

    Returns void

initNetworkMeasure

  • initNetworkMeasure(url: string, httpMethod: string): string
  • en

    Create a network request indicator instance for collecting network performance data.

    zh

    创建网络请求指标实例,用于监控网络请求性能

    example
    let id = huawei.agc.apms.apmsService.initNetworkMeasure(url, "POST");
    console.log("createNetworkMeasure, id = ", id);
    

    Parameters

    • url: string

      Network request URL address.

    • httpMethod: string

      Request method, only supports GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS, TRACE or CONNECT methods.

    Returns string

    Current network request id

putCustomTraceMeasure

  • putCustomTraceMeasure(name: string, measureName: string, measureValue: number): void
  • en

    Add custom tracking metrics. If the indicator already exists, update the value of the indicator.

    zh

    添加自定义跟踪记录指标。如果指标已经存在,则更新指标的值

    example
    let traceID = "testTrace";
    let mName = "MeasureName";
    let mValue = 12000;
    
    huawei.agc.apms.apmsService.putCustomTraceMeasure (traceID, mName, mValue);
    

    Parameters

    • name: string

      Record name

    • measureName: string

      Custom record tracking metric name

    • measureValue: number

      Custom tracking index value

    Returns void

putCustomTraceProperty

  • putCustomTraceProperty(name: string, propertyName: string, propertyValue: string): void
  • en

    Set custom trace record attribute name and attribute value. Each CustomTrace instance can only set up to 5 custom attributes.

    zh

    设置自定义跟踪记录属性名称和属性值

    example
    let traceID = "testTrace";
    let pName = "product";
    let pValue = "food";
    
    huawei.agc.apms.apmsService.putCustomTraceProperty(traceID, pName, pValue);
    

    Parameters

    • name: string

      Record name

    • propertyName: string

      Custom attribute name can only be composed of Chinese, letters (not case sensitive), numbers and underscores, and the length is not more than 40 characters

    • propertyValue: string

      Custom attribute values can only be composed of Chinese, letters (not case sensitive), numbers, and underscores, and the length does not exceed 100 characters

    Returns void

putNetworkMeasureProperty

  • putNetworkMeasureProperty(id: string, propertyName: string, propertyValue: string): void
  • en

    Set the custom attribute name and attribute value of the network request. Each NetworkMeasure instance can only set up to 5 custom attributes.

    zh

    设置网络请求的自定义属性名称和属性值。每个 NetworkMeasure 实例最多只能设置 5 个自定义属性

    example
    var pName = "propName";
    var pValue = "12000";
    huawei.agc.apms.apmsService.putNetworkMeasureProperty(id, pName, pValue);
    

    Parameters

    • id: string

      Network request id

    • propertyName: string

      Custom attribute names can only be composed of Chinese, letters (not case sensitive), numbers, and underscores, and the length cannot exceed 40 characters

    • propertyValue: string

      Custom attribute values can only be composed of Chinese, letters (not case sensitive), numbers, and underscores, and the length cannot exceed 100 characters

    Returns void

removeCustomTraceProperty

  • removeCustomTraceProperty(name: string, propertyName: string): void
  • en

    Remove the existing attribute from the CustomTrace instance.

    zh

    从 CustomTrace 实例中移除已存在属性

    example
    let traceID = "testTrace";
    let pName = "product";
    
    huawei.agc.apms.apmsService.removeCustomTraceProperty(traceID, pName);
    

    Parameters

    • name: string

      Record name

    • propertyName: string

      The name of the attribute to be removed

    Returns void

removeNetworkMeasureProperty

  • removeNetworkMeasureProperty(id: string, propertyName: string): void
  • en

    Remove the existing attribute from the NetworkMeasure instance.

    zh

    从 NetworkMeasure 实例中移除已存在属性

    example
    var pName = "propName";
    huawei.agc.apms.apmsService.removeNetworkMeasureProperty(id, pName);
    

    Parameters

    • id: string

      Network request id

    • propertyName: string

      The name of the attribute to be removed

    Returns void

setNetworkMeasureBytesReceived

  • setNetworkMeasureBytesReceived(id: string, length: number): void
  • en

    Set the response body size

    zh

    设置响应体大小

    example
    huawei.agc.apms.apmsService.setNetworkMeasureBytesReceived(id, 10000);
    

    Parameters

    • id: string

      Network request id

    • length: number

      Response body size

    Returns void

setNetworkMeasureBytesSent

  • setNetworkMeasureBytesSent(id: string, length: number): void
  • en

    Set the request body size

    zh

    设置请求体大小

    example
    huawei.agc.apms.apmsService.setNetworkMeasureBytesSent(id, 10000);
    

    Parameters

    • id: string

      Network request id

    • length: number

      Request body size

    Returns void

setNetworkMeasureContentType

  • setNetworkMeasureContentType(id: string, contentType: string): void
  • en

    Set the response body contentType type

    zh

    设置响应体 contentType 类型

    example
    huawei.agc.apms.apmsService.setNetworkMeasureContentType(id, "contentType1");
    

    Parameters

    • id: string

      Network request id

    • contentType: string

      Response body contentType

    Returns void

setNetworkMeasureStatusCode

  • setNetworkMeasureStatusCode(id: string, statusCode: number): void
  • en

    Set the response code of the request

    zh

    设置请求的响应码

    example
    huawei.agc.apms.apmsService.setNetworkMeasureStatusCode(id, 500);
    

    Parameters

    • id: string

      Network request id

    • statusCode: number

      Request response status code

    Returns void

setUserIdentifier

  • setUserIdentifier(userIdentifier: string): void
  • en

    Binds a user ID to the reported data. When the performance data is reported, the user ID is also reported to facilitate fault locating

    zh

    为上报数据绑定用户标识,性能数据上报时会一并上报该用户标识,方便单用户问题定位

    example
    huawei.agc.apms.apmsService.setUserIdentifier("475f5afaxxxxx");
    

    Parameters

    • userIdentifier: string

      the identifier of the user

    Returns void

startCustomTrace

  • startCustomTrace(name: string): void
  • en

    Start custom tracking records

    zh

    启动自定义跟踪记录

    example
    huawei.agc.apms.apmsService.startCustomTrace("traceID");
    

    Parameters

    • name: string

      Record name

    Returns void

startNetworkMeasure

  • startNetworkMeasure(id: string): void
  • en

    Set the request start time

    zh

    设置请求开始时间

    example
    huawei.agc.apms.apmsService.startNetworkMeasure(id);
    

    Parameters

    • id: string

      Network request id

    Returns void

stopCustomTrace

  • stopCustomTrace(name: string): void
  • en

    Stop custom tracking records

    zh

    停止自定义跟踪记录

    example
    huawei.agc.apms.apmsService.stopCustomTrace("traceID");
    

    Parameters

    • name: string

      Record name

    Returns void

stopNetworkMeasure

  • stopNetworkMeasure(id: string): void
  • en

    Set the request end time, and report the network request indicators and custom attribute data.

    zh

    设置请求结束时间,并上报网络请求指标及自定义属性数据

    example
    huawei.agc.apms.apmsService.stopNetworkMeasure(id);
    

    Parameters

    • id: string

      Network request id

    Returns void

Generated using TypeDoc