[node-statsd] Add function overloads for increment (#20359)

* [node-statsd] Add function overloads for increment

* [node-statsd] Add a type test for the increment call
This commit is contained in:
Alex Turek
2017-10-09 15:46:03 -07:00
committed by Wesley Wigham
parent ea4008d4e8
commit 874881be27
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -109,6 +109,8 @@ export class StatsD {
* @param {Callback} callback Callback when message is done being delivered. Optional.
*/
increment(stat: string | string[], value?: number, sampleRate?: number, tags?: string[], callback?: Callback): void;
increment(stat: string | string[], value: any, sampleRateOrTags?: number | string [], callback?: Callback): void;
increment(stat: string | string[], value: any, callback?: Callback): void;
/**
* Sends a stat across the wire
+2
View File
@@ -10,6 +10,8 @@ client.timing('response_time', 42);
// Increment: Increments a stat by a value (default is 1)
client.increment('my_counter');
client.increment('my_counter', 1, ['foo:1', 'bar:abc']);
// Decrement: Decrements a stat by a value (default is -1)
client.decrement('my_counter');