You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
604 B
34 lines
604 B
3 years ago
|
package datadog
|
||
|
|
||
|
import "github.com/DataDog/datadog-go/statsd"
|
||
|
|
||
|
// Option is doatadog option.
|
||
|
type Option func(*options)
|
||
|
|
||
|
type options struct {
|
||
|
sampleRate float64
|
||
|
labels []string
|
||
|
client *statsd.Client
|
||
|
}
|
||
|
|
||
|
// WithSampleRate with sample rate option.
|
||
|
func WithSampleRate(rate float64) Option {
|
||
|
return func(o *options) {
|
||
|
o.sampleRate = rate
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// WithLabels with labels option.
|
||
|
func WithLabels(lvs ...string) Option {
|
||
|
return func(o *options) {
|
||
|
o.labels = lvs
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// WithClient with client option.
|
||
|
func WithClient(c *statsd.Client) Option {
|
||
|
return func(o *options) {
|
||
|
o.client = c
|
||
|
}
|
||
|
}
|