@@ -171,7 +171,7 @@ private function flushTelemetry()
171
171
*/
172
172
public function timing ($ stat , $ time , $ sampleRate = 1.0 , $ tags = null )
173
173
{
174
- $ time = $ this ->normalizeStat ($ time );
174
+ $ time = $ this ->normalizeValue ($ time );
175
175
$ this ->send (array ($ stat => "$ time|ms " ), $ sampleRate , $ tags );
176
176
}
177
177
@@ -200,7 +200,7 @@ public function microtiming($stat, $time, $sampleRate = 1.0, $tags = null)
200
200
**/
201
201
public function gauge ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
202
202
{
203
- $ value = $ this ->normalizeStat ($ value );
203
+ $ value = $ this ->normalizeValue ($ value );
204
204
$ this ->send (array ($ stat => "$ value|g " ), $ sampleRate , $ tags );
205
205
}
206
206
@@ -215,7 +215,7 @@ public function gauge($stat, $value, $sampleRate = 1.0, $tags = null)
215
215
**/
216
216
public function histogram ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
217
217
{
218
- $ value = $ this ->normalizeStat ($ value );
218
+ $ value = $ this ->normalizeValue ($ value );
219
219
$ this ->send (array ($ stat => "$ value|h " ), $ sampleRate , $ tags );
220
220
}
221
221
@@ -230,7 +230,7 @@ public function histogram($stat, $value, $sampleRate = 1.0, $tags = null)
230
230
**/
231
231
public function distribution ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
232
232
{
233
- $ value = $ this ->normalizeStat ($ value );
233
+ $ value = $ this ->normalizeValue ($ value );
234
234
$ this ->send (array ($ stat => "$ value|d " ), $ sampleRate , $ tags );
235
235
}
236
236
@@ -246,7 +246,7 @@ public function distribution($stat, $value, $sampleRate = 1.0, $tags = null)
246
246
public function set ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
247
247
{
248
248
if (!is_string ($ value )) {
249
- $ value = $ this ->normalizeStat ($ value );
249
+ $ value = $ this ->normalizeValue ($ value );
250
250
}
251
251
252
252
$ this ->send (array ($ stat => "$ value|s " ), $ sampleRate , $ tags );
@@ -295,7 +295,7 @@ public function decrement($stats, $sampleRate = 1.0, $tags = null, $value = -1)
295
295
**/
296
296
public function updateStats ($ stats , $ delta = 1 , $ sampleRate = 1.0 , $ tags = null )
297
297
{
298
- $ delta = $ this ->normalizeStat ($ delta );
298
+ $ delta = $ this ->normalizeValue ($ delta );
299
299
if (!is_array ($ stats )) {
300
300
$ stats = array ($ stats );
301
301
}
@@ -381,6 +381,7 @@ private function normalizeTags($tags)
381
381
**/
382
382
public function send ($ data , $ sampleRate = 1.0 , $ tags = null )
383
383
{
384
+ $ sampleRate = $ this ->normalizeValue ($ sampleRate );
384
385
$ this ->metrics_sent += count ($ data );
385
386
// sampling
386
387
$ sampledData = array ();
@@ -640,7 +641,7 @@ private function eventUdp($vals)
640
641
*
641
642
* @return string Formatted value
642
643
*/
643
- private function normalizeStat ($ value )
644
+ private function normalizeValue ($ value )
644
645
{
645
646
// Controlls the way things are converted to a string.
646
647
// Otherwise localization settings impact float to string conversion (e.x 1.3 -> 1,3 and 10000 => 10,000)
0 commit comments