Example #1
0
func initTaskMetrics() {
	m := expvar.NewMap("tasks")

	for k := range globalPeriodicJobRecipes {
		taskDurations[k] = metrics.NewBiasedHistogram()
	}
	for k := range localPeriodicJobRecipes {
		taskDurations[k] = metrics.NewBiasedHistogram()
	}

	for k, v := range taskDurations {
		m.Set(k+"_ms", &metrics.HistogramExport{v,
			[]float64{0.5, 0.9, 0.99, 0.999},
			[]string{"p50", "p90", "p99", "p999"}})
	}
}
Example #2
0
func clientHTTPHisto(name string) metrics.Histogram {
	histosMu.Lock()
	defer histosMu.Unlock()
	rv, ok := opshistos[name]
	if !ok {
		rv = metrics.NewBiasedHistogram()
		opshistos[name] = rv

		expOpsHistos.Set(name, &metrics.HistogramExport{rv,
			[]float64{0.25, 0.5, 0.75, 0.90, 0.95, 0.99},
			[]string{"p25", "p50", "p75", "p90", "p95", "p99"}})
	}
	return rv
}
Example #3
0
func connPoolHisto(name string) metrics.Histogram {
	histosMu.Lock()
	defer histosMu.Unlock()
	rv, ok := poolhistos[name]
	if !ok {
		rv = metrics.NewBiasedHistogram()
		poolhistos[name] = rv

		expPoolHistos.Set(name, &metrics.HistogramExport{
			Histogram:       rv,
			Percentiles:     []float64{0.25, 0.5, 0.75, 0.90, 0.99},
			PercentileNames: []string{"p25", "p50", "p75", "p90", "p99"}})
	}
	return rv
}
Example #4
0
	flagGraphite        = flag.String("g", "", "host:port for Graphite's Carbon")
	flagLibratoUsername = flag.String("u", "", "librato metrics username")
	flagLibratoToken    = flag.String("t", "", "librato metrics token")
	flagStatHatEmail    = flag.String("s", "", "StatHat email")
)

var (
	mu              sync.Mutex
	counters        = make(map[string]int64)
	histograms      = make(map[string]metrics.Histogram)
	percentiles     = []float64{}
	percentileNames = []string{}

	statRequestCount    = metrics.NewCounter()
	statRequestRate     = metrics.NewMeter()
	statGraphiteLatency = metrics.NewBiasedHistogram()
	statLibratoLatency  = metrics.NewBiasedHistogram()
	statStatHatLatency  = metrics.NewBiasedHistogram()
)

func init() {
	m := expvar.NewMap("metricsd")
	m.Set("requests", statRequestCount)
	m.Set("requests_per_sec", statRequestRate)
	m.Set("graphite_latency_us", &metrics.HistogramExport{Histogram: statGraphiteLatency,
		Percentiles: []float64{0.5, 0.9, 0.99, 0.999}, PercentileNames: []string{"p50", "p90", "p99", "p999"}})
	m.Set("librato_latency_us", &metrics.HistogramExport{Histogram: statLibratoLatency,
		Percentiles: []float64{0.5, 0.9, 0.99, 0.999}, PercentileNames: []string{"p50", "p90", "p99", "p999"}})
	m.Set("stathat_latency_us", &metrics.HistogramExport{Histogram: statStatHatLatency,
		Percentiles: []float64{0.5, 0.9, 0.99, 0.999}, PercentileNames: []string{"p50", "p90", "p99", "p999"}})
}
Example #5
0
	"net"
	"net/http"
	"strings"
	"sync"
	"time"

	cb "github.com/couchbaselabs/go-couchbase"
	_ "github.com/dustin/gomemcached/debug"
	"github.com/samuel/go-metrics/metrics"
)

const minRecordRate = 4096

var (
	taskDurations = map[string]metrics.Histogram{}
	writeBytes    = metrics.NewBiasedHistogram()
	readBytes     = metrics.NewBiasedHistogram()

	cbHistos   = map[string]metrics.Histogram{}
	cbHistosMu = sync.Mutex{}

	expHistos *expvar.Map
)

func init() {
	m := expvar.NewMap("io")

	m.Set("w_B", &metrics.HistogramExport{
		Histogram:       writeBytes,
		Percentiles:     []float64{0.1, 0.2, 0.80, 0.90, 0.99},
		PercentileNames: []string{"p10", "p20", "p80", "p90", "p99"}})