@@ -171,7 +171,7 @@ private function flushTelemetry()
171171 */
172172 public function timing ($ stat , $ time , $ sampleRate = 1.0 , $ tags = null )
173173 {
174- $ time = $ this ->normalizeStat ($ time );
174+ $ time = $ this ->normalizeValue ($ time );
175175 $ this ->send (array ($ stat => "$ time|ms " ), $ sampleRate , $ tags );
176176 }
177177
@@ -200,7 +200,7 @@ public function microtiming($stat, $time, $sampleRate = 1.0, $tags = null)
200200 **/
201201 public function gauge ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
202202 {
203- $ value = $ this ->normalizeStat ($ value );
203+ $ value = $ this ->normalizeValue ($ value );
204204 $ this ->send (array ($ stat => "$ value|g " ), $ sampleRate , $ tags );
205205 }
206206
@@ -215,7 +215,7 @@ public function gauge($stat, $value, $sampleRate = 1.0, $tags = null)
215215 **/
216216 public function histogram ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
217217 {
218- $ value = $ this ->normalizeStat ($ value );
218+ $ value = $ this ->normalizeValue ($ value );
219219 $ this ->send (array ($ stat => "$ value|h " ), $ sampleRate , $ tags );
220220 }
221221
@@ -230,7 +230,7 @@ public function histogram($stat, $value, $sampleRate = 1.0, $tags = null)
230230 **/
231231 public function distribution ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
232232 {
233- $ value = $ this ->normalizeStat ($ value );
233+ $ value = $ this ->normalizeValue ($ value );
234234 $ this ->send (array ($ stat => "$ value|d " ), $ sampleRate , $ tags );
235235 }
236236
@@ -246,7 +246,7 @@ public function distribution($stat, $value, $sampleRate = 1.0, $tags = null)
246246 public function set ($ stat , $ value , $ sampleRate = 1.0 , $ tags = null )
247247 {
248248 if (!is_string ($ value )) {
249- $ value = $ this ->normalizeStat ($ value );
249+ $ value = $ this ->normalizeValue ($ value );
250250 }
251251
252252 $ this ->send (array ($ stat => "$ value|s " ), $ sampleRate , $ tags );
@@ -295,7 +295,7 @@ public function decrement($stats, $sampleRate = 1.0, $tags = null, $value = -1)
295295 **/
296296 public function updateStats ($ stats , $ delta = 1 , $ sampleRate = 1.0 , $ tags = null )
297297 {
298- $ delta = $ this ->normalizeStat ($ delta );
298+ $ delta = $ this ->normalizeValue ($ delta );
299299 if (!is_array ($ stats )) {
300300 $ stats = array ($ stats );
301301 }
@@ -381,6 +381,7 @@ private function normalizeTags($tags)
381381 **/
382382 public function send ($ data , $ sampleRate = 1.0 , $ tags = null )
383383 {
384+ $ sampleRate = $ this ->normalizeValue ($ sampleRate );
384385 $ this ->metrics_sent += count ($ data );
385386 // sampling
386387 $ sampledData = array ();
@@ -640,7 +641,7 @@ private function eventUdp($vals)
640641 *
641642 * @return string Formatted value
642643 */
643- private function normalizeStat ($ value )
644+ private function normalizeValue ($ value )
644645 {
645646 // Controlls the way things are converted to a string.
646647 // Otherwise localization settings impact float to string conversion (e.x 1.3 -> 1,3 and 10000 => 10,000)
0 commit comments