Documentation ¶
Index ¶
- func AsStatField(input string) string
- func HTTPReturnJson(w http.ResponseWriter, result interface{})
- func NewStatsd(config *StatsdConfig) (*theStatsdReporter, error)
- func StartReportingMemoryAndGC(reporter Statter, d time.Duration)
- type Aggregator
- func (r *Aggregator) Gauge(component string, stat string, value int64, rate float32)
- func (r *Aggregator) Inc(component string, stat string, value int64, rate float32)
- func (r *Aggregator) Measure(component string, stat string, value int64, rate float32)
- func (r *Aggregator) NewTimer(component string, stat string, rate float32) *Timer
- func (r *Aggregator) Time(component string, stat string, value time.Duration, rate float32)
- type Config
- type HTTPSubHandler
- type LogReporter
- type MultiStatter
- func (s *MultiStatter) Gauge(component string, stat string, value int64, rate float32)
- func (s *MultiStatter) Inc(component string, stat string, value int64, rate float32)
- func (s *MultiStatter) Measure(component string, stat string, value int64, rate float32)
- func (s *MultiStatter) NewTimer(component string, stat string, rate float32) *Timer
- func (s *MultiStatter) Time(component string, stat string, value time.Duration, rate float32)
- type NewRelicAgentConfig
- type NewRelicReporter
- type NewRelicReporterConfig
- type NilStatter
- func (n *NilStatter) Gauge(component string, stat string, value int64, rate float32)
- func (n *NilStatter) Inc(component string, stat string, value int64, rate float32)
- func (n *NilStatter) Measure(component string, stat string, value int64, rate float32)
- func (r *NilStatter) NewTimer(component string, stat string, rate float32) *Timer
- func (n *NilStatter) Time(component string, stat string, value time.Duration, rate float32)
- type StatHatReporterConfig
- type StatsdConfig
- type Statter
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsStatField ¶
Convert a string to a stat name by replacing '.' with '_', lowercasing the string and trimming it. Doesn't do any validation, so do try this out locally before sending stats.
func HTTPReturnJson ¶
func HTTPReturnJson(w http.ResponseWriter, result interface{})
func NewStatsd ¶
func NewStatsd(config *StatsdConfig) (*theStatsdReporter, error)
The config.Prefix is sent before each message and can be used to set API keys. The prefix is used as the key prefix. If config is nil, creates a noop reporter.
st, e := NewStatsd(config, "ironmq") st.Inc("enqueue", 1) -> Actually records to key ironmq.enqueue.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator collects a stats and merges them together if they've been added previously. Useful for reporters that have low throughput ie stathat.
func (*Aggregator) Gauge ¶
func (r *Aggregator) Gauge(component string, stat string, value int64, rate float32)
func (*Aggregator) Inc ¶
func (r *Aggregator) Inc(component string, stat string, value int64, rate float32)
func (*Aggregator) Measure ¶
func (r *Aggregator) Measure(component string, stat string, value int64, rate float32)
type Config ¶
type Config struct { Interval float64 `json:"interval" envconfig:"STATS_INTERVAL"` // seconds History int // minutes Log string `json:"log" envconfig:"STATS_LOG"` StatHat *StatHatReporterConfig NewRelic *NewRelicReporterConfig Statsd *StatsdConfig GCStats int `json:"gc_stats" envconfig:"GC_STATS"` // seconds }
type HTTPSubHandler ¶
type HTTPSubHandler interface {
HTTPHandler(relativeUrl []string, w http.ResponseWriter, r *http.Request)
}
type LogReporter ¶
type LogReporter struct { }
func NewLogReporter ¶
func NewLogReporter() *LogReporter
type MultiStatter ¶
type MultiStatter struct {
// contains filtered or unexported fields
}
func (*MultiStatter) Gauge ¶
func (s *MultiStatter) Gauge(component string, stat string, value int64, rate float32)
func (*MultiStatter) Inc ¶
func (s *MultiStatter) Inc(component string, stat string, value int64, rate float32)
func (*MultiStatter) Measure ¶
func (s *MultiStatter) Measure(component string, stat string, value int64, rate float32)
type NewRelicAgentConfig ¶
type NewRelicReporter ¶
type NewRelicReporter struct { Agent *agent LicenseKey string }
func NewNewRelicReporter ¶
func NewNewRelicReporter(version string, licenseKey string) *NewRelicReporter
type NewRelicReporterConfig ¶
type NewRelicReporterConfig struct { Agent *NewRelicAgentConfig LicenseKey string `json:"license_key"` }
type NilStatter ¶
type NilStatter struct{}
func (*NilStatter) Gauge ¶
func (n *NilStatter) Gauge(component string, stat string, value int64, rate float32)
func (*NilStatter) Inc ¶
func (n *NilStatter) Inc(component string, stat string, value int64, rate float32)
func (*NilStatter) Measure ¶
func (n *NilStatter) Measure(component string, stat string, value int64, rate float32)
type StatHatReporterConfig ¶
type StatsdConfig ¶
type Statter ¶
type Statter interface { Inc(component string, stat string, value int64, rate float32) Gauge(component string, stat string, value int64, rate float32) Measure(component string, stat string, value int64, rate float32) Time(component string, stat string, value time.Duration, rate float32) NewTimer(component string, stat string, rate float32) *Timer }
Click to show internal directories.
Click to hide internal directories.