MediaWiki master
MetricInterface.php
Go to the documentation of this file.
1<?php
21
22use Psr\Log\LoggerInterface;
24
31interface MetricInterface {
32
33 public function __construct( BaseMetricInterface $baseMetric, LoggerInterface $logger );
34
36 public function getName(): string;
37
39 public function getComponent(): string;
40
42 public function getSampleRate(): float;
43
45 public function getTypeIndicator(): string;
46
52 public function getSamples(): array;
53
59 public function getSampleCount(): int;
60
67 public function setSampleRate( float $sampleRate );
68
74 public function getLabelKeys(): array;
75
94 public function setLabel( string $key, string $value );
95
102 public function setLabels( array $labels );
103
112 public function copyToStatsdAt( $statsdNamespaces );
113
119 public function fresh();
120
126 public function isHistogram(): bool;
127}
A container for a metric sample to be passed to the rendering function.
Definition Sample.php:30
fresh()
Returns metric with cleared labels.
getSamples()
Returns subset of samples corresponding to sample rate setting.
getSampleCount()
Returns a count of samples recorded by the metric.
isHistogram()
Indicates the metric instance is used in a Histogram.
setLabels(array $labels)
Convenience function to set a number of labels at once.
__construct(BaseMetricInterface $baseMetric, LoggerInterface $logger)
copyToStatsdAt( $statsdNamespaces)
Copies metric operation to StatsD at provided namespace.
setLabel(string $key, string $value)
Adds a label $key with $value.
setSampleRate(float $sampleRate)
Sets sample rate on a new metric instance.
getLabelKeys()
Returns the list of defined label keys.