func NewLocalMetrics(reportInterval time.Duration) *LocalMetrics { metrics := LocalMetrics{ Logger: log.NewPrefixLogger(), reportInterval: reportInterval, windowsCounter: gometrics.NewCounter(), linuxCounter: gometrics.NewCounter(), osxCounter: gometrics.NewCounter(), otherCounter: gometrics.NewCounter(), tunnelMeter: gometrics.NewMeter(), tcpTunnelMeter: gometrics.NewMeter(), httpTunnelMeter: gometrics.NewMeter(), connMeter: gometrics.NewMeter(), lostHeartbeatMeter: gometrics.NewMeter(), connTimer: gometrics.NewTimer(), bytesInCount: gometrics.NewCounter(), bytesOutCount: gometrics.NewCounter(), /* metrics.tunnelGauge = gometrics.NewGauge(), metrics.tcpTunnelGauge = gometrics.NewGauge(), metrics.connGauge = gometrics.NewGauge(), */ } go metrics.Report() return &metrics }
func init() { metrics.windowsCounter = gometrics.NewCounter() metrics.linuxCounter = gometrics.NewCounter() metrics.osxCounter = gometrics.NewCounter() metrics.otherCounter = gometrics.NewCounter() /* metrics.bytesInCount = gometrics.NewCounter() metrics.bytesOutCount = gometrics.NewCounter() */ /* metrics.tunnelGauge = gometrics.NewGauge() metrics.tcpTunnelGauge = gometrics.NewGauge() metrics.requestGauge = gometrics.NewGauge() */ metrics.tunnelMeter = gometrics.NewMeter() metrics.tcpTunnelMeter = gometrics.NewMeter() metrics.requestMeter = gometrics.NewMeter() metrics.lostHeartbeatMeter = gometrics.NewMeter() metrics.requestTimer = gometrics.NewTimer() go func() { time.Sleep(reportInterval) log.Info("Server metrics: %s", MetricsJson()) }() }
func NewHttp() *Http { return &Http{ Txns: util.NewBroadcast(), reqGauge: metrics.NewGauge(), reqMeter: metrics.NewMeter(), reqTimer: metrics.NewTimer(), } }
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(), } }