MediaWiki REL1_31
|
A factory for application metric data. More...
Public Member Functions | |
__construct ( $prefix) | |
clearData () | |
Clear all buffered data from the factory. | |
getBuffer () | |
getData () | |
Return the buffered data from the factory. | |
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 |
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.
Definition at line 35 of file BufferingStatsdDataFactory.php.
BufferingStatsdDataFactory::__construct | ( | $prefix | ) |
Definition at line 47 of file BufferingStatsdDataFactory.php.
References $prefix.
BufferingStatsdDataFactory::clearData | ( | ) |
Clear all buffered data from the factory.
Implements IBufferingStatsdDataFactory.
Definition at line 110 of file BufferingStatsdDataFactory.php.
BufferingStatsdDataFactory::getBuffer | ( | ) |
Definition at line 98 of file BufferingStatsdDataFactory.php.
References $buffer.
BufferingStatsdDataFactory::getData | ( | ) |
Return the buffered data from the factory.
Implements IBufferingStatsdDataFactory.
Definition at line 106 of file BufferingStatsdDataFactory.php.
References $buffer.
BufferingStatsdDataFactory::getDataCount | ( | ) |
Return the number of buffered statsd data entries.
Implements IBufferingStatsdDataFactory.
Definition at line 114 of file BufferingStatsdDataFactory.php.
BufferingStatsdDataFactory::hasData | ( | ) |
Check whether this data factory has any buffered data.
Implements IBufferingStatsdDataFactory.
Definition at line 102 of file BufferingStatsdDataFactory.php.
|
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.
string | $key |
Definition at line 63 of file BufferingStatsdDataFactory.php.
Referenced by produceStatsdData().
BufferingStatsdDataFactory::produceStatsdData | ( | $key, | |
$value = 1, | |||
$metric = StatsdDataInterface::STATSD_METRIC_COUNT ) |
Definition at line 70 of file BufferingStatsdDataFactory.php.
References $value, and normalizeMetricKey().
BufferingStatsdDataFactory::setEnabled | ( | $enabled | ) |
Set collection enable status.
bool | $enabled | Will collection be enabled? |
Implements IBufferingStatsdDataFactory.
Definition at line 118 of file BufferingStatsdDataFactory.php.
References $enabled.
|
protected |
Definition at line 36 of file BufferingStatsdDataFactory.php.
Referenced by getBuffer(), and getData().
|
protected |
Collection enabled?
Definition at line 41 of file BufferingStatsdDataFactory.php.
Referenced by setEnabled().
|
private |
Definition at line 45 of file BufferingStatsdDataFactory.php.
Referenced by __construct().