MediaWiki REL1_33
BufferingStatsdDataFactory Class Reference

A factory for application metric data. More...

Inheritance diagram for BufferingStatsdDataFactory:
Collaboration diagram for BufferingStatsdDataFactory:

Public Member Functions

 __construct ( $prefix)
 
 clearData ()
 Clear all buffered data from the factory.
 
 getBuffer ()
 
 getData ()
 
 getDataCount ()
 Return the number of buffered statsd data entries.
 
 hasData ()
 Check whether this data factory has any buffered data.
 
 produceStatsdData ( $key, $value=1, $metric=StatsdDataInterface::STATSD_METRIC_COUNT)
 
 setEnabled ( $enabled)
 Set collection enable status.
 

Protected Attributes

 $buffer = []
 
bool $enabled = true
 Collection enabled?
 

Static Private Member Functions

static normalizeMetricKey ( $key)
 Normalize a metric key for StatsD.
 

Private Attributes

string $prefix
 

Detailed Description

A factory for application metric data.

This class prepends a context-specific prefix to each metric key and keeps a reference to each constructed metric in an internal array buffer.

Since
1.25

Definition at line 35 of file BufferingStatsdDataFactory.php.

Constructor & Destructor Documentation

◆ __construct()

BufferingStatsdDataFactory::__construct ( $prefix)

Definition at line 47 of file BufferingStatsdDataFactory.php.

References $prefix.

Member Function Documentation

◆ clearData()

BufferingStatsdDataFactory::clearData ( )

Clear all buffered data from the factory.

Since
1.31

Implements IBufferingStatsdDataFactory.

Definition at line 115 of file BufferingStatsdDataFactory.php.

◆ getBuffer()

BufferingStatsdDataFactory::getBuffer ( )
Deprecated
since 1.30 Use getData() instead
Returns
StatsdData[]

Definition at line 98 of file BufferingStatsdDataFactory.php.

References $buffer, and wfDeprecated().

◆ getData()

BufferingStatsdDataFactory::getData ( )
Since
1.30
Returns
StatsdData[]

Implements IBufferingStatsdDataFactory.

Definition at line 111 of file BufferingStatsdDataFactory.php.

References $buffer.

◆ getDataCount()

BufferingStatsdDataFactory::getDataCount ( )

Return the number of buffered statsd data entries.

Returns
int
Since
1.31

Implements IBufferingStatsdDataFactory.

Definition at line 119 of file BufferingStatsdDataFactory.php.

◆ hasData()

BufferingStatsdDataFactory::hasData ( )

Check whether this data factory has any buffered data.

Returns
bool

Implements IBufferingStatsdDataFactory.

Definition at line 103 of file BufferingStatsdDataFactory.php.

◆ normalizeMetricKey()

static BufferingStatsdDataFactory::normalizeMetricKey ( $key)
staticprivate

Normalize a metric key for StatsD.

Replace occurences of '::' with dots and any other non-alphanumeric characters with underscores. Combine runs of dots or underscores. Then trim leading or trailing dots or underscores.

Parameters
string$key
Since
1.26
Returns
string

Definition at line 63 of file BufferingStatsdDataFactory.php.

References and().

Referenced by produceStatsdData().

◆ produceStatsdData()

BufferingStatsdDataFactory::produceStatsdData ( $key,
$value = 1,
$metric = StatsdDataInterface::STATSD_METRIC_COUNT )

Definition at line 70 of file BufferingStatsdDataFactory.php.

References $value, and(), and normalizeMetricKey().

◆ setEnabled()

BufferingStatsdDataFactory::setEnabled ( $enabled)

Set collection enable status.

Parameters
bool$enabledWill collection be enabled?
Returns
void

Implements IBufferingStatsdDataFactory.

Definition at line 123 of file BufferingStatsdDataFactory.php.

References $enabled.

Member Data Documentation

◆ $buffer

BufferingStatsdDataFactory::$buffer = []
protected

Definition at line 36 of file BufferingStatsdDataFactory.php.

Referenced by getBuffer(), and getData().

◆ $enabled

bool BufferingStatsdDataFactory::$enabled = true
protected

Collection enabled?

Definition at line 41 of file BufferingStatsdDataFactory.php.

Referenced by setEnabled().

◆ $prefix

string BufferingStatsdDataFactory::$prefix
private

Definition at line 45 of file BufferingStatsdDataFactory.php.

Referenced by __construct().


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