MediaWiki
master
BaseMetricInterface.php
Go to the documentation of this file.
1
<?php
7
declare( strict_types=1 );
8
9
namespace
Wikimedia\Stats\Metrics
;
10
11
use
Wikimedia\Stats\IBufferingStatsdDataFactory
;
12
use
Wikimedia\Stats\Sample
;
13
22
interface
BaseMetricInterface
{
23
28
public
function
__construct
(
string
$component,
string
$name );
29
36
public
function
addSample
(
Sample
$sample ): void;
37
43
public
function
getSampleRate
(): float;
44
45
public
function
setSampleRate
(
float
$sampleRate ): void;
46
52
public
function
getSamples
(): array;
53
59
public
function
getSampleCount
(): int;
60
66
public
function
getName
(): string;
67
88
public
function
addLabel
(
string
$key,
string
$value ): void;
89
95
public
function
getLabels
(): array;
96
102
public
function
getLabelKeys
(): array;
103
109
public
function
getLabelValues
(): array;
110
116
public
function
getComponent
(): string;
117
123
public
function
clearLabels
(): void;
124
128
public
function
getStatsdDataFactory
();
129
136
public
function
setStatsdNamespaces
( $statsdNamespaces ): void;
137
143
public
function
getStatsdNamespaces
(): array;
144
152
public
function
withStatsdDataFactory
( ?
IBufferingStatsdDataFactory
$statsdDataFactory );
153
}
Wikimedia\Stats\Sample
A container for a metric sample to be passed to the rendering function.
Definition
Sample.php:17
Wikimedia\Stats\IBufferingStatsdDataFactory
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Definition
IBufferingStatsdDataFactory.php:16
Wikimedia\Stats\Metrics\BaseMetricInterface
Base Metric Interface.
Definition
BaseMetricInterface.php:22
Wikimedia\Stats\Metrics\BaseMetricInterface\addLabel
addLabel(string $key, string $value)
Add a label with key => value.
Wikimedia\Stats\Metrics\BaseMetricInterface\getName
getName()
Returns the Metric Name.
Wikimedia\Stats\Metrics\BaseMetricInterface\getLabels
getLabels()
Returns the defined labels as an associative array.
Wikimedia\Stats\Metrics\BaseMetricInterface\__construct
__construct(string $component, string $name)
Wikimedia\Stats\Metrics\BaseMetricInterface\setSampleRate
setSampleRate(float $sampleRate)
Wikimedia\Stats\Metrics\BaseMetricInterface\clearLabels
clearLabels()
Clears the working labels.
Wikimedia\Stats\Metrics\BaseMetricInterface\getStatsdNamespaces
getStatsdNamespaces()
Returns the configured legacy StatsD namespaces.
Wikimedia\Stats\Metrics\BaseMetricInterface\getLabelKeys
getLabelKeys()
Returns array of label keys.
Wikimedia\Stats\Metrics\BaseMetricInterface\getSamples
getSamples()
Returns subset of samples corresponding to sample rate setting.
Wikimedia\Stats\Metrics\BaseMetricInterface\getStatsdDataFactory
getStatsdDataFactory()
Gets StatsD Data Factory instance or null.
Wikimedia\Stats\Metrics\BaseMetricInterface\getSampleCount
getSampleCount()
Returns a count of samples recorded by the metric.
Wikimedia\Stats\Metrics\BaseMetricInterface\getLabelValues
getLabelValues()
Returns an array of label values in the order of label keys.
Wikimedia\Stats\Metrics\BaseMetricInterface\setStatsdNamespaces
setStatsdNamespaces( $statsdNamespaces)
Validates and sets legacy StatsD namespaces.
Wikimedia\Stats\Metrics\BaseMetricInterface\withStatsdDataFactory
withStatsdDataFactory(?IBufferingStatsdDataFactory $statsdDataFactory)
StatsD Data Factory instance to copy metrics to.
Wikimedia\Stats\Metrics\BaseMetricInterface\addSample
addSample(Sample $sample)
Records a Metric Sample.
Wikimedia\Stats\Metrics\BaseMetricInterface\getSampleRate
getSampleRate()
Returns the configured sample rate.
Wikimedia\Stats\Metrics\BaseMetricInterface\getComponent
getComponent()
Returns the Metric Component.
Wikimedia\Stats\Metrics
Definition
BaseMetric.php:9
includes
libs
Stats
Metrics
BaseMetricInterface.php
Generated on Fri Jan 16 2026 23:25:59 for MediaWiki by
1.10.0