示例#1
0
文件: metrics.go 项目: algoadv/etcd
			Help:      "Counter of requests fully handled (by authoratitave servers)",
		}, []string{"method", "code"})

	requestsDropped = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "etcd",
			Subsystem: "proxy",
			Name:      "dropped_total",
			Help:      "Counter of requests dropped on the proxy.",
		}, []string{"method", "proxying_error"})

	requestsHandlingTime = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "etcd",
			Subsystem: "proxy",
			Name:      "handling_duration_seconds",
			Help: "Bucketed histogram of handling time of successful events (non-watches), by method " +
				"(GET/PUT etc.).",
			Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13),
		}, []string{"method"})
)

type forwardingError string

const (
	zeroEndpoints         forwardingError = "zero_endpoints"
	failedSendingRequest  forwardingError = "failed_sending_request"
	failedGettingResponse forwardingError = "failed_getting_response"
)

func init() {
示例#2
0
文件: metrics.go 项目: algoadv/etcd
			Name:      "received_total",
			Help:      "Counter of requests received into the system (successfully parsed and authd).",
		}, []string{"method"})

	failedEvents = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "etcd",
			Subsystem: "http",
			Name:      "failed_total",
			Help:      "Counter of handle failures of requests (non-watches), by method (GET/PUT etc.) and code (400, 500 etc.).",
		}, []string{"method", "code"})

	successfulEventsHandlingTime = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "etcd",
			Subsystem: "http",
			Name:      "successful_duration_second",
			Help:      "Bucketed histogram of processing time (s) of successfully handled requests (non-watches), by method (GET/PUT etc.).",
			Buckets:   prometheus.ExponentialBuckets(0.0005, 2, 13),
		}, []string{"method"})
)

func init() {
	prometheus.MustRegister(incomingEvents)
	prometheus.MustRegister(failedEvents)
	prometheus.MustRegister(successfulEventsHandlingTime)
}

func reportRequestReceived(request etcdserverpb.Request) {
	incomingEvents.WithLabelValues(methodFromRequest(request)).Inc()
}