Advertisement
RaspWasTaken

Untitled

Jun 25th, 2020
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Liuggio\StatsdClient\Factory;
  4.  
  5. use Liuggio\StatsdClient\Entity\StatsdDataInterface;
  6.  
  7. Interface StatsdDataFactoryInterface
  8. {
  9.  
  10. /**
  11. * This function creates a 'timing' StatsdData.
  12. *
  13. * @abstract
  14. *
  15. * @param string|array $key The metric(s) to set.
  16. * @param float $time The elapsed time (ms) to log
  17. **/
  18. function timing($key, $time);
  19.  
  20. /**
  21. * This function creates a 'gauge' StatsdData.
  22. *
  23. * @abstract
  24. *
  25. * @param string|array $key The metric(s) to set.
  26. * @param float $value The value for the stats.
  27. **/
  28. function gauge($key, $value);
  29.  
  30. /**
  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
  36. * the last flush.
  37. *
  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).
  41. *
  42. * @abstract
  43. *
  44. * @param string|array $key The metric(s) to set.
  45. * @param float $value The value for the stats.
  46. *
  47. * @return array
  48. **/
  49. function set($key, $value);
  50.  
  51. /**
  52. * This function creates a 'increment' StatsdData object.
  53. *
  54. * @abstract
  55. *
  56. * @param string|array $key The metric(s) to increment.
  57. * @param float|1 $sampleRate The rate (0-1) for sampling.
  58. *
  59. * @return array
  60. **/
  61. function increment($key);
  62.  
  63. /**
  64. * This function creates a 'decrement' StatsdData object.
  65. *
  66. * @abstract
  67. *
  68. * @param string|array $key The metric(s) to decrement.
  69. * @param float|1 $sampleRate The rate (0-1) for sampling.
  70. *
  71. * @return mixed
  72. **/
  73. function decrement($key);
  74.  
  75. /**
  76. * This function creates a 'updateCount' StatsdData object.
  77. *
  78. * @abstract
  79. *
  80. * @param string|array $key The metric(s) to decrement.
  81. * @param integer $delta The delta to add to the each metric
  82. *
  83. * @return mixed
  84. **/
  85. function updateCount($key, $delta);
  86.  
  87. /**
  88. * Produce a StatsdDataInterface Object.
  89. *
  90. * @abstract
  91. *
  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)
  95. *
  96. * @return StatsdDataInterface
  97. **/
  98. function produceStatsdData($key, $value = 1, $metric = StatsdDataInterface::STATSD_METRIC_COUNT);
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement