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
14
21 public function timing( $key, $time ) {
22 }
23
30 public function gauge( $key, $value ) {
31 }
32
50 public function set( $key, $value ) {
51 return [];
52 }
53
61 public function increment( $key ) {
62 return [];
63 }
64
73 public function decrement( $key ) {
74 return [];
75 }
76
85 public function updateCount( $key, $delta ) {
86 return [];
87 }
88
99 public function produceStatsdData(
100 $key,
101 $value = 1,
102 $metric = StatsdDataInterface::STATSD_METRIC_COUNT
103 ) {
104 $data = new StatsdData();
105 $data->setKey( $key );
106 $data->setValue( $value );
107 $data->setMetric( $metric );
108 return $data;
109 }
110
112 public function hasData() {
113 return false;
114 }
115
117 public function getData() {
118 return [];
119 }
120
121 public function clearData() {
122 // Nothing to do, always empty
123 }
124
126 public function getDataCount() {
127 return 0;
128 }
129
131 public function setEnabled( $enabled ) {
132 // Nothing to do, null factory is always disabled.
133 }
134}
135
137class_alias( NullStatsdDataFactory::class, 'NullStatsdDataFactory' );
getDataCount()
Return the number of buffered statsd data entries.int 1.31
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.bool
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.StatsdData[]
setEnabled( $enabled)
Set collection enable status.void
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.