Repository: etcd-io/etcd
File: server/etcdserver/api/v3rpc/metrics.go (Go)

Code before:
			Namespace: "etcd",
			Subsystem: "network",
			Name:      "server_stream_failures_total",
			Help:      "The total number of stream failures from the local server.",
		},
		[]string{"Type", "API"},
	)

	clientRequests = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "etcd",
			Subsystem: "server",
			Name:      "client_requests_total",
			Help:      "The total number of client requests per client version.",
		},
		[]string{"type", "client_api_version"},
	)

	watchSendLoopWatchStreamTime = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "etcd_debugging",
			Subsystem: "server",
			Name:      "watch_send_loop_watch_stream_time_seconds",
			Help:      "The total duration in seconds of running through the send loop watch stream response all events.",
		},
	)

	watchSendLoopWatchStreamTimePerEvent = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "etcd_debugging",
			Subsystem: "server",
			Name:      "watch_send_loop_watch_stream_time_per_event_seconds",
			Help:      "The average duration in seconds of running through the send loop watch stream response, per event.",
			// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2
			// highest bucket start of 0.0001 sec * 2^15 == 3.2768 sec
			Buckets: prometheus.ExponentialBuckets(0.0001, 2, 16),
		},
	)

	watchSendLoopControlStreamTime = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "etcd_debugging",
			Subsystem: "server",
			Name:      "watch_send_loop_control_stream_time_seconds",
			Help:      "The total duration in seconds of running through the send loop control stream response.",
			// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2
			// highest bucket start of 0.0001 sec * 2^15 == 3.2768 sec
			Buckets: prometheus.ExponentialBuckets(0.0001, 2, 16),
		},
	)


Review comment (suggestion):
Not sure why you do not define bucket for this histogram metrics.  Have you verified the default bucket `DefBuckets` will be used here? It seems not based on comment below. It should be easy to double check.



> // Buckets defines the buckets into which observations are counted. Each
> 	// element in the slice is the upper inclusive bound of a bucket. The
> 	// values must be sorted in strictly increasing order. There is no need
> 	// to add a highest bucket with +Inf bound, it will be added
> 	// implicitly. If Buckets is left as nil or set to a slice of length
> 	// zero, it is replaced by default buckets. The default buckets are
> 	// DefBuckets if no buckets for a native histogram (see below) are used,
> 	// otherwise the default is no buckets. (In other words, if you want to
> 	// use both regular buckets and buckets for a native histogram, you have
> 	// to define the regular buckets here explicitly.)
> 	Buckets [][float64](https://pkg.go.dev/builtin#float64)

Code after:
			Namespace: "etcd",
			Subsystem: "network",
			Name:      "server_stream_failures_total",
			Help:      "The total number of stream failures from the local server.",
		},
		[]string{"Type", "API"},
	)

	clientRequests = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "etcd",
			Subsystem: "server",
			Name:      "client_requests_total",
			Help:      "The total number of client requests per client version.",
		},
		[]string{"type", "client_api_version"},
	)

	watchSendLoopWatchStreamDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "etcd_debugging",
			Subsystem: "server",
			Name:      "watch_send_loop_watch_stream_duration_seconds",
			Help:      "The total duration in seconds of running through the send loop watch stream response all events.",
			// lowest bucket start of upper bound 0.001 sec (1 ms) with factor 2
			// highest bucket start of 0.001 sec * 2^13 == 8.192 sec
			Buckets: prometheus.ExponentialBuckets(0.001, 2, 14),
		},
	)

	watchSendLoopWatchStreamDurationPerEvent = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "etcd_debugging",
			Subsystem: "server",
			Name:      "watch_send_loop_watch_stream_duration_per_event_seconds",
			Help:      "The average duration in seconds of running through the send loop watch stream response, per event.",
			// lowest bucket start of upper bound 0.001 sec (1 ms) with factor 2
			// highest bucket start of 0.001 sec * 2^13 == 8.192 sec
			Buckets: prometheus.ExponentialBuckets(0.001, 2, 14),
		},
	)

	watchSendLoopControlStreamDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "etcd_debugging",
			Subsystem: "server",
			Name:      "watch_send_loop_control_stream_duration_seconds",
			Help:      "The total duration in seconds of running through the send loop control stream response.",
			// lowest bucket start of upper bound 0.001 sec (1 ms) with factor 2
			// highest bucket start of 0.001 sec * 2^13 == 8.192 sec
			Buckets: prometheus.ExponentialBuckets(0.001, 2, 14),