@@ -133,14 +133,15 @@ public function getServerKey($stats)
133133 * @param string $value value
134134 * @param float $sampleRate sampling rate
135135 * @param string $unit unit
136+ * @param array $tags Tags key => value for influxDb
136137 *
137138 * @return Client
138139 */
139- protected function addToSend ($ stats , $ value , $ sampleRate , $ unit )
140+ protected function addToSend ($ stats , $ value , $ sampleRate , $ unit, $ tags )
140141 {
141142
142143 $ message = new MessageEntity (
143- (string ) $ stats , (int ) $ value , (string ) $ unit , (float ) $ sampleRate
144+ (string ) $ stats , (int ) $ value , (string ) $ unit , (float ) $ sampleRate, $ tags
144145 );
145146
146147 $ queue = [
@@ -175,12 +176,13 @@ protected function buildSampledData()
175176 * @param string $stats The metric to in log timing info for.
176177 * @param int $time The ellapsed time (ms) to log
177178 * @param float|int $sampleRate the rate (0-1) for sampling.
179+ * @param array $tags Tags key => value for influxDb
178180 *
179181 * @return Client
180182 */
181- public function timing ($ stats , $ time , $ sampleRate = 1.0 )
183+ public function timing ($ stats , $ time , $ sampleRate = 1.0 , $ tags = [] )
182184 {
183- $ this ->addToSend ($ stats , $ time , $ sampleRate , 'ms ' );
185+ $ this ->addToSend ($ stats , $ time , $ sampleRate , 'ms ' , $ tags );
184186
185187 return $ this ;
186188 }
@@ -190,14 +192,15 @@ public function timing($stats, $time, $sampleRate = 1.0)
190192 *
191193 * @param string $stats The metric(s) to increment.
192194 * @param float $sampleRate SamplingRate
195+ * @param array $tags Tags key => value for influxDb
193196 *
194197 * @internal param $ float|1 $sampleRate the rate (0-1) for sampling.
195198 *
196199 * @return Client
197200 */
198- public function increment ($ stats , $ sampleRate = 1.0 )
201+ public function increment ($ stats , $ sampleRate = 1.0 , $ tags = [] )
199202 {
200- $ this ->count ($ stats , '1 ' , $ sampleRate );
203+ $ this ->count ($ stats , '1 ' , $ sampleRate, $ tags );
201204
202205 return $ this ;
203206 }
@@ -208,12 +211,13 @@ public function increment($stats, $sampleRate = 1.0)
208211 *
209212 * @param string $stats The metric(s) to decrement.
210213 * @param float|int $sampleRate the rate (0-1) for sampling.
214+ * @param array $tags Tags key => value for influxDb
211215 *
212216 * @return Client
213217 */
214- public function decrement ($ stats , $ sampleRate = 1 )
218+ public function decrement ($ stats , $ sampleRate = 1 , $ tags = [] )
215219 {
216- $ this ->count ($ stats , '-1 ' , $ sampleRate );
220+ $ this ->count ($ stats , '-1 ' , $ sampleRate, $ tags );
217221
218222 return $ this ;
219223 }
@@ -224,14 +228,15 @@ public function decrement($stats, $sampleRate = 1)
224228 * @param string $stats The metric(s) to count
225229 * @param int $value The count value
226230 * @param float|int $sampleRate the rate (0-1) for sampling.
231+ * @param array $tags Tags key => value for influxDb
227232 *
228233 * @access public
229234 *
230235 * @return Client
231236 */
232- public function count ($ stats , $ value , $ sampleRate = 1 )
237+ public function count ($ stats , $ value , $ sampleRate = 1 , $ tags = [] )
233238 {
234- $ this ->addToSend ($ stats , $ value , $ sampleRate , 'c ' );
239+ $ this ->addToSend ($ stats , $ value , $ sampleRate , 'c ' , $ tags );
235240
236241 return $ this ;
237242 }
@@ -242,13 +247,14 @@ public function count($stats, $value, $sampleRate = 1)
242247 * @param string $stats The metric(s) to count
243248 * @param int $value The value
244249 * @param float|int $sampleRate the rate (0-1) for sampling.
250+ * @param array $tags Tags key => value for influxDb
245251 *
246252 * @access public
247253 * @return Client
248254 */
249- public function gauge ($ stats , $ value , $ sampleRate = 1 )
255+ public function gauge ($ stats , $ value , $ sampleRate = 1 , $ tags = [] )
250256 {
251- $ this ->addToSend ($ stats , $ value , $ sampleRate , 'g ' );
257+ $ this ->addToSend ($ stats , $ value , $ sampleRate , 'g ' , $ tags );
252258
253259 return $ this ;
254260 }
@@ -259,13 +265,14 @@ public function gauge($stats, $value, $sampleRate = 1)
259265 * @param string $stats The metric(s) to count
260266 * @param int $value The value
261267 * @param float|int $sampleRate the rate (0-1) for sampling.
268+ * @param array $tags Tags key => value for influxDb
262269 *
263270 * @access public
264271 * @return Client
265272 */
266- public function set ($ stats , $ value , $ sampleRate = 1 )
273+ public function set ($ stats , $ value , $ sampleRate = 1 , $ tags = [] )
267274 {
268- $ this ->addToSend ($ stats , $ value , $ sampleRate , 's ' );
275+ $ this ->addToSend ($ stats , $ value , $ sampleRate , 's ' , $ tags );
269276
270277 return $ this ;
271278 }
0 commit comments