Пример #1
0
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
}
Пример #2
0
func NewMetrics() *ServerMetrics {
	m := new(ServerMetrics)

	m.lastQueryCount = qCounter.Count()
	metrics.Register("queries", qCounter)

	m.queriesHistogram = metrics.NewHistogram(metrics.NewUniformSample(1800))
	metrics.Register("queries-histogram", m.queriesHistogram)

	m.queriesHistogramRecent = metrics.NewHistogram(metrics.NewExpDecaySample(600, 0.015))
	metrics.Register("queries-histogram-recent", m.queriesHistogramRecent)

	m.goroutines = metrics.NewGauge()
	metrics.Register("goroutines", m.goroutines)

	return m
}