blob: 2066663c691d241be0e92704edf7f13575c8e745 [file] [log] [blame]
khenaidooffe076b2019-01-15 16:08:08 -05001// Copyright 2015 The etcd Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package rafthttp
16
17import "github.com/prometheus/client_golang/prometheus"
18
19var (
20 sentBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
21 Namespace: "etcd",
22 Subsystem: "network",
23 Name: "peer_sent_bytes_total",
24 Help: "The total number of bytes sent to peers.",
25 },
26 []string{"To"},
27 )
28
29 receivedBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
30 Namespace: "etcd",
31 Subsystem: "network",
32 Name: "peer_received_bytes_total",
33 Help: "The total number of bytes received from peers.",
34 },
35 []string{"From"},
36 )
37
38 sentFailures = prometheus.NewCounterVec(prometheus.CounterOpts{
39 Namespace: "etcd",
40 Subsystem: "network",
41 Name: "peer_sent_failures_total",
42 Help: "The total number of send failures from peers.",
43 },
44 []string{"To"},
45 )
46
47 recvFailures = prometheus.NewCounterVec(prometheus.CounterOpts{
48 Namespace: "etcd",
49 Subsystem: "network",
50 Name: "peer_received_failures_total",
51 Help: "The total number of receive failures from peers.",
52 },
53 []string{"From"},
54 )
55
56 snapshotSend = prometheus.NewCounterVec(prometheus.CounterOpts{
57 Namespace: "etcd",
58 Subsystem: "network",
59 Name: "snapshot_send_success",
60 Help: "Total number of successful snapshot sends",
61 },
62 []string{"To"},
63 )
64
65 snapshotSendFailures = prometheus.NewCounterVec(prometheus.CounterOpts{
66 Namespace: "etcd",
67 Subsystem: "network",
68 Name: "snapshot_send_failures",
69 Help: "Total number of snapshot send failures",
70 },
71 []string{"To"},
72 )
73
74 snapshotSendSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{
75 Namespace: "etcd",
76 Subsystem: "network",
77 Name: "snapshot_send_total_duration_seconds",
78 Help: "Total latency distributions of v3 snapshot sends",
79
80 // lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2
81 // highest bucket start of 0.1 sec * 2^9 == 51.2 sec
82 Buckets: prometheus.ExponentialBuckets(0.1, 2, 10),
83 },
84 []string{"To"},
85 )
86
87 snapshotReceive = prometheus.NewCounterVec(prometheus.CounterOpts{
88 Namespace: "etcd",
89 Subsystem: "network",
90 Name: "snapshot_receive_success",
91 Help: "Total number of successful snapshot receives",
92 },
93 []string{"From"},
94 )
95
96 snapshotReceiveFailures = prometheus.NewCounterVec(prometheus.CounterOpts{
97 Namespace: "etcd",
98 Subsystem: "network",
99 Name: "snapshot_receive_failures",
100 Help: "Total number of snapshot receive failures",
101 },
102 []string{"From"},
103 )
104
105 snapshotReceiveSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{
106 Namespace: "etcd",
107 Subsystem: "network",
108 Name: "snapshot_receive_total_duration_seconds",
109 Help: "Total latency distributions of v3 snapshot receives",
110
111 // lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2
112 // highest bucket start of 0.1 sec * 2^9 == 51.2 sec
113 Buckets: prometheus.ExponentialBuckets(0.1, 2, 10),
114 },
115 []string{"From"},
116 )
117
118 rtts = prometheus.NewHistogramVec(prometheus.HistogramOpts{
119 Namespace: "etcd",
120 Subsystem: "network",
121 Name: "peer_round_trip_time_seconds",
122 Help: "Round-Trip-Time histogram between peers.",
123 Buckets: prometheus.ExponentialBuckets(0.0001, 2, 14),
124 },
125 []string{"To"},
126 )
127)
128
129func init() {
130 prometheus.MustRegister(sentBytes)
131 prometheus.MustRegister(receivedBytes)
132 prometheus.MustRegister(sentFailures)
133 prometheus.MustRegister(recvFailures)
134
135 prometheus.MustRegister(snapshotSend)
136 prometheus.MustRegister(snapshotSendFailures)
137 prometheus.MustRegister(snapshotSendSeconds)
138 prometheus.MustRegister(snapshotReceive)
139 prometheus.MustRegister(snapshotReceiveFailures)
140 prometheus.MustRegister(snapshotReceiveSeconds)
141
142 prometheus.MustRegister(rtts)
143}