MediaWiki master
Wikimedia\Stats\Metrics\CounterMetric Class Reference

Counter Metric Implementation. More...

Inherits Wikimedia\Stats\Metrics\MetricInterface.

Collaboration diagram for Wikimedia\Stats\Metrics\CounterMetric:

Public Member Functions

 getTypeIndicator ()
 
Returns
string

 
 increment ()
 Increments metric by one.
 
 incrementBy (float $value)
 Increments metric by provided value.
 
 setBucket ( $value)
 Sets the bucket value.
 
- Public Member Functions inherited from Wikimedia\Stats\Metrics\MetricInterface
 __construct (BaseMetricInterface $baseMetric, LoggerInterface $logger)
 
 copyToStatsdAt ( $statsdNamespaces)
 Copies metric operation to StatsD at provided namespace.
 
 fresh ()
 Returns metric with cleared labels.
 
 getComponent ()
 
 getLabelKeys ()
 Returns the list of defined label keys.
 
 getName ()
 
 getSampleCount ()
 Returns a count of samples recorded by the metric.
 
 getSampleRate ()
 
 getSamples ()
 Returns subset of samples corresponding to sample rate setting.
 
 isHistogram ()
 Indicates the metric instance is used in a Histogram.
 
 setLabel (string $key, string $value)
 Adds a label $key with $value.
 
 setLabels (array $labels)
 Convenience function to set a number of labels at once.
 
 setSampleRate (float $sampleRate)
 Sets sample rate on a new metric instance.
 

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 36 of file CounterMetric.php.

Member Function Documentation

◆ getTypeIndicator()

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

Returns
string

Implements Wikimedia\Stats\Metrics\MetricInterface.

Definition at line 103 of file CounterMetric.php.

◆ increment()

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

Increments metric by one.

Definition at line 49 of file CounterMetric.php.

◆ incrementBy()

Wikimedia\Stats\Metrics\CounterMetric::incrementBy ( float $value)

Increments metric by provided value.

Parameters
float$value
Returns
void

Definition at line 59 of file CounterMetric.php.

◆ setBucket()

Wikimedia\Stats\Metrics\CounterMetric::setBucket ( $value)

Sets the bucket value.

Only allows float, int, or literal '+Inf' as value.

WARNING: This function exists to support HistogramMetric. It should not be used elsewhere.

Access: internal
Parameters
float | int | string$value
Returns
CounterMetric

Definition at line 92 of file CounterMetric.php.


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