Skip to content

Latest commit

 

History

History
459 lines (292 loc) · 8.37 KB

Interaction_Tracking_for_Performance_Measurement_b2825ea.md

File metadata and controls

459 lines (292 loc) · 8.37 KB
loio
b2825eabd7bb43d79b475fee4194c609

Interaction Tracking for Performance Measurement

You can analyze the performance of your UI5 application by tracking the interaction that is performed on the UI.

Interaction in this context means a closed step in a sequence of actions that a user performs on the UI, for example, everything that happens between two clicks on two different buttons. The interaction tracking considers XHRs, loadings triggered via script tags and rendering aspects.

To start interaction tracking, use Interaction.setActive(true) from module sap/ui/performance/trace/Interaction. To map the interaction data to the data of sap/ui/performance/Measurement, you have to explicitly set sap-ui-measure=true.

To retrieve the result of the interaction measurement, use Interaction.getAll() from module sap/ui/performance/trace/Interaction. This returns an array of all interactions that occurred and their measurement.

You can use Interaction.filter from module sap/ui/performance/trace/Interaction to filter the interaction measurements according to a filter function (fnFilter).


Example of an Interaction Measurement

InteractionMeasurement = {
    id: uid()                   // interaction ID
    event: "click",             // event which triggered interaction - default is startup interaction
    trigger: "Button1",         // element ID
    component: "my.Component",  // component or app identifier
    start : 0,                  // interaction start
    end: 0,                     // interaction end
    navigation: 0,              // sum over all navigation times
    roundtrip: 0,               // time from first request sent to last received response end - without gaps and ignored overlap
    processing: 0,              // client processing time
    duration: 0,                // interaction duration
    requests: [],               // all requests (XHRs) that occured during the interaction
    measurements: [],           // sap/ui/performance/Measurement measurements
    sapStatistics: [],          // SAP Statistics for OData
    requestTime: 0,             // sum over all requests in the interaction
    networkTime: 0,             // request time minus server time from the sap-perf-fesrec header
    bytesSent: 0,               // sum over all requests bytes
    bytesReceived: 0,           // sum over all response bytes
    requestCompression: false,  // true if all responses have been sent gzipped - default is undefined
    busyIndication: 0           // summed BusyIndicator duration during this interaction
}

Properties of Interaction Measurements

Property

Type

Description

id

sap/base/util/uid

Interaction ID

event

String

Event type which triggered the interaction. Allowed types are:

  • mousedown

  • mouseup

  • click

  • keydown

  • keyup

  • keypress

  • touchstart

  • touchend

  • tap

  • mousewheel

  • scroll

trigger

String

ID of the element that triggered the action

component

String

ID of the app or name of the Component that contains the triggering element

appVersion

String

Application version as from App Descriptor

start

Number

Interaction start; always triggered by user interaction. From that point in time (timestamp), all information about request timings, rendering, etc. is collected.

end

Number

Interaction end; defined as start time plus duration.

navigation

Number

Navigation time for all requests, calculated as difference from startTime to connectEnd of a PerformanceTiming (in ms)

Requests that are started while another request is already in progress are ignored (see figure below).

roundtrip

Number

Roundtrip time for a request, calculated as difference from requestStart to responseEnd of a PerformanceTiming (in ms)

processing

Number

The client processing time (in ms) of an interaction, calculated by subtracting the navigation time for all requests and the sum of roundtrip times from the total processing duration.

duration

Number

The duration time (in ms) of an interaction including navigation and request times, calculated by subtracting the interaction start time from the interaction end time.

requests

PerformanceTiming[]

All requests that occurred during the interaction, taken from the NavigationTiming API

measurements

Measurement[]

Performance measurements (see Performance Measurement Using sap/ui/performance/Measurement Module)

sapStatistics

Object[]

Map of request URL to corresponding sap-statistics header as String ( format: { url: "https://somehost.com/sap/data...", statistics: "total=167,fw=167,app=0,gwtotal=167,gwhub=160,gwrfcoh=0,gwbe=7,gwapp=0,gwnongw=0" })

requestTime

Number

Sum over all request durations of this interaction, from startTime to responseEnd (in ms)

networkTime

Number

Average network time per request (in ms) that occurred during the interaction. Calculated using the sap-perf-fesrec header sent by the back end with each response; a network time of zero results if no header is available.

bytesSent

Number

Sum over all bytes sent with requests (content plus headers)

bytesReceived

Number

Sum over all bytes received with responses (content plus headers)

requestCompression

Boolean

Indicates if all requests during an interaction have been received in GNU zip format ("gzipped")

busyDuration

Number

Time during which a BusyIndicator was rendered and hence blocking the UI during an interaction


Calculation of Times

Related Information

API Reference: sap/ui/performance/Measurement

Performance Measurement Using sap/ui/performance/Measurement Module

NavigationTiming API on https://developer.mozilla.org

Navigation Timing on https://www.w3.org/