3 namespace Liuggio\StatsdClient\Factory;
5 use Liuggio\StatsdClient\Entity\StatsdDataInterface;
7 Interface StatsdDataFactoryInterface
11 * This function creates a 'timing' StatsdData.
15 * @param string|array $key The metric(s) to set.
16 * @param float $time The elapsed time (ms) to log
18 function timing($key, $time);
21 * This function creates a 'gauge' StatsdData.
25 * @param string|array $key The metric(s) to set.
26 * @param float $value The value for the stats.
28 function gauge($key, $value);
31 * This function creates a 'set' StatsdData object
32 * A "Set" is a count of unique events.
33 * This data type acts like a counter, but supports counting
34 * of unique occurrences of values between flushes. The backend
35 * receives the number of unique events that happened since
38 * The reference use case involved tracking the number of active
39 * and logged in users by sending the current userId of a user
40 * with each request with a key of "uniques" (or similar).
44 * @param string|array $key The metric(s) to set.
45 * @param float $value The value for the stats.
49 function set($key, $value);
52 * This function creates a 'increment' StatsdData object.
56 * @param string|array $key The metric(s) to increment.
57 * @param float|1 $sampleRate The rate (0-1) for sampling.
61 function increment($key);
64 * This function creates a 'decrement' StatsdData object.
68 * @param string|array $key The metric(s) to decrement.
69 * @param float|1 $sampleRate The rate (0-1) for sampling.
73 function decrement($key);
76 * This function creates a 'updateCount' StatsdData object.
80 * @param string|array $key The metric(s) to decrement.
81 * @param integer $delta The delta to add to the each metric
85 function updateCount($key, $delta);
88 * Produce a StatsdDataInterface Object.
92 * @param string $key The key of the metric
93 * @param int $value The amount to increment/decrement each metric by.
94 * @param string $metric The metric type ("c" for count, "ms" for timing, "g" for gauge, "s" for set)
96 * @return StatsdDataInterface
98 function produceStatsdData($key, $value = 1, $metric = StatsdDataInterface::STATSD_METRIC_COUNT);