Documentation ¶
Index ¶
- func PrefixedStatter(prefix string, statter g2s.Statter) g2s.Statter
- func ReadAppConfig(config ConfigWrapper, appconfigPath string)
- func ReadEnv(config ConfigWrapper)
- func ReadEnvConfig(config ConfigWrapper, appconfigPath, env string) error
- func SendPeriodicStats(duration string, config ConfigWrapper, callback func(keyprefix string)) error
- func SetupLogger(config ConfigWrapper)
- func WritePid(config ConfigWrapper)
- type ConfigWrapper
- type Configuration
- type HaystackReporter
- type NoOpStatter
- type PrefixStatter
- type StatsdSignedWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadAppConfig ¶
func ReadAppConfig(config ConfigWrapper, appconfigPath string)
Look for an available appconfig environment json file.
func ReadEnv ¶
func ReadEnv(config ConfigWrapper)
Fill out the app config from values in the environment. The env keys are the same as the json marshal keys in the config struct.
func ReadEnvConfig ¶
func ReadEnvConfig(config ConfigWrapper, appconfigPath, env string) error
Decode the environment's JSON file inside the appconfig path into the given config struct.
func SendPeriodicStats ¶
func SendPeriodicStats(duration string, config ConfigWrapper, callback func(keyprefix string)) error
func SetupLogger ¶
func SetupLogger(config ConfigWrapper)
func WritePid ¶
func WritePid(config ConfigWrapper)
Types ¶
type ConfigWrapper ¶
type ConfigWrapper interface { OpstocatConfiguration() *Configuration SetupLogger() }
type Configuration ¶
type Configuration struct { App string Env string `json:"APP_ENV"` AppConfigPath string `json:"APP_CONFIG_PATH"` PidPath string `json:"APP_PIDPATH"` LogFile string `json:"APP_LOG_FILE"` StatsDAddress string `json:"STATSD"` ForceStats string `json:"FORCE_STATS"` HaystackUser string `json:"FAILBOT_USERNAME"` HaystackPassword string `json:"FAILBOT_PASSWORD"` HaystackEndpoint string `json:"FAILBOT_URL"` SyslogAddr string `json:"SYSLOG_ADDR"` Sha string Hostname string }
func NewConfiguration ¶
func NewConfiguration(workingdir string) *Configuration
func (*Configuration) ShowPeriodicStats ¶
func (c *Configuration) ShowPeriodicStats() bool
type HaystackReporter ¶
func NewHaystackReporter ¶
func NewHaystackReporter(config *Configuration) (*HaystackReporter, error)
type NoOpStatter ¶
type NoOpStatter struct{}
func (*NoOpStatter) Counter ¶
func (s *NoOpStatter) Counter(sampleRate float32, bucket string, n ...int)
type PrefixStatter ¶
func (*PrefixStatter) Counter ¶
func (s *PrefixStatter) Counter(sampleRate float32, bucket string, n ...int)
type StatsdSignedWriter ¶
`StatsdSignedWriter` wraps an `io.Writer`, prefixing writes with an HMAC, nonce and timestamp as described in <https://github.com/github/statsd-ruby/pull/9>.
As an example:
conn, err := net.DialTimeout("udp", "endpoint.example.com:8126", 2*time.Second) if err != nil { // handle err } writer := &opstocat.StatsdSignedWriter{Writer: conn, Key: []byte("supersecret")} statter := g2s.New(writer) statter.Counter(1.0, "foo", 1) // :banana: out
Click to show internal directories.
Click to hide internal directories.