Exemplo n.º 1
0
			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() {
Exemplo n.º 2
0
			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()
}