MediaWiki master
|
Base Metric Interface. More...
Inherited by Wikimedia\Stats\Metrics\BaseMetric.
Public Member Functions | |
__construct (string $component, string $name) | |
addLabel (string $key, string $value) | |
Add a label with key => value. | |
addSample (Sample $sample) | |
Records a Metric Sample. | |
clearLabels () | |
Clears the working labels. | |
getComponent () | |
Returns the Metric Component. | |
getLabelKeys () | |
Returns array of label keys. | |
getLabelValues () | |
Returns an array of label values in the order of label keys. | |
getName () | |
Returns the Metric Name. | |
getSampleCount () | |
Returns a count of samples recorded by the metric. | |
getSampleRate () | |
Returns the configured sample rate. | |
getSamples () | |
Returns subset of samples corresponding to sample rate setting. | |
getStatsdDataFactory () | |
Gets StatsD Data Factory instance or null. | |
getStatsdNamespaces () | |
Returns the configured legacy StatsD namespaces. | |
setSampleRate (float $sampleRate) | |
Sets the sample rate. | |
setStatsdNamespaces ( $statsdNamespaces) | |
Validates and sets legacy StatsD namespaces. | |
withStatsdDataFactory (IBufferingStatsdDataFactory $statsdDataFactory) | |
StatsD Data Factory instance to copy metrics to. | |
Base Metric Interface.
Interface for defining a Base Metric.
Definition at line 35 of file BaseMetricInterface.php.
Wikimedia\Stats\Metrics\BaseMetricInterface::__construct | ( | string | $component, |
string | $name ) |
string | $component | The component this metric will track. |
string | $name | The Metric Name. |
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::addLabel | ( | string | $key, |
string | $value ) |
Add a label with key => value.
Note that the order in which labels are added is significant for StatsD output.
Example:
statsd: "mediawiki.demo.testMetric_total.foo.bar.baz" prometheus: "mediawiki_demo_testMetric_total{first='foo',second='bar',third='baz'}
string | $key | |
string | $value |
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::addSample | ( | Sample | $sample | ) |
Records a Metric Sample.
Sample | $sample |
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::clearLabels | ( | ) |
Wikimedia\Stats\Metrics\BaseMetricInterface::getComponent | ( | ) |
Wikimedia\Stats\Metrics\BaseMetricInterface::getLabelKeys | ( | ) |
Wikimedia\Stats\Metrics\BaseMetricInterface::getLabelValues | ( | ) |
Returns an array of label values in the order of label keys.
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::getName | ( | ) |
Wikimedia\Stats\Metrics\BaseMetricInterface::getSampleCount | ( | ) |
Returns a count of samples recorded by the metric.
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::getSampleRate | ( | ) |
Wikimedia\Stats\Metrics\BaseMetricInterface::getSamples | ( | ) |
Returns subset of samples corresponding to sample rate setting.
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::getStatsdDataFactory | ( | ) |
Gets StatsD Data Factory instance or null.
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::getStatsdNamespaces | ( | ) |
Returns the configured legacy StatsD namespaces.
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::setSampleRate | ( | float | $sampleRate | ) |
Sets the sample rate.
float | $sampleRate |
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::setStatsdNamespaces | ( | $statsdNamespaces | ) |
Validates and sets legacy StatsD namespaces.
string | string[] | $statsdNamespaces |
Implemented in Wikimedia\Stats\Metrics\BaseMetric.
Wikimedia\Stats\Metrics\BaseMetricInterface::withStatsdDataFactory | ( | IBufferingStatsdDataFactory | $statsdDataFactory | ) |
StatsD Data Factory instance to copy metrics to.
IBufferingStatsdDataFactory | $statsdDataFactory |