MediaWiki master
MetricInterface.php
Go to the documentation of this file.
1<?php
8
9use Psr\Log\LoggerInterface;
11
18interface MetricInterface {
19
20 public function __construct( BaseMetricInterface $baseMetric, LoggerInterface $logger );
21
23 public function getName(): string;
24
26 public function getComponent(): string;
27
29 public function getSampleRate(): float;
30
32 public function getTypeIndicator(): string;
33
39 public function getSamples(): array;
40
46 public function getSampleCount(): int;
47
54 public function setSampleRate( float $sampleRate );
55
61 public function getLabelKeys(): array;
62
81 public function setLabel( string $key, string $value );
82
89 public function setLabels( array $labels );
90
102 public function copyToStatsdAt( $statsdNamespaces );
103
109 public function fresh();
110
116 public function isHistogram(): bool;
117}
A container for a metric sample to be passed to the rendering function.
Definition Sample.php:17
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.