khenaidoo | 59ce9dd | 2019-11-11 13:05:32 -0500 | [diff] [blame] | 1 | // 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 | |
| 15 | package rafthttp |
| 16 | |
| 17 | import "github.com/prometheus/client_golang/prometheus" |
| 18 | |
| 19 | var ( |
| 20 | activePeers = prometheus.NewGaugeVec(prometheus.GaugeOpts{ |
| 21 | Namespace: "etcd", |
| 22 | Subsystem: "network", |
| 23 | Name: "active_peers", |
| 24 | Help: "The current number of active peer connections.", |
| 25 | }, |
| 26 | []string{"Local", "Remote"}, |
| 27 | ) |
| 28 | |
| 29 | disconnectedPeers = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 30 | Namespace: "etcd", |
| 31 | Subsystem: "network", |
| 32 | Name: "disconnected_peers_total", |
| 33 | Help: "The total number of disconnected peers.", |
| 34 | }, |
| 35 | []string{"Local", "Remote"}, |
| 36 | ) |
| 37 | |
| 38 | sentBytes = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 39 | Namespace: "etcd", |
| 40 | Subsystem: "network", |
| 41 | Name: "peer_sent_bytes_total", |
| 42 | Help: "The total number of bytes sent to peers.", |
| 43 | }, |
| 44 | []string{"To"}, |
| 45 | ) |
| 46 | |
| 47 | receivedBytes = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 48 | Namespace: "etcd", |
| 49 | Subsystem: "network", |
| 50 | Name: "peer_received_bytes_total", |
| 51 | Help: "The total number of bytes received from peers.", |
| 52 | }, |
| 53 | []string{"From"}, |
| 54 | ) |
| 55 | |
| 56 | sentFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 57 | Namespace: "etcd", |
| 58 | Subsystem: "network", |
| 59 | Name: "peer_sent_failures_total", |
| 60 | Help: "The total number of send failures from peers.", |
| 61 | }, |
| 62 | []string{"To"}, |
| 63 | ) |
| 64 | |
| 65 | recvFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 66 | Namespace: "etcd", |
| 67 | Subsystem: "network", |
| 68 | Name: "peer_received_failures_total", |
| 69 | Help: "The total number of receive failures from peers.", |
| 70 | }, |
| 71 | []string{"From"}, |
| 72 | ) |
| 73 | |
| 74 | snapshotSend = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 75 | Namespace: "etcd", |
| 76 | Subsystem: "network", |
| 77 | Name: "snapshot_send_success", |
| 78 | Help: "Total number of successful snapshot sends", |
| 79 | }, |
| 80 | []string{"To"}, |
| 81 | ) |
| 82 | |
| 83 | snapshotSendInflights = prometheus.NewGaugeVec(prometheus.GaugeOpts{ |
| 84 | Namespace: "etcd", |
| 85 | Subsystem: "network", |
| 86 | Name: "snapshot_send_inflights_total", |
| 87 | Help: "Total number of inflight snapshot sends", |
| 88 | }, |
| 89 | []string{"To"}, |
| 90 | ) |
| 91 | |
| 92 | snapshotSendFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 93 | Namespace: "etcd", |
| 94 | Subsystem: "network", |
| 95 | Name: "snapshot_send_failures", |
| 96 | Help: "Total number of snapshot send failures", |
| 97 | }, |
| 98 | []string{"To"}, |
| 99 | ) |
| 100 | |
| 101 | snapshotSendSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{ |
| 102 | Namespace: "etcd", |
| 103 | Subsystem: "network", |
| 104 | Name: "snapshot_send_total_duration_seconds", |
| 105 | Help: "Total latency distributions of v3 snapshot sends", |
| 106 | |
| 107 | // lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2 |
| 108 | // highest bucket start of 0.1 sec * 2^9 == 51.2 sec |
| 109 | Buckets: prometheus.ExponentialBuckets(0.1, 2, 10), |
| 110 | }, |
| 111 | []string{"To"}, |
| 112 | ) |
| 113 | |
| 114 | snapshotReceive = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 115 | Namespace: "etcd", |
| 116 | Subsystem: "network", |
| 117 | Name: "snapshot_receive_success", |
| 118 | Help: "Total number of successful snapshot receives", |
| 119 | }, |
| 120 | []string{"From"}, |
| 121 | ) |
| 122 | |
| 123 | snapshotReceiveInflights = prometheus.NewGaugeVec(prometheus.GaugeOpts{ |
| 124 | Namespace: "etcd", |
| 125 | Subsystem: "network", |
| 126 | Name: "snapshot_receive_inflights_total", |
| 127 | Help: "Total number of inflight snapshot receives", |
| 128 | }, |
| 129 | []string{"From"}, |
| 130 | ) |
| 131 | |
| 132 | snapshotReceiveFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ |
| 133 | Namespace: "etcd", |
| 134 | Subsystem: "network", |
| 135 | Name: "snapshot_receive_failures", |
| 136 | Help: "Total number of snapshot receive failures", |
| 137 | }, |
| 138 | []string{"From"}, |
| 139 | ) |
| 140 | |
| 141 | snapshotReceiveSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{ |
| 142 | Namespace: "etcd", |
| 143 | Subsystem: "network", |
| 144 | Name: "snapshot_receive_total_duration_seconds", |
| 145 | Help: "Total latency distributions of v3 snapshot receives", |
| 146 | |
| 147 | // lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2 |
| 148 | // highest bucket start of 0.1 sec * 2^9 == 51.2 sec |
| 149 | Buckets: prometheus.ExponentialBuckets(0.1, 2, 10), |
| 150 | }, |
| 151 | []string{"From"}, |
| 152 | ) |
| 153 | |
| 154 | rttSec = prometheus.NewHistogramVec(prometheus.HistogramOpts{ |
| 155 | Namespace: "etcd", |
| 156 | Subsystem: "network", |
| 157 | Name: "peer_round_trip_time_seconds", |
| 158 | Help: "Round-Trip-Time histogram between peers", |
| 159 | |
| 160 | // lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2 |
| 161 | // highest bucket start of 0.0001 sec * 2^15 == 3.2768 sec |
| 162 | Buckets: prometheus.ExponentialBuckets(0.0001, 2, 16), |
| 163 | }, |
| 164 | []string{"To"}, |
| 165 | ) |
| 166 | ) |
| 167 | |
| 168 | func init() { |
| 169 | prometheus.MustRegister(activePeers) |
| 170 | prometheus.MustRegister(disconnectedPeers) |
| 171 | prometheus.MustRegister(sentBytes) |
| 172 | prometheus.MustRegister(receivedBytes) |
| 173 | prometheus.MustRegister(sentFailures) |
| 174 | prometheus.MustRegister(recvFailures) |
| 175 | |
| 176 | prometheus.MustRegister(snapshotSend) |
| 177 | prometheus.MustRegister(snapshotSendInflights) |
| 178 | prometheus.MustRegister(snapshotSendFailures) |
| 179 | prometheus.MustRegister(snapshotSendSeconds) |
| 180 | prometheus.MustRegister(snapshotReceive) |
| 181 | prometheus.MustRegister(snapshotReceiveInflights) |
| 182 | prometheus.MustRegister(snapshotReceiveFailures) |
| 183 | prometheus.MustRegister(snapshotReceiveSeconds) |
| 184 | |
| 185 | prometheus.MustRegister(rttSec) |
| 186 | } |