Jump to top

HttpMetric

interface

Metric used to collect data for network requests/responses. A new instance must be used for every request/response.

Methods

getAttribute

</>

Returns the value of an attribute. Returns null if it does not exist.

getAttribute(attribute: string): string | null;

getAttributes

</>

Returns an object of all the currently added attributes.

getAttributes(): { [key: string]: string };

putAttribute

</>

Sets a String value for the specified attribute. Updates the value of the attribute if it already exists. The maximum number of attributes that can be added is 5.

putAttribute(attribute: string, value: string): void;

removeAttribute

</>

Removes an already added attribute. Does nothing if attribute does not exist.

removeAttribute(attribute: string): void;

setHttpResponseCode

</>

Sets the httpResponse code of the request.

setHttpResponseCode(code: number | null): void;

setRequestPayloadSize

</>

Sets the size of the request payload.

setRequestPayloadSize(bytes: number | null): void;

setResponseContentType

</>

Content type of the response e.g. text/html or application/json.

setResponseContentType(contentType: string | null): void;

setResponsePayloadSize

</>

Sets the size of the response payload.

setResponsePayloadSize(bytes: number | null): void;

start

</>

Marks the start time of the request. Does nothing if already started.

start(): Promise<null>;

stop

</>

Marks the end time of the response and queues the network request metric on the device for transmission. Does nothing if already stopped.

stop(): Promise<null>;