MediaWiki master
NullStatsdDataFactory.php
Go to the documentation of this file.
1<?php
2
3namespace Wikimedia\Stats;
4
5use Liuggio\StatsdClient\Entity\StatsdData;
6use Liuggio\StatsdClient\Entity\StatsdDataInterface;
7
13
20 public function timing( $key, $time ) {
21 }
22
29 public function gauge( $key, $value ) {
30 }
31
49 public function set( $key, $value ) {
50 return [];
51 }
52
60 public function increment( $key ) {
61 return [];
62 }
63
72 public function decrement( $key ) {
73 return [];
74 }
75
84 public function updateCount( $key, $delta ) {
85 return [];
86 }
87
98 public function produceStatsdData(
99 $key,
100 $value = 1,
101 $metric = StatsdDataInterface::STATSD_METRIC_COUNT
102 ) {
103 $data = new StatsdData();
104 $data->setKey( $key );
105 $data->setValue( $value );
106 $data->setMetric( $metric );
107 return $data;
108 }
109
110 public function hasData() {
111 return false;
112 }
113
114 public function getData() {
115 return [];
116 }
117
118 public function clearData() {
119 // Nothing to do, always empty
120 }
121
122 public function getDataCount() {
123 return 0;
124 }
125
126 public function setEnabled( $enabled ) {
127 // Nothing to do, null factory is always disabled.
128 }
129}
130
132class_alias( NullStatsdDataFactory::class, 'NullStatsdDataFactory' );
getDataCount()
Return the number of buffered statsd data entries.
timing( $key, $time)
This function creates a 'timing' StatsdData.
increment( $key)
This function creates a 'increment' StatsdData object.
hasData()
Check whether this data factory has any buffered data.
updateCount( $key, $delta)
This function creates a 'updateCount' StatsdData object.
produceStatsdData( $key, $value=1, $metric=StatsdDataInterface::STATSD_METRIC_COUNT)
Produce a StatsdDataInterface Object.
decrement( $key)
This function creates a 'decrement' StatsdData object.
getData()
Return the buffered data from the factory.
setEnabled( $enabled)
Set collection enable status.
clearData()
Clear all buffered data from the factory.
gauge( $key, $value)
This function creates a 'gauge' StatsdData.
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.