MediaWiki  1.28.0
SamplingStatsdClient Class Reference

A statsd client that applies the sampling rate to the data items before sending them. More...

Inheritance diagram for SamplingStatsdClient:
Collaboration diagram for SamplingStatsdClient:

Public Member Functions

 appendSampleRate ($data, $sampleRate=1)
 Sets sampling rate for all items in $data. More...
 
 send ($data, $sampleRate=1)
 
 setSamplingRates (array $samplingRates)
 Sampling rates as an associative array of patterns and rates. More...
 

Protected Member Functions

 sampleData ($data)
 Throw away some of the data according to the sample rate. More...
 
 throwException (Exception $exception)
 

Protected Attributes

 $samplingRates = []
 

Detailed Description

A statsd client that applies the sampling rate to the data items before sending them.

Since
1.26

Definition at line 32 of file SamplingStatsdClient.php.

Member Function Documentation

SamplingStatsdClient::appendSampleRate (   $data,
  $sampleRate = 1 
)

Sets sampling rate for all items in $data.

The sample rate specified in a StatsdData entity overrides the sample rate specified here.

Definition at line 52 of file SamplingStatsdClient.php.

References $samplingRates, as, and use.

Referenced by send().

SamplingStatsdClient::sampleData (   $data)
protected

Throw away some of the data according to the sample rate.

Parameters
StatsdDataInterface[]$data
Returns
StatsdDataInterface[]
Exceptions
LogicException

Definition at line 131 of file SamplingStatsdClient.php.

References as.

Referenced by send().

SamplingStatsdClient::send (   $data,
  $sampleRate = 1 
)

Definition at line 82 of file SamplingStatsdClient.php.

References $e, appendSampleRate(), as, sampleData(), and throwException().

SamplingStatsdClient::setSamplingRates ( array  $samplingRates)

Sampling rates as an associative array of patterns and rates.

Patterns are Unix shell patterns (e.g. 'MediaWiki.api.*'). Rates are sampling probabilities (e.g. 0.1 means 1 in 10 events are sampled).

Parameters
array$samplingRates
Since
1.28

Definition at line 42 of file SamplingStatsdClient.php.

References $samplingRates.

SamplingStatsdClient::throwException ( Exception  $exception)
protected

Definition at line 152 of file SamplingStatsdClient.php.

Referenced by send().

Member Data Documentation

SamplingStatsdClient::$samplingRates = []
protected

Definition at line 33 of file SamplingStatsdClient.php.

Referenced by appendSampleRate(), and setSamplingRates().


The documentation for this class was generated from the following file: