-
Notifications
You must be signed in to change notification settings - Fork 35
/
noopstatsd.go
94 lines (70 loc) · 2.19 KB
/
noopstatsd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package statsd
import (
"time"
"github.com/DataDog/datadog-go/v5/statsd"
)
var _ statsd.ClientInterface = &NoopClient{}
// NoopClient may be used in place of any type of statsd client that speaks statsd.ClientInterface
// for testing, to remove side-effects of statsd calls
type NoopClient struct{}
// NewNoopClient returns a statsd client implementation that does nothing. It is used for tests.
func NewNoopClient() *NoopClient {
return &NoopClient{}
}
func (*NoopClient) Count(name string, value int64, tags []string, rate float64) error {
return nil
}
func (*NoopClient) CountWithTimestamp(name string, value int64, tags []string, rate float64, timestamp time.Time) error {
return nil
}
func (*NoopClient) Gauge(name string, value float64, tags []string, rate float64) error {
return nil
}
func (*NoopClient) GaugeWithTimestamp(name string, value float64, tags []string, rate float64, timestamp time.Time) error {
return nil
}
func (*NoopClient) Incr(name string, tags []string, rate float64) error {
return nil
}
func (*NoopClient) Decr(name string, tags []string, rate float64) error {
return nil
}
func (*NoopClient) Histogram(name string, value float64, tags []string, rate float64) error {
return nil
}
func (*NoopClient) Event(event *statsd.Event) error {
return nil
}
func (*NoopClient) ServiceCheck(sc *statsd.ServiceCheck) error {
return nil
}
func (*NoopClient) Set(name string, value string, tags []string, rate float64) error {
return nil
}
func (*NoopClient) Timing(name string, value time.Duration, tags []string, rate float64) error {
return nil
}
func (*NoopClient) Distribution(name string, value float64, tags []string, rate float64) error {
return nil
}
func (*NoopClient) Close() error {
return nil
}
func (*NoopClient) Flush() error {
return nil
}
func (*NoopClient) GetTelemetry() statsd.Telemetry {
return statsd.Telemetry{}
}
func (*NoopClient) IsClosed() bool {
return false
}
func (*NoopClient) SimpleEvent(title, text string) error {
return nil
}
func (*NoopClient) SimpleServiceCheck(name string, status statsd.ServiceCheckStatus) error {
return nil
}
func (*NoopClient) TimeInMilliseconds(name string, value float64, tags []string, rate float64) error {
return nil
}