MediaWiki  master
Wikimedia\Stats\Metrics\CounterMetric Class Reference

Counter Metric Implementation. More...

Inheritance diagram for Wikimedia\Stats\Metrics\CounterMetric:
Collaboration diagram for Wikimedia\Stats\Metrics\CounterMetric:

Public Member Functions

 __construct ( $baseMetric, $logger)
 
 copyToStatsdAt (string $statsdNamespace)
 Copies metric operation to StatsD at provided namespace.
Parameters
string$statsdNamespace
Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric
More...
 
 fresh ()
 Returns metric with cleared labels.
Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric
More...
 
 getComponent ()
 
Returns
string
More...
 
 getLabelKeys ()
 Returns the list of defined label keys.
Returns
string[]
More...
 
 getName ()
 
Returns
string
More...
 
 getSampleRate ()
 
Returns
float
More...
 
 getSamples ()
 Returns subset of samples corresponding to sample rate setting.
Returns
Sample[]
More...
 
 getTypeIndicator ()
 
Returns
string
More...
 
 increment ()
 Increments metric by one. More...
 
 incrementBy (int $value, array $labels=[])
 Increments metric by provided value. More...
 
 withLabel (string $key, string $value)
 Adds a label $key with $value.
Parameters
string$key
string$value
Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric
More...
 
 withSampleRate (float $sampleRate)
 Sets sample rate on a new metric instance.
Parameters
float$sampleRate
Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric
More...
 
- Public Member Functions inherited from Wikimedia\Stats\Metrics\MetricInterface
 __construct (BaseMetricInterface $baseMetric, LoggerInterface $logger)
 

Detailed Description

Counter Metric Implementation.

Counter Metrics only ever increase and are identified by type "c".

Author
Cole White
Since
1.38

Definition at line 37 of file CounterMetric.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Stats\Metrics\CounterMetric::__construct (   $baseMetric,
  $logger 
)

Definition at line 58 of file CounterMetric.php.

Member Function Documentation

◆ copyToStatsdAt()

Wikimedia\Stats\Metrics\CounterMetric::copyToStatsdAt ( string  $statsdNamespace)

Copies metric operation to StatsD at provided namespace.

Parameters
string$statsdNamespace
Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 142 of file CounterMetric.php.

◆ fresh()

Wikimedia\Stats\Metrics\CounterMetric::fresh ( )

Returns metric with cleared labels.

Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 150 of file CounterMetric.php.

◆ getComponent()

Wikimedia\Stats\Metrics\CounterMetric::getComponent ( )

Returns
string

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 93 of file CounterMetric.php.

◆ getLabelKeys()

Wikimedia\Stats\Metrics\CounterMetric::getLabelKeys ( )

Returns the list of defined label keys.

Returns
string[]

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 125 of file CounterMetric.php.

◆ getName()

Wikimedia\Stats\Metrics\CounterMetric::getName ( )

Returns
string

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 88 of file CounterMetric.php.

◆ getSampleRate()

Wikimedia\Stats\Metrics\CounterMetric::getSampleRate ( )

Returns
float

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 108 of file CounterMetric.php.

◆ getSamples()

Wikimedia\Stats\Metrics\CounterMetric::getSamples ( )

Returns subset of samples corresponding to sample rate setting.

Returns
Sample[]

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 103 of file CounterMetric.php.

◆ getTypeIndicator()

Wikimedia\Stats\Metrics\CounterMetric::getTypeIndicator ( )

Returns
string

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 98 of file CounterMetric.php.

◆ increment()

Wikimedia\Stats\Metrics\CounterMetric::increment ( )

Increments metric by one.

Returns
void

Definition at line 68 of file CounterMetric.php.

◆ incrementBy()

Wikimedia\Stats\Metrics\CounterMetric::incrementBy ( int  $value,
array  $labels = [] 
)

Increments metric by provided value.

Parameters
int$value
string[]$labels
Returns
void

Definition at line 79 of file CounterMetric.php.

◆ withLabel()

Wikimedia\Stats\Metrics\CounterMetric::withLabel ( string  $key,
string  $value 
)

Adds a label $key with $value.

Parameters
string$key
string$value
Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 130 of file CounterMetric.php.

◆ withSampleRate()

Wikimedia\Stats\Metrics\CounterMetric::withSampleRate ( float  $sampleRate)

Sets sample rate on a new metric instance.

Parameters
float$sampleRate
Returns
CounterMetric|GaugeMetric|TimingMetric|NullMetric

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 113 of file CounterMetric.php.


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