| 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 |
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 |
rtts = prometheus.NewHistogramVec(prometheus.HistogramOpts{ |
| 57 |
Namespace: "etcd", |
| 58 |
Subsystem: "network", |
| 59 |
Name: "peer_round_trip_time_seconds", |
| 60 |
Help: "Round-Trip-Time histogram between peers.", |
| 61 |
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 14), |
| 62 |
}, |
| 63 |
[]string{"To"}, |
| 64 |
) |
| 65 |
) |
| 66 |
|
| 67 |
func init() { |
| 68 |
prometheus.MustRegister(sentBytes) |
| 69 |
prometheus.MustRegister(receivedBytes) |
| 70 |
prometheus.MustRegister(sentFailures) |
| 71 |
prometheus.MustRegister(recvFailures) |
| 72 |
prometheus.MustRegister(rtts) |
| 73 |
} |