func NewClientMetrics() *ClientMetrics { return &ClientMetrics{ connGauge: metrics.NewGauge(), connMeter: metrics.NewMeter(), connTimer: metrics.NewTimer(), proxySetupTimer: metrics.NewTimer(), bytesIn: metrics.NewHistogram(metrics.NewExpDecaySample(sampleSize, sampleAlpha)), bytesOut: metrics.NewHistogram(metrics.NewExpDecaySample(sampleSize, sampleAlpha)), bytesInCount: metrics.NewCounter(), bytesOutCount: metrics.NewCounter(), } }
func NewMetricsDB() *MetricsDB { return &MetricsDB{ connections: mt.NewHistogram(mt.NewExpDecaySample(1028, 0.015)), queries: mt.NewMeter(), executes: mt.NewMeter(), rows: mt.NewMeter(), affects: mt.NewMeter(), timers: &MeticsTimers{timers: make(map[string]mt.Timer)}, } }
func NewMetricsHttp() *MetricsHttp { return &MetricsHttp{ clients: mt.NewHistogram(mt.NewExpDecaySample(1028, 0.015)), clientsCounter: mt.NewCounter(), requests: mt.NewTimer(), status2xx: mt.NewMeter(), status3xx: mt.NewMeter(), status4xx: mt.NewMeter(), status5xx: mt.NewMeter(), } }
func init() { metrics = &metricsDB{ connections: mt.NewHistogram(mt.NewExpDecaySample(1028, 0.015)), queries: mt.NewMeter(), executes: mt.NewMeter(), rows: mt.NewMeter(), affects: mt.NewMeter(), begins: mt.NewMeter(), commits: mt.NewMeter(), rollbacks: mt.NewMeter(), } timers = &timersDB{timers: make(map[string]mt.Timer)} }
func NewHeartbeatStatusTracker() StatusTracker { h := &heartbeatStatusTracker{} h.currentStatusGauge = metrics.GetOrRegisterGauge("current-status", metrics.DefaultRegistry) h.taskDurations = make(map[TaskType]metrics.Histogram) for t := UPDATE_AND_BUILD; t <= POLL; t++ { // Using the values from metrics.NewTimer(). s := metrics.NewExpDecaySample(1028, 0.015) h.taskDurations[t] = metrics.GetOrRegisterHistogram(fmt.Sprintf("duration-%s", t), metrics.DefaultRegistry, s) } h.lastSuccessTime = make(map[TaskType]time.Time) h.lastFailureTime = make(map[TaskType]time.Time) return h }
func NewHttpMetric() *HttpMetric { x := &HttpMetric{ Requests: metrics.NewCounter(), Rate: metrics.NewMeter(), Responses2xx: metrics.NewCounter(), Responses3xx: metrics.NewCounter(), Responses4xx: metrics.NewCounter(), Responses5xx: metrics.NewCounter(), ResponsesXxx: metrics.NewCounter(), Latency: metrics.NewHistogram(metrics.NewExpDecaySample(1028, 0.015)), } return x }
func NewMetrics() *ServerMetrics { m := new(ServerMetrics) m.qCounter = metrics.GetOrRegisterMeter("queries", nil) m.lastQueryCount = m.qCounter.Count() m.queriesHistogram = metrics.GetOrRegisterHistogram( "queries-histogram", nil, metrics.NewExpDecaySample(600, 0.015), ) m.goroutines = metrics.GetOrRegisterGauge("goroutines", nil) return m }
func NewProxyMetrics() ProxyMetrics { pm := ProxyMetrics{ Requests: gmetrics.NewMeter(), CmdReply: gmetrics.NewMeter(), CmdForward: gmetrics.NewMeter(), RequestBodySize: gmetrics.NewHistogram(gmetrics.NewExpDecaySample(1028, 0.015)), } gmetrics.Register("vulcan.proxy.requests", pm.Requests) gmetrics.Register("vulcan.proxy.cmd_reply", pm.CmdReply) gmetrics.Register("vulcan.proxy.cmd_forward", pm.CmdForward) gmetrics.Register("vulcan.proxy.request_body_size", pm.RequestBodySize) return pm }
func addGCMetrics(p *newrelic.Plugin) { numGC := metrics.NewMeter() pauseDur := metrics.NewMeter() pauseTime := metrics.NewHistogram(metrics.NewExpDecaySample(10000, 0.015)) gcr := &gcReader{ sampleRate: time.Second * 10, numGC: numGC, pauseDur: pauseDur, pauseTime: pauseTime, } gcr.Run() nrmetrics.AddMeterMetric(p, numGC, nrmetrics.MetricConfig{Name: "GC/GC Pauses Per Second", Unit: "pauses", Rate1: true, Rate5: true, Rate15: true}) nrmetrics.AddMeterMetric(p, pauseDur, nrmetrics.MetricConfig{Name: "GC/GC Pause Time Per Second", Unit: "nanoseconds", Rate1: true, Rate5: true, Rate15: true}) nrmetrics.AddHistogramMetric(p, pauseTime, nrmetrics.MetricConfig{ Name: "GC/GC Time Per Pause", Unit: "pauses", Duration: time.Microsecond, Mean: true, Percentiles: []float64{0.5, 0.75, 0.9, 0.99, 0.999}, }) }
// conf.Environment, conf.Region func NewProxyMetrics(env string, region string) ProxyMetrics { prefix := buildPrefix(env, region) pm := ProxyMetrics{ Msgs: gmetrics.NewMeter(), MsgReply: gmetrics.NewMeter(), MsgForward: gmetrics.NewMeter(), MsgBodySize: gmetrics.NewHistogram(gmetrics.NewExpDecaySample(1028, 0.015)), Connects: gmetrics.NewMeter(), Connections: gmetrics.NewGauge(), } gmetrics.Register(prefix+".proxy.msgs", pm.Msgs) gmetrics.Register(prefix+".proxy.msg_reply", pm.Msgs) gmetrics.Register(prefix+".proxy.msg_forward", pm.Msgs) gmetrics.Register(prefix+".proxy.msg_body_size", pm.MsgBodySize) gmetrics.Register(prefix+".proxy.connects", pm.Connects) gmetrics.Register(prefix+".proxy.connections", pm.Connections) return pm }
func (g *goMetricRegistry) Histogram(name string) accounting.Histogram { return metrics.GetOrRegisterHistogram(name, metrics.DefaultRegistry, metrics.NewExpDecaySample(1028, 0.015)) }