github.com/blend/go-sdk@v1.20220411.3/statsd/config.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package statsd 9 10 import ( 11 "context" 12 "time" 13 14 "github.com/blend/go-sdk/configutil" 15 "github.com/blend/go-sdk/env" 16 ) 17 18 var ( 19 _ configutil.Resolver = (*Config)(nil) 20 ) 21 22 // Config is the set of options for the statsd client. 23 type Config struct { 24 Addr string `json:"addr" yaml:"addr" env:"STATSD_ADDR"` 25 DialTimeout time.Duration `json:"dialTimeout" yaml:"dialTimeout"` 26 SampleRate float64 `json:"sampleRate" yaml:"sampleRate"` 27 MaxPacketSize int `json:"maxPacketSize" yaml:"maxPacketSize"` 28 MaxBufferSize int `json:"maxBufferSize" yaml:"maxBufferSize"` 29 DefaultTags map[string]string `json:"defaultTags" yaml:"defaultTags"` 30 } 31 32 // Resolve implements configutil.Resolver. 33 func (c *Config) Resolve(ctx context.Context) error { 34 return env.GetVars(ctx).ReadInto(c) 35 } 36 37 // IsZero returns if the config is set or not. 38 func (c Config) IsZero() bool { 39 return c.Addr == "" 40 }