MediaWiki master
BaseMetricInterface.php
Go to the documentation of this file.
1<?php
7declare( strict_types=1 );
8
10
13
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}
A container for a metric sample to be passed to the rendering function.
Definition Sample.php:17
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
addLabel(string $key, string $value)
Add a label with key => value.
getLabels()
Returns the defined labels as an associative array.
__construct(string $component, string $name)
clearLabels()
Clears the working labels.
getStatsdNamespaces()
Returns the configured legacy StatsD namespaces.
getLabelKeys()
Returns array of label keys.
getSamples()
Returns subset of samples corresponding to sample rate setting.
getStatsdDataFactory()
Gets StatsD Data Factory instance or null.
getSampleCount()
Returns a count of samples recorded by the metric.
getLabelValues()
Returns an array of label values in the order of label keys.
setStatsdNamespaces( $statsdNamespaces)
Validates and sets legacy StatsD namespaces.
withStatsdDataFactory(?IBufferingStatsdDataFactory $statsdDataFactory)
StatsD Data Factory instance to copy metrics to.
addSample(Sample $sample)
Records a Metric Sample.
getSampleRate()
Returns the configured sample rate.
getComponent()
Returns the Metric Component.