MediaWiki master
Wikimedia\Stats\SamplingStatsdClient Class Reference

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

Inherits StatsdClient.

Collaboration diagram for Wikimedia\Stats\SamplingStatsdClient:

Public Member Functions

 appendSampleRate ( $data, $sampleRate=1)
 Sets sampling rate for all items in $data.
 
 send ( $data, $sampleRate=1)
 Send the metrics over UDP Sample the metrics according to their sample rate and send the remaining ones.
 
 setSamplingRates (array $samplingRates)
 Sampling rates as an associative array of patterns and rates.
 

Protected Member Functions

 sampleData ( $data)
 Throw away some of the data according to the sample rate.
 

Protected Attributes

array $samplingRates = []
 

Detailed Description

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

Deprecated
since 1.43 No longer used after $wgSamplingStatsdClient was removed.
Since
1.26

Definition at line 39 of file SamplingStatsdClient.php.

Member Function Documentation

◆ appendSampleRate()

Wikimedia\Stats\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 60 of file SamplingStatsdClient.php.

References Wikimedia\Stats\SamplingStatsdClient\$samplingRates.

Referenced by Wikimedia\Stats\SamplingStatsdClient\send().

◆ sampleData()

Wikimedia\Stats\SamplingStatsdClient::sampleData ( $data)
protected

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

Parameters
StatsdDataInterface[]$data
Returns
StatsdDataInterface[]

Definition at line 140 of file SamplingStatsdClient.php.

Referenced by Wikimedia\Stats\SamplingStatsdClient\send().

◆ send()

Wikimedia\Stats\SamplingStatsdClient::send ( $data,
$sampleRate = 1 )

Send the metrics over UDP Sample the metrics according to their sample rate and send the remaining ones.

Parameters
StatsdDataInterface | StatsdDataInterface[]$datamessage(s) to sent strings are not allowed here as sampleData requires a StatsdDataInterface
int$sampleRate
Returns
int the data sent in bytes

Definition at line 90 of file SamplingStatsdClient.php.

References Wikimedia\Stats\SamplingStatsdClient\appendSampleRate(), and Wikimedia\Stats\SamplingStatsdClient\sampleData().

◆ setSamplingRates()

Wikimedia\Stats\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 50 of file SamplingStatsdClient.php.

References Wikimedia\Stats\SamplingStatsdClient\$samplingRates.

Member Data Documentation

◆ $samplingRates

array Wikimedia\Stats\SamplingStatsdClient::$samplingRates = []
protected

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