MediaWiki REL1_39
Wikimedia\Metrics\MetricUtils Class Reference
Collaboration diagram for Wikimedia\Metrics\MetricUtils:

Public Member Functions

 addSample (Sample $sample)
 Adds a sample to cache.
 
 render ()
 
 setTypeIndicator (string $typeIndicator)
 Sets the StatsD protocol type indicator.
 
 validateConfig ( $config)
 
 validateLabels (array $labels)
 

Protected Attributes

string $extension
 
string $format
 
string[] $labels
 
string $name
 
string $prefix
 
float $sampleRate
 
Sample[] $samples = []
 
string $typeIndicator
 

Detailed Description

Definition at line 37 of file MetricUtils.php.

Member Function Documentation

◆ addSample()

Wikimedia\Metrics\MetricUtils::addSample ( Sample $sample)

Adds a sample to cache.

Parameters
Sample$sample

Definition at line 104 of file MetricUtils.php.

◆ render()

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

Definition at line 111 of file MetricUtils.php.

◆ setTypeIndicator()

Wikimedia\Metrics\MetricUtils::setTypeIndicator ( string $typeIndicator)

Sets the StatsD protocol type indicator.

Parameters
string$typeIndicator

Definition at line 96 of file MetricUtils.php.

References Wikimedia\Metrics\MetricUtils\$typeIndicator.

Referenced by Wikimedia\Metrics\CounterMetric\__construct(), Wikimedia\Metrics\GaugeMetric\__construct(), and Wikimedia\Metrics\TimingMetric\__construct().

◆ validateConfig()

Wikimedia\Metrics\MetricUtils::validateConfig ( $config)
Parameters
array$configassociative array:
  • prefix: (string) The prefix prepended to the start of the metric name.
  • 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
  • format: (string) The expected output format – one of MetricsFactory::SUPPORTED_OUTPUT_FORMATS

Definition at line 75 of file MetricUtils.php.

Referenced by Wikimedia\Metrics\CounterMetric\__construct(), Wikimedia\Metrics\GaugeMetric\__construct(), and Wikimedia\Metrics\TimingMetric\__construct().

◆ validateLabels()

Wikimedia\Metrics\MetricUtils::validateLabels ( array $labels)
Parameters
array$labels
Exceptions
InvalidLabelsException

Definition at line 134 of file MetricUtils.php.

Member Data Documentation

◆ $extension

string Wikimedia\Metrics\MetricUtils::$extension
protected

Definition at line 46 of file MetricUtils.php.

◆ $format

string Wikimedia\Metrics\MetricUtils::$format
protected

Definition at line 49 of file MetricUtils.php.

◆ $labels

string [] Wikimedia\Metrics\MetricUtils::$labels
protected

Definition at line 58 of file MetricUtils.php.

◆ $name

string Wikimedia\Metrics\MetricUtils::$name
protected

Definition at line 52 of file MetricUtils.php.

◆ $prefix

string Wikimedia\Metrics\MetricUtils::$prefix
protected
Initial value:
=
private const RE_VALID_NAME_AND_LABEL_NAME '/^[a-zA-Z_][a-zA-Z0-9_]*$/'

Definition at line 43 of file MetricUtils.php.

◆ $sampleRate

float Wikimedia\Metrics\MetricUtils::$sampleRate
protected

Definition at line 55 of file MetricUtils.php.

◆ $samples

Sample [] Wikimedia\Metrics\MetricUtils::$samples = []
protected

Definition at line 61 of file MetricUtils.php.

◆ $typeIndicator

string Wikimedia\Metrics\MetricUtils::$typeIndicator
protected

Definition at line 64 of file MetricUtils.php.

Referenced by Wikimedia\Metrics\MetricUtils\setTypeIndicator().


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