Documentation ¶
Index ¶
- Variables
- func Close() error
- func Count(name string, value int64, tags map[string]string, rate float64) error
- func Distribution(name string, value float64, tags map[string]string, rate float64) error
- func Gauge(name string, value float64, tags map[string]string, rate float64) error
- func Histogram(name string, value float64, tags map[string]string, rate float64) error
- func ReportRuntimeMetrics()
- func ResponseTime() *timer
- func Runtime()
- func Set(name string, value string, tags map[string]string, rate float64) error
- func SetEmpireDefaultTags()
- func Time(name string, tags map[string]string, rate float64) *timer
- func TimeInMilliseconds(name string, value float64, tags map[string]string, rate float64) error
- type DataDogMetricsReporter
- func (c *DataDogMetricsReporter) Close() error
- func (c *DataDogMetricsReporter) Count(name string, value int64, tags map[string]string, rate float64) error
- func (c *DataDogMetricsReporter) Distribution(name string, value float64, tags map[string]string, rate float64) error
- func (c *DataDogMetricsReporter) Gauge(name string, value float64, tags map[string]string, rate float64) error
- func (c *DataDogMetricsReporter) Histogram(name string, value float64, tags map[string]string, rate float64) error
- func (c *DataDogMetricsReporter) Set(name string, value string, tags map[string]string, rate float64) error
- func (c *DataDogMetricsReporter) TimeInMilliseconds(name string, value float64, tags map[string]string, rate float64) error
- type MetricsReporter
- type NoopMetricsReporter
- func (c *NoopMetricsReporter) Close() error
- func (c *NoopMetricsReporter) Count(name string, value int64, tags map[string]string, rate float64) error
- func (c *NoopMetricsReporter) Distribution(name string, value float64, tags map[string]string, rate float64) error
- func (c *NoopMetricsReporter) Gauge(name string, value float64, tags map[string]string, rate float64) error
- func (c *NoopMetricsReporter) Histogram(name string, value float64, tags map[string]string, rate float64) error
- func (c *NoopMetricsReporter) Set(name string, value string, tags map[string]string, rate float64) error
- func (c *NoopMetricsReporter) TimeInMilliseconds(name string, value float64, tags map[string]string, rate float64) error
Constants ¶
This section is empty.
Variables ¶
View Source
var RuntimeMetricsSamplingInterval time.Duration = 30 * time.Second
sets how often the metrics Runtime will sample and emit stats.
Functions ¶
func Distribution ¶
func ReportRuntimeMetrics ¶
func ReportRuntimeMetrics()
Samples and reports current runtime status once.
func ResponseTime ¶
func ResponseTime() *timer
ResponseTime is a shorthand for reporting web response time.
Usage:
t := metrics.ResponseTime() defer t.Done() ... t.SetTags(map[string]string{"route":"GET /foo/bar"})
func Runtime ¶
func Runtime()
Runtime enters into a loop, sampling and outputing the runtime stats periodically. Usage:
func main() { ... go metrics.Runtime() ... }
func SetEmpireDefaultTags ¶
func SetEmpireDefaultTags()
SetEmpireDefaultTags sets default tags reflecting the empire environment to each metric
Types ¶
type DataDogMetricsReporter ¶
type DataDogMetricsReporter struct {
// contains filtered or unexported fields
}
func NewDataDogMetricsReporter ¶
func NewDataDogMetricsReporter(addr string) (*DataDogMetricsReporter, error)
func (*DataDogMetricsReporter) Close ¶
func (c *DataDogMetricsReporter) Close() error
func (*DataDogMetricsReporter) Distribution ¶
func (*DataDogMetricsReporter) TimeInMilliseconds ¶
type MetricsReporter ¶
type MetricsReporter interface { Count(name string, value int64, tags map[string]string, rate float64) error Gauge(name string, value float64, tags map[string]string, rate float64) error Histogram(name string, value float64, tags map[string]string, rate float64) error Distribution(name string, value float64, tags map[string]string, rate float64) error Set(name string, value string, tags map[string]string, rate float64) error TimeInMilliseconds(name string, value float64, tags map[string]string, rate float64) error Close() error }
var Reporter MetricsReporter
Usage:
metrics.SetEmpireDefaultTags() metrics.Reporter, _ = NewDataDogMetricsReporter("statsd:2026") defer metrics.Close() ... metrics.Count("mycount", 1, map[string]string{"feature_version":"v1"}, 1.0)
type NoopMetricsReporter ¶
type NoopMetricsReporter struct{}
func (*NoopMetricsReporter) Close ¶
func (c *NoopMetricsReporter) Close() error
func (*NoopMetricsReporter) Distribution ¶
func (*NoopMetricsReporter) TimeInMilliseconds ¶
Click to show internal directories.
Click to hide internal directories.