noop.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package statsd
  2. import "time"
  3. // NoOpClient is a statsd client that does nothing. Can be useful in testing
  4. // situations for library users.
  5. type NoOpClient struct{}
  6. // Gauge does nothing and returns nil
  7. func (n *NoOpClient) Gauge(name string, value float64, tags []string, rate float64) error {
  8. return nil
  9. }
  10. // Count does nothing and returns nil
  11. func (n *NoOpClient) Count(name string, value int64, tags []string, rate float64) error {
  12. return nil
  13. }
  14. // Histogram does nothing and returns nil
  15. func (n *NoOpClient) Histogram(name string, value float64, tags []string, rate float64) error {
  16. return nil
  17. }
  18. // Distribution does nothing and returns nil
  19. func (n *NoOpClient) Distribution(name string, value float64, tags []string, rate float64) error {
  20. return nil
  21. }
  22. // Decr does nothing and returns nil
  23. func (n *NoOpClient) Decr(name string, tags []string, rate float64) error {
  24. return nil
  25. }
  26. // Incr does nothing and returns nil
  27. func (n *NoOpClient) Incr(name string, tags []string, rate float64) error {
  28. return nil
  29. }
  30. // Set does nothing and returns nil
  31. func (n *NoOpClient) Set(name string, value string, tags []string, rate float64) error {
  32. return nil
  33. }
  34. // Timing does nothing and returns nil
  35. func (n *NoOpClient) Timing(name string, value time.Duration, tags []string, rate float64) error {
  36. return nil
  37. }
  38. // TimeInMilliseconds does nothing and returns nil
  39. func (n *NoOpClient) TimeInMilliseconds(name string, value float64, tags []string, rate float64) error {
  40. return nil
  41. }
  42. // Event does nothing and returns nil
  43. func (n *NoOpClient) Event(e *Event) error {
  44. return nil
  45. }
  46. // SimpleEvent does nothing and returns nil
  47. func (n *NoOpClient) SimpleEvent(title, text string) error {
  48. return nil
  49. }
  50. // ServiceCheck does nothing and returns nil
  51. func (n *NoOpClient) ServiceCheck(sc *ServiceCheck) error {
  52. return nil
  53. }
  54. // SimpleServiceCheck does nothing and returns nil
  55. func (n *NoOpClient) SimpleServiceCheck(name string, status ServiceCheckStatus) error {
  56. return nil
  57. }
  58. // Close does nothing and returns nil
  59. func (n *NoOpClient) Close() error {
  60. return nil
  61. }
  62. // Flush does nothing and returns nil
  63. func (n *NoOpClient) Flush() error {
  64. return nil
  65. }
  66. // SetWriteTimeout does nothing and returns nil
  67. func (n *NoOpClient) SetWriteTimeout(d time.Duration) error {
  68. return nil
  69. }
  70. // Verify that NoOpClient implements the ClientInterface.
  71. // https://golang.org/doc/faq#guarantee_satisfies_interface
  72. var _ ClientInterface = &NoOpClient{}