MediaWiki  master
Wikimedia\Metrics\CounterMetric Class Reference

Public Member Functions

 __construct (array $config, MetricUtils $metricUtils)
 
 increment (array $labels=[])
 
 incrementBy (int $value, array $labels=[])
 
 render ()
 
 validateLabels (array $labels=[])
 Validate provided labels. More...
 

Detailed Description

Definition at line 31 of file CounterMetric.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Metrics\CounterMetric::__construct ( array  $config,
MetricUtils  $metricUtils 
)
Parameters
array$configassociative array:
  • name: (string) The metric name
  • extension: (string) The extension generating the metric
  • labels: (array) List of metric dimensional instantiations for filters and aggregations
  • sampleRate: (float) Optional sampling rate to apply
MetricUtils$metricUtils

Definition at line 53 of file CounterMetric.php.

References Wikimedia\Metrics\MetricUtils\setTypeIndicator(), and Wikimedia\Metrics\MetricUtils\validateConfig().

Member Function Documentation

◆ increment()

Wikimedia\Metrics\CounterMetric::increment ( array  $labels = [])
Parameters
string[]$labels

Definition at line 71 of file CounterMetric.php.

◆ incrementBy()

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

Definition at line 79 of file CounterMetric.php.

◆ render()

Wikimedia\Metrics\CounterMetric::render ( )
Returns
string[]

Definition at line 90 of file CounterMetric.php.

◆ validateLabels()

Wikimedia\Metrics\CounterMetric::validateLabels ( array  $labels = [])

Validate provided labels.

Parameters
string[]$labels

Definition at line 64 of file CounterMetric.php.


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