MediaWiki  1.29.2
BufferingStatsdDataFactory Class Reference

A factory for application metric data. More...

Inheritance diagram for BufferingStatsdDataFactory:
Collaboration diagram for BufferingStatsdDataFactory:

Public Member Functions

 __construct ( $prefix)
 
 getBuffer ()
 
 produceStatsdData ( $key, $value=1, $metric=StatsdDataInterface::STATSD_METRIC_COUNT)
 

Protected Attributes

 $buffer = []
 

Static Private Member Functions

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

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 38 of file BufferingStatsdDataFactory.php.

Member Function Documentation

◆ getBuffer()

BufferingStatsdDataFactory::getBuffer ( )
Returns
StatsdData[]

Definition at line 84 of file BufferingStatsdDataFactory.php.

References $buffer.

◆ 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

Definition at line 53 of file BufferingStatsdDataFactory.php.

Referenced by produceStatsdData().

◆ produceStatsdData()

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

Definition at line 60 of file BufferingStatsdDataFactory.php.

References $value, and normalizeMetricKey().

Member Data Documentation

◆ $buffer

BufferingStatsdDataFactory::$buffer = []
protected

Definition at line 36 of file BufferingStatsdDataFactory.php.

Referenced by getBuffer().


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