KPI
in package
A Key Performance Indicator (KPI) logging class.
Tags
Table of Contents
Properties
- $duration : float
- The duration in seconds.
- $endTime : float
- The end time of the KPI event (UNIX timestamp in seconds).
- $name : SmallText
- The name of the KPI.
- $sessionID : string
- The session ID of the current HTTP session.
- $startTime : float
- The start time of the KPI event (UNIX timestamp in seconds).
- $timeStamp : Timestamp
- The date/time of the KPI event.
Methods
- __construct() : mixed
- Constructor.
- log() : void
- Writes the KPI event to a log file named logs/kpi-'.$this->name->getValue().'.csv, which will be created if it does not exist.
- logStep() : void
- Writes a step in the KPI event to a log file named logs/kpi-'.$this->name->getValue().'.csv, which will be created if it does not exist.
- storeStartTimeInSession() : void
- Stores the current startTime for the KPI in the session, useful for multi-request KPI tracking.
Properties
$duration
The duration in seconds.
private
float
$duration
Tags
$endTime
The end time of the KPI event (UNIX timestamp in seconds).
private
float
$endTime
Tags
$name
The name of the KPI.
private
SmallText
$name
Tags
$sessionID
The session ID of the current HTTP session.
private
string
$sessionID
Tags
$startTime
The start time of the KPI event (UNIX timestamp in seconds).
private
float
$startTime
Tags
$timeStamp
The date/time of the KPI event.
private
Timestamp
$timeStamp
Tags
Methods
__construct()
Constructor.
public
__construct(string $name) : mixed
Parameters
- $name : string
-
The name of the KPI which is used in the log files, must only be letters and/or numbers.
Tags
log()
Writes the KPI event to a log file named logs/kpi-'.$this->name->getValue().'.csv, which will be created if it does not exist.
public
log() : void
Tags
logStep()
Writes a step in the KPI event to a log file named logs/kpi-'.$this->name->getValue().'.csv, which will be created if it does not exist.
public
logStep(mixed $stepName) : void
Parameters
- $stepName : mixed
Tags
storeStartTimeInSession()
Stores the current startTime for the KPI in the session, useful for multi-request KPI tracking.
public
storeStartTimeInSession() : void