func WithDevMode() Option {
	return func(o *Options) error {
		o.DevMode = true
		return nil
	}
}
WithDevMode enables client "dev" mode, sending more Telemetry metrics to
help troubleshoot client behavior.
package statsd
import (
	"math"
	"strings"
	"time"
)
var (
	DefaultNamespace = ""
	DefaultTags = []string{}
	DefaultMaxBytesPerPayload = 0
	DefaultMaxMessagesPerPayload = math.MaxInt32
	DefaultBufferPoolSize = 0
	DefaultBufferFlushInterval = 100 * time.Millisecond
	DefaultBufferShardCount = 32
	DefaultSenderQueueSize = 0
	DefaultWriteTimeoutUDS = 100 * time.Millisecond
	DefaultTelemetry = true
	DefaultReceivingMode = MutexMode
	DefaultChannelModeBufferSize = 4096
	DefaultAggregationFlushInterval = 3 * time.Second
	DefaultAggregation = false
	DefaultExtendedAggregation = false
	DefaultDevMode = false
)
type Options struct {
	Namespace string
	Tags []string
	MaxBytesPerPayload int
	MaxMessagesPerPayload int
	BufferPoolSize int
	BufferFlushInterval time.Duration
	BufferShardCount int
	SenderQueueSize int
	WriteTimeoutUDS time.Duration
	Telemetry bool
	ReceiveMode ReceivingMode
	ChannelModeBufferSize int
	AggregationFlushInterval time.Duration
	Aggregation bool
	ExtendedAggregation bool
	TelemetryAddr string
	DevMode bool
}
func resolveOptions(options []Option) (*Options, error) {
	o := &Options{
		Namespace:                DefaultNamespace,
		Tags:                     DefaultTags,
		MaxBytesPerPayload:       DefaultMaxBytesPerPayload,
		MaxMessagesPerPayload:    DefaultMaxMessagesPerPayload,
		BufferPoolSize:           DefaultBufferPoolSize,
		BufferFlushInterval:      DefaultBufferFlushInterval,
		BufferShardCount:         DefaultBufferShardCount,
		SenderQueueSize:          DefaultSenderQueueSize,
		WriteTimeoutUDS:          DefaultWriteTimeoutUDS,
		Telemetry:                DefaultTelemetry,
		ReceiveMode:              DefaultReceivingMode,
		ChannelModeBufferSize:    DefaultChannelModeBufferSize,
		AggregationFlushInterval: DefaultAggregationFlushInterval,
		Aggregation:              DefaultAggregation,
		ExtendedAggregation:      DefaultExtendedAggregation,
		DevMode:                  DefaultDevMode,
	}
	for _, option := range options {
		err := option(o)
		if err != nil {
			return nil, err
		}
	}
	return o, nil
}
type Option func(*Options) error
func WithNamespace(namespace string) Option {
	return func(o *Options) error {
		if strings.HasSuffix(namespace, ".") {
			o.Namespace = namespace
		} else {
			o.Namespace = namespace + "."
		}
		return nil
	}
}
func WithTags(tags []string) Option {
	return func(o *Options) error {
		o.Tags = tags
		return nil
	}
}
func WithMaxMessagesPerPayload(maxMessagesPerPayload int) Option {
	return func(o *Options) error {
		o.MaxMessagesPerPayload = maxMessagesPerPayload
		return nil
	}
}
func WithMaxBytesPerPayload(MaxBytesPerPayload int) Option {
	return func(o *Options) error {
		o.MaxBytesPerPayload = MaxBytesPerPayload
		return nil
	}
}
func WithBufferPoolSize(bufferPoolSize int) Option {
	return func(o *Options) error {
		o.BufferPoolSize = bufferPoolSize
		return nil
	}
}
func WithBufferFlushInterval(bufferFlushInterval time.Duration) Option {
	return func(o *Options) error {
		o.BufferFlushInterval = bufferFlushInterval
		return nil
	}
}
func WithBufferShardCount(bufferShardCount int) Option {
	return func(o *Options) error {
		o.BufferShardCount = bufferShardCount
		return nil
	}
}
func WithSenderQueueSize(senderQueueSize int) Option {
	return func(o *Options) error {
		o.SenderQueueSize = senderQueueSize
		return nil
	}
}
func WithWriteTimeoutUDS(writeTimeoutUDS time.Duration) Option {
	return func(o *Options) error {
		o.WriteTimeoutUDS = writeTimeoutUDS
		return nil
	}
}
func WithoutTelemetry() Option {
	return func(o *Options) error {
		o.Telemetry = false
		return nil
	}
}
func WithChannelMode() Option {
	return func(o *Options) error {
		o.ReceiveMode = ChannelMode
		return nil
	}
}
func WithMutexMode() Option {
	return func(o *Options) error {
		o.ReceiveMode = MutexMode
		return nil
	}
}
func WithChannelModeBufferSize(bufferSize int) Option {
	return func(o *Options) error {
		o.ChannelModeBufferSize = bufferSize
		return nil
	}
}
func WithAggregationInterval(interval time.Duration) Option {
	return func(o *Options) error {
		o.AggregationFlushInterval = interval
		return nil
	}
}
func WithClientSideAggregation() Option {
	return func(o *Options) error {
		o.Aggregation = true
		return nil
	}
}
func WithoutClientSideAggregation() Option {
	return func(o *Options) error {
		o.Aggregation = false
		o.ExtendedAggregation = false
		return nil
	}
}
func WithExtendedClientSideAggregation() Option {
	return func(o *Options) error {
		o.Aggregation = true
		o.ExtendedAggregation = true
		return nil
	}
}
func WithTelemetryAddr(addr string) Option {
	return func(o *Options) error {
		o.TelemetryAddr = addr
		return nil
	}
}