Exemplo n.º 1
0
func TestPrometheusHistogram(t *testing.T) {
	buckets := []float64{20, 40, 60, 80, 100}
	h := prometheus.NewHistogram(stdprometheus.HistogramOpts{
		Namespace: "test",
		Subsystem: "prometheus_histogram_histogram",
		Name:      "quux",
		Help:      "Qwerty asdf.",
		Buckets:   buckets,
	}, []string{})

	const mean, stdev int64 = 50, 10
	teststat.PopulateNormalHistogram(t, h, 34, mean, stdev)
	teststat.AssertPrometheusBucketedHistogram(t, "test_prometheus_histogram_histogram_quux_bucket", mean, stdev, buckets)
}
Exemplo n.º 2
0
	mReqCount = kitprom.NewCounter(prometheus.CounterOpts{
		Namespace: "agostle",
		Subsystem: "http",
		Name:      "requests",
		Help:      "The HTTP requests accepted",
	}, []string{"path"})
	mReqSize = kitprom.NewSummary(prometheus.SummaryOpts{
		Namespace: "agostle",
		Subsystem: "http",
		Name:      "request_size_bytes",
		Help:      "The request size in bytes",
	}, []string{"path"})
	mRespStatus = kitprom.NewHistogram(prometheus.HistogramOpts{
		Namespace: "agostle",
		Subsystem: "http",
		Name:      "response_status",
		Help:      "The response status code",
		Buckets:   httpBuckets,
	}, []string{"path"})
	mRespSize = kitprom.NewSummary(prometheus.SummaryOpts{
		Namespace: "agostle",
		Subsystem: "http",
		Name:      "response_size_bytes",
		Help:      "The response size in bytes",
	}, []string{"path"})
	mRespTime = kitprom.NewSummary(prometheus.SummaryOpts{
		Namespace: "agostle",
		Subsystem: "http",
		Name:      "response_time_microseconds",
		Help:      "The response time in microseconds",
	}, []string{"path"})