aboutsummaryrefslogtreecommitdiff
path: root/pkg/instance/metric.go
blob: cbd02239d2f82b6eba7d379a8f8db41cd5ed3b67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package instance

import (
	"github.com/google/trillian/monitoring"
	"github.com/google/trillian/monitoring/prometheus"
)

var (
	reqcnt  monitoring.Counter   // number of incoming http requests
	rspcnt  monitoring.Counter   // number of valid http responses
	latency monitoring.Histogram // request-response latency
)

func init() {
	mf := prometheus.MetricFactory{}
	reqcnt = mf.NewCounter("http_req", "number of http requests", "logid", "endpoint")
	rspcnt = mf.NewCounter("http_rsp", "number of http requests", "logid", "endpoint", "status")
	latency = mf.NewHistogram("http_latency", "http request-response latency", "logid", "endpoint", "status")
}