format all prometheus metrics to ensure nice indent

Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
This commit is contained in:
Benjamin Wang
2025-01-29 13:42:06 +00:00
parent 35d20d1e08
commit 614640f1c2
11 changed files with 310 additions and 245 deletions

View File

@ -21,12 +21,13 @@ import (
) )
var ( var (
currentAuthRevision = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ currentAuthRevision = prometheus.NewGaugeFunc(
Namespace: "etcd_debugging", prometheus.GaugeOpts{
Subsystem: "auth", Namespace: "etcd_debugging",
Name: "revision", Subsystem: "auth",
Help: "The current revision of auth store.", Name: "revision",
}, Help: "The current revision of auth store.",
},
func() float64 { func() float64 {
reportCurrentAuthRevMu.RLock() reportCurrentAuthRevMu.RLock()
defer reportCurrentAuthRevMu.RUnlock() defer reportCurrentAuthRevMu.RUnlock()

View File

@ -120,20 +120,22 @@ var (
Name: "health_failures", Name: "health_failures",
Help: "The total number of failed health checks", Help: "The total number of failed health checks",
}) })
healthCheckGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ healthCheckGauge = prometheus.NewGaugeVec(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "server", Namespace: "etcd",
Name: "healthcheck", Subsystem: "server",
Help: "The result of each kind of healthcheck.", Name: "healthcheck",
}, Help: "The result of each kind of healthcheck.",
},
[]string{"type", "name"}, []string{"type", "name"},
) )
healthCheckCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ healthCheckCounter = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "server", Namespace: "etcd",
Name: "healthchecks_total", Subsystem: "server",
Help: "The total number of each kind of healthcheck.", Name: "healthchecks_total",
}, Help: "The total number of each kind of healthcheck.",
},
[]string{"type", "name", "status"}, []string{"type", "name", "status"},
) )
) )

View File

@ -17,19 +17,22 @@ package membership
import "github.com/prometheus/client_golang/prometheus" import "github.com/prometheus/client_golang/prometheus"
var ( var (
ClusterVersionMetrics = prometheus.NewGaugeVec(prometheus.GaugeOpts{ ClusterVersionMetrics = prometheus.NewGaugeVec(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "cluster", Namespace: "etcd",
Name: "version", Subsystem: "cluster",
Help: "Which version is running. 1 for 'cluster_version' label with current cluster version", Name: "version",
}, Help: "Which version is running. 1 for 'cluster_version' label with current cluster version",
[]string{"cluster_version"}) },
knownPeers = prometheus.NewGaugeVec(prometheus.GaugeOpts{ []string{"cluster_version"},
Namespace: "etcd", )
Subsystem: "network", knownPeers = prometheus.NewGaugeVec(
Name: "known_peers", prometheus.GaugeOpts{
Help: "The current number of known peers.", Namespace: "etcd",
}, Subsystem: "network",
Name: "known_peers",
Help: "The current number of known peers.",
},
[]string{"Local", "Remote"}, []string{"Local", "Remote"},
) )
isLearner = prometheus.NewGauge(prometheus.GaugeOpts{ isLearner = prometheus.NewGauge(prometheus.GaugeOpts{

View File

@ -17,150 +17,165 @@ package rafthttp
import "github.com/prometheus/client_golang/prometheus" import "github.com/prometheus/client_golang/prometheus"
var ( var (
activePeers = prometheus.NewGaugeVec(prometheus.GaugeOpts{ activePeers = prometheus.NewGaugeVec(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "network", Namespace: "etcd",
Name: "active_peers", Subsystem: "network",
Help: "The current number of active peer connections.", Name: "active_peers",
}, Help: "The current number of active peer connections.",
},
[]string{"Local", "Remote"}, []string{"Local", "Remote"},
) )
disconnectedPeers = prometheus.NewCounterVec(prometheus.CounterOpts{ disconnectedPeers = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "disconnected_peers_total", Subsystem: "network",
Help: "The total number of disconnected peers.", Name: "disconnected_peers_total",
}, Help: "The total number of disconnected peers.",
},
[]string{"Local", "Remote"}, []string{"Local", "Remote"},
) )
sentBytes = prometheus.NewCounterVec(prometheus.CounterOpts{ sentBytes = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "peer_sent_bytes_total", Subsystem: "network",
Help: "The total number of bytes sent to peers.", Name: "peer_sent_bytes_total",
}, Help: "The total number of bytes sent to peers.",
},
[]string{"To"}, []string{"To"},
) )
receivedBytes = prometheus.NewCounterVec(prometheus.CounterOpts{ receivedBytes = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "peer_received_bytes_total", Subsystem: "network",
Help: "The total number of bytes received from peers.", Name: "peer_received_bytes_total",
}, Help: "The total number of bytes received from peers.",
},
[]string{"From"}, []string{"From"},
) )
sentFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ sentFailures = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "peer_sent_failures_total", Subsystem: "network",
Help: "The total number of send failures from peers.", Name: "peer_sent_failures_total",
}, Help: "The total number of send failures from peers.",
},
[]string{"To"}, []string{"To"},
) )
recvFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ recvFailures = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "peer_received_failures_total", Subsystem: "network",
Help: "The total number of receive failures from peers.", Name: "peer_received_failures_total",
}, Help: "The total number of receive failures from peers.",
},
[]string{"From"}, []string{"From"},
) )
snapshotSend = prometheus.NewCounterVec(prometheus.CounterOpts{ snapshotSend = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_send_success", Subsystem: "network",
Help: "Total number of successful snapshot sends", Name: "snapshot_send_success",
}, Help: "Total number of successful snapshot sends",
},
[]string{"To"}, []string{"To"},
) )
snapshotSendInflights = prometheus.NewGaugeVec(prometheus.GaugeOpts{ snapshotSendInflights = prometheus.NewGaugeVec(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_send_inflights_total", Subsystem: "network",
Help: "Total number of inflight snapshot sends", Name: "snapshot_send_inflights_total",
}, Help: "Total number of inflight snapshot sends",
},
[]string{"To"}, []string{"To"},
) )
snapshotSendFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ snapshotSendFailures = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_send_failures", Subsystem: "network",
Help: "Total number of snapshot send failures", Name: "snapshot_send_failures",
}, Help: "Total number of snapshot send failures",
},
[]string{"To"}, []string{"To"},
) )
snapshotSendSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{ snapshotSendSeconds = prometheus.NewHistogramVec(
Namespace: "etcd", prometheus.HistogramOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_send_total_duration_seconds", Subsystem: "network",
Help: "Total latency distributions of v3 snapshot sends", Name: "snapshot_send_total_duration_seconds",
Help: "Total latency distributions of v3 snapshot sends",
// lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2 // lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2
// highest bucket start of 0.1 sec * 2^9 == 51.2 sec // highest bucket start of 0.1 sec * 2^9 == 51.2 sec
Buckets: prometheus.ExponentialBuckets(0.1, 2, 10), Buckets: prometheus.ExponentialBuckets(0.1, 2, 10),
}, },
[]string{"To"}, []string{"To"},
) )
snapshotReceive = prometheus.NewCounterVec(prometheus.CounterOpts{ snapshotReceive = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_receive_success", Subsystem: "network",
Help: "Total number of successful snapshot receives", Name: "snapshot_receive_success",
}, Help: "Total number of successful snapshot receives",
},
[]string{"From"}, []string{"From"},
) )
snapshotReceiveInflights = prometheus.NewGaugeVec(prometheus.GaugeOpts{ snapshotReceiveInflights = prometheus.NewGaugeVec(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_receive_inflights_total", Subsystem: "network",
Help: "Total number of inflight snapshot receives", Name: "snapshot_receive_inflights_total",
}, Help: "Total number of inflight snapshot receives",
},
[]string{"From"}, []string{"From"},
) )
snapshotReceiveFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ snapshotReceiveFailures = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_receive_failures", Subsystem: "network",
Help: "Total number of snapshot receive failures", Name: "snapshot_receive_failures",
}, Help: "Total number of snapshot receive failures",
},
[]string{"From"}, []string{"From"},
) )
snapshotReceiveSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{ snapshotReceiveSeconds = prometheus.NewHistogramVec(
Namespace: "etcd", prometheus.HistogramOpts{
Subsystem: "network", Namespace: "etcd",
Name: "snapshot_receive_total_duration_seconds", Subsystem: "network",
Help: "Total latency distributions of v3 snapshot receives", Name: "snapshot_receive_total_duration_seconds",
Help: "Total latency distributions of v3 snapshot receives",
// lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2 // lowest bucket start of upper bound 0.1 sec (100 ms) with factor 2
// highest bucket start of 0.1 sec * 2^9 == 51.2 sec // highest bucket start of 0.1 sec * 2^9 == 51.2 sec
Buckets: prometheus.ExponentialBuckets(0.1, 2, 10), Buckets: prometheus.ExponentialBuckets(0.1, 2, 10),
}, },
[]string{"From"}, []string{"From"},
) )
rttSec = prometheus.NewHistogramVec(prometheus.HistogramOpts{ rttSec = prometheus.NewHistogramVec(
Namespace: "etcd", prometheus.HistogramOpts{
Subsystem: "network", Namespace: "etcd",
Name: "peer_round_trip_time_seconds", Subsystem: "network",
Help: "Round-Trip-Time histogram between peers", Name: "peer_round_trip_time_seconds",
Help: "Round-Trip-Time histogram between peers",
// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2 // 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 // highest bucket start of 0.0001 sec * 2^15 == 3.2768 sec
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 16), Buckets: prometheus.ExponentialBuckets(0.0001, 2, 16),
}, },
[]string{"To"}, []string{"To"},
) )
) )

View File

@ -28,7 +28,9 @@ var (
Subsystem: "store", Subsystem: "store",
Name: "reads_total", Name: "reads_total",
Help: "Total number of reads action by (get/getRecursive), local to this member.", Help: "Total number of reads action by (get/getRecursive), local to this member.",
}, []string{"action"}) },
[]string{"action"},
)
writeCounter = prometheus.NewCounterVec( writeCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -36,7 +38,9 @@ var (
Subsystem: "store", Subsystem: "store",
Name: "writes_total", Name: "writes_total",
Help: "Total number of writes (e.g. set/compareAndDelete) seen by this member.", Help: "Total number of writes (e.g. set/compareAndDelete) seen by this member.",
}, []string{"action"}) },
[]string{"action"},
)
readFailedCounter = prometheus.NewCounterVec( readFailedCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -44,7 +48,9 @@ var (
Subsystem: "store", Subsystem: "store",
Name: "reads_failed_total", Name: "reads_failed_total",
Help: "Failed read actions by (get/getRecursive), local to this member.", Help: "Failed read actions by (get/getRecursive), local to this member.",
}, []string{"action"}) },
[]string{"action"},
)
writeFailedCounter = prometheus.NewCounterVec( writeFailedCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -52,7 +58,9 @@ var (
Subsystem: "store", Subsystem: "store",
Name: "writes_failed_total", Name: "writes_failed_total",
Help: "Failed write actions (e.g. set/compareAndDelete), seen by this member.", Help: "Failed write actions (e.g. set/compareAndDelete), seen by this member.",
}, []string{"action"}) },
[]string{"action"},
)
expireCounter = prometheus.NewCounter( expireCounter = prometheus.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -60,7 +68,8 @@ var (
Subsystem: "store", Subsystem: "store",
Name: "expires_total", Name: "expires_total",
Help: "Total number of expired keys.", Help: "Total number of expired keys.",
}) },
)
watchRequests = prometheus.NewCounter( watchRequests = prometheus.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -68,7 +77,8 @@ var (
Subsystem: "store", Subsystem: "store",
Name: "watch_requests_total", Name: "watch_requests_total",
Help: "Total number of incoming watch requests (new or reestablished).", Help: "Total number of incoming watch requests (new or reestablished).",
}) },
)
watcherCount = prometheus.NewGauge( watcherCount = prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
@ -76,7 +86,8 @@ var (
Subsystem: "store", Subsystem: "store",
Name: "watchers", Name: "watchers",
Help: "Count of currently active watchers.", Help: "Count of currently active watchers.",
}) },
)
) )
const ( const (

View File

@ -31,21 +31,23 @@ var (
Help: "The total number of bytes received from grpc clients.", Help: "The total number of bytes received from grpc clients.",
}) })
streamFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ streamFailures = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "network", Namespace: "etcd",
Name: "server_stream_failures_total", Subsystem: "network",
Help: "The total number of stream failures from the local server.", Name: "server_stream_failures_total",
}, Help: "The total number of stream failures from the local server.",
},
[]string{"Type", "API"}, []string{"Type", "API"},
) )
clientRequests = prometheus.NewCounterVec(prometheus.CounterOpts{ clientRequests = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "server", Namespace: "etcd",
Name: "client_requests_total", Subsystem: "server",
Help: "The total number of client requests per client version.", Name: "client_requests_total",
}, Help: "The total number of client requests per client version.",
},
[]string{"type", "client_api_version"}, []string{"type", "client_api_version"},
) )
) )

View File

@ -16,13 +16,15 @@ package apply
import "github.com/prometheus/client_golang/prometheus" import "github.com/prometheus/client_golang/prometheus"
var alarms = prometheus.NewGaugeVec(prometheus.GaugeOpts{ var alarms = prometheus.NewGaugeVec(
Namespace: "etcd_debugging", prometheus.GaugeOpts{
Subsystem: "server", Namespace: "etcd_debugging",
Name: "alarms", Subsystem: "server",
Help: "Alarms for every member in cluster. 1 for 'server_id' label with current ID. 2 for 'alarm_type' label with type of this alarm", Name: "alarms",
}, Help: "Alarms for every member in cluster. 1 for 'server_id' label with current ID. 2 for 'alarm_type' label with type of this alarm",
[]string{"server_id", "alarm_type"}) },
[]string{"server_id", "alarm_type"},
)
func init() { func init() {
prometheus.MustRegister(alarms) prometheus.MustRegister(alarms)

View File

@ -44,12 +44,13 @@ var (
Name: "leader_changes_seen_total", Name: "leader_changes_seen_total",
Help: "The number of leader changes seen.", Help: "The number of leader changes seen.",
}) })
learnerPromoteFailed = prometheus.NewCounterVec(prometheus.CounterOpts{ learnerPromoteFailed = prometheus.NewCounterVec(
Namespace: "etcd", prometheus.CounterOpts{
Subsystem: "server", Namespace: "etcd",
Name: "learner_promote_failures", Subsystem: "server",
Help: "The total number of failed learner promotions (likely learner not ready) while this member is leader.", Name: "learner_promote_failures",
}, Help: "The total number of failed learner promotions (likely learner not ready) while this member is leader.",
},
[]string{"Reason"}, []string{"Reason"},
) )
learnerPromoteSucceed = prometheus.NewCounter(prometheus.CounterOpts{ learnerPromoteSucceed = prometheus.NewCounter(prometheus.CounterOpts{
@ -112,29 +113,33 @@ var (
Name: "lease_expired_total", Name: "lease_expired_total",
Help: "The total number of expired leases.", Help: "The total number of expired leases.",
}) })
currentVersion = prometheus.NewGaugeVec(
currentVersion = prometheus.NewGaugeVec(prometheus.GaugeOpts{ prometheus.GaugeOpts{
Namespace: "etcd", Namespace: "etcd",
Subsystem: "server", Subsystem: "server",
Name: "version", Name: "version",
Help: "Which version is running. 1 for 'server_version' label with current version.", Help: "Which version is running. 1 for 'server_version' label with current version.",
}, },
[]string{"server_version"}) []string{"server_version"},
currentGoVersion = prometheus.NewGaugeVec(prometheus.GaugeOpts{ )
Namespace: "etcd", currentGoVersion = prometheus.NewGaugeVec(
Subsystem: "server", prometheus.GaugeOpts{
Name: "go_version", Namespace: "etcd",
Help: "Which Go version server is running with. 1 for 'server_go_version' label with current version.", Subsystem: "server",
}, Name: "go_version",
[]string{"server_go_version"}) Help: "Which Go version server is running with. 1 for 'server_go_version' label with current version.",
serverID = prometheus.NewGaugeVec(prometheus.GaugeOpts{ },
Namespace: "etcd", []string{"server_go_version"},
Subsystem: "server", )
Name: "id", serverID = prometheus.NewGaugeVec(
Help: "Server or member ID in hexadecimal format. 1 for 'server_id' label with current ID.", prometheus.GaugeOpts{
}, Namespace: "etcd",
[]string{"server_id"}) Subsystem: "server",
Name: "id",
Help: "Server or member ID in hexadecimal format. 1 for 'server_id' label with current ID.",
},
[]string{"server_id"},
)
fdUsed = prometheus.NewGauge(prometheus.GaugeOpts{ fdUsed = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "os", Namespace: "os",
Subsystem: "fd", Subsystem: "fd",

View File

@ -28,28 +28,32 @@ var (
Name: "slow_apply_total", Name: "slow_apply_total",
Help: "The total number of slow apply requests (likely overloaded from slow disk).", Help: "The total number of slow apply requests (likely overloaded from slow disk).",
}) })
applySec = prometheus.NewHistogramVec(prometheus.HistogramOpts{ applySec = prometheus.NewHistogramVec(
Namespace: "etcd", prometheus.HistogramOpts{
Subsystem: "server", Namespace: "etcd",
Name: "apply_duration_seconds", Subsystem: "server",
Help: "The latency distributions of v2 apply called by backend.", Name: "apply_duration_seconds",
Help: "The latency distributions of v2 apply called by backend.",
// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2 // lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2
// highest bucket start of 0.0001 sec * 2^19 == 52.4288 sec // highest bucket start of 0.0001 sec * 2^19 == 52.4288 sec
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 20), Buckets: prometheus.ExponentialBuckets(0.0001, 2, 20),
}, },
[]string{"version", "op", "success"}) []string{"version", "op", "success"},
rangeSec = prometheus.NewHistogramVec(prometheus.HistogramOpts{ )
Namespace: "etcd", rangeSec = prometheus.NewHistogramVec(
Subsystem: "server", prometheus.HistogramOpts{
Name: "range_duration_seconds", Namespace: "etcd",
Help: "The latency distributions of txn.Range", Subsystem: "server",
Name: "range_duration_seconds",
Help: "The latency distributions of txn.Range",
// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2 // lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2
// highest bucket start of 0.0001 sec * 2^19 == 52.4288 sec // highest bucket start of 0.0001 sec * 2^19 == 52.4288 sec
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 20), Buckets: prometheus.ExponentialBuckets(0.0001, 2, 20),
}, },
[]string{"success"}) []string{"success"},
)
) )
func ApplySecObserve(version, op string, success bool, latency time.Duration) { func ApplySecObserve(version, op string, success bool, latency time.Duration) {

View File

@ -48,7 +48,8 @@ var (
Help: "Bucketed histogram of lease TTLs.", Help: "Bucketed histogram of lease TTLs.",
// 1 second -> 3 months // 1 second -> 3 months
Buckets: prometheus.ExponentialBuckets(1, 2, 24), Buckets: prometheus.ExponentialBuckets(1, 2, 24),
}) },
)
) )
func init() { func init() {

View File

@ -27,7 +27,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "range_total", Name: "range_total",
Help: "Total number of ranges seen by this member.", Help: "Total number of ranges seen by this member.",
}) },
)
putCounter = prometheus.NewCounter( putCounter = prometheus.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -35,7 +36,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "put_total", Name: "put_total",
Help: "Total number of puts seen by this member.", Help: "Total number of puts seen by this member.",
}) },
)
deleteCounter = prometheus.NewCounter( deleteCounter = prometheus.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -43,7 +45,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "delete_total", Name: "delete_total",
Help: "Total number of deletes seen by this member.", Help: "Total number of deletes seen by this member.",
}) },
)
txnCounter = prometheus.NewCounter( txnCounter = prometheus.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -51,7 +54,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "txn_total", Name: "txn_total",
Help: "Total number of txns seen by this member.", Help: "Total number of txns seen by this member.",
}) },
)
keysGauge = prometheus.NewGauge( keysGauge = prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
@ -59,7 +63,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "keys_total", Name: "keys_total",
Help: "Total number of keys.", Help: "Total number of keys.",
}) },
)
watchStreamGauge = prometheus.NewGauge( watchStreamGauge = prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
@ -67,7 +72,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "watch_stream_total", Name: "watch_stream_total",
Help: "Total number of watch streams.", Help: "Total number of watch streams.",
}) },
)
watcherGauge = prometheus.NewGauge( watcherGauge = prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
@ -75,7 +81,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "watcher_total", Name: "watcher_total",
Help: "Total number of watchers.", Help: "Total number of watchers.",
}) },
)
slowWatcherGauge = prometheus.NewGauge( slowWatcherGauge = prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
@ -83,7 +90,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "slow_watcher_total", Name: "slow_watcher_total",
Help: "Total number of unsynced slow watchers.", Help: "Total number of unsynced slow watchers.",
}) },
)
totalEventsCounter = prometheus.NewCounter( totalEventsCounter = prometheus.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -91,7 +99,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "events_total", Name: "events_total",
Help: "Total number of events sent by this member.", Help: "Total number of events sent by this member.",
}) },
)
pendingEventsGauge = prometheus.NewGauge( pendingEventsGauge = prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
@ -99,7 +108,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "pending_events_total", Name: "pending_events_total",
Help: "Total number of pending events to be sent.", Help: "Total number of pending events to be sent.",
}) },
)
indexCompactionPauseMs = prometheus.NewHistogram( indexCompactionPauseMs = prometheus.NewHistogram(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
@ -111,7 +121,8 @@ var (
// lowest bucket start of upper bound 0.5 ms with factor 2 // lowest bucket start of upper bound 0.5 ms with factor 2
// highest bucket start of 0.5 ms * 2^13 == 4.096 sec // highest bucket start of 0.5 ms * 2^13 == 4.096 sec
Buckets: prometheus.ExponentialBuckets(0.5, 2, 14), Buckets: prometheus.ExponentialBuckets(0.5, 2, 14),
}) },
)
dbCompactionPauseMs = prometheus.NewHistogram( dbCompactionPauseMs = prometheus.NewHistogram(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
@ -123,7 +134,8 @@ var (
// lowest bucket start of upper bound 1 ms with factor 2 // lowest bucket start of upper bound 1 ms with factor 2
// highest bucket start of 1 ms * 2^12 == 4.096 sec // highest bucket start of 1 ms * 2^12 == 4.096 sec
Buckets: prometheus.ExponentialBuckets(1, 2, 13), Buckets: prometheus.ExponentialBuckets(1, 2, 13),
}) },
)
dbCompactionTotalMs = prometheus.NewHistogram( dbCompactionTotalMs = prometheus.NewHistogram(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
@ -135,7 +147,8 @@ var (
// lowest bucket start of upper bound 100 ms with factor 2 // lowest bucket start of upper bound 100 ms with factor 2
// highest bucket start of 100 ms * 2^13 == 8.192 sec // highest bucket start of 100 ms * 2^13 == 8.192 sec
Buckets: prometheus.ExponentialBuckets(100, 2, 14), Buckets: prometheus.ExponentialBuckets(100, 2, 14),
}) },
)
dbCompactionLast = prometheus.NewGauge( dbCompactionLast = prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
@ -143,7 +156,8 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "db_compaction_last", Name: "db_compaction_last",
Help: "The unix time of the last db compaction. Resets to 0 on start.", Help: "The unix time of the last db compaction. Resets to 0 on start.",
}) },
)
dbCompactionKeysCounter = prometheus.NewCounter( dbCompactionKeysCounter = prometheus.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
@ -151,14 +165,16 @@ var (
Subsystem: "mvcc", Subsystem: "mvcc",
Name: "db_compaction_keys_total", Name: "db_compaction_keys_total",
Help: "Total number of db keys compacted.", Help: "Total number of db keys compacted.",
}) },
)
dbTotalSize = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ dbTotalSize = prometheus.NewGaugeFunc(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "mvcc", Namespace: "etcd",
Name: "db_total_size_in_bytes", Subsystem: "mvcc",
Help: "Total size of the underlying database physically allocated in bytes.", Name: "db_total_size_in_bytes",
}, Help: "Total size of the underlying database physically allocated in bytes.",
},
func() float64 { func() float64 {
reportDbTotalSizeInBytesMu.RLock() reportDbTotalSizeInBytesMu.RLock()
defer reportDbTotalSizeInBytesMu.RUnlock() defer reportDbTotalSizeInBytesMu.RUnlock()
@ -169,12 +185,13 @@ var (
reportDbTotalSizeInBytesMu sync.RWMutex reportDbTotalSizeInBytesMu sync.RWMutex
reportDbTotalSizeInBytes = func() float64 { return 0 } reportDbTotalSizeInBytes = func() float64 { return 0 }
dbTotalSizeInUse = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ dbTotalSizeInUse = prometheus.NewGaugeFunc(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "mvcc", Namespace: "etcd",
Name: "db_total_size_in_use_in_bytes", Subsystem: "mvcc",
Help: "Total size of the underlying database logically in use in bytes.", Name: "db_total_size_in_use_in_bytes",
}, Help: "Total size of the underlying database logically in use in bytes.",
},
func() float64 { func() float64 {
reportDbTotalSizeInUseInBytesMu.RLock() reportDbTotalSizeInUseInBytesMu.RLock()
defer reportDbTotalSizeInUseInBytesMu.RUnlock() defer reportDbTotalSizeInUseInBytesMu.RUnlock()
@ -185,12 +202,13 @@ var (
reportDbTotalSizeInUseInBytesMu sync.RWMutex reportDbTotalSizeInUseInBytesMu sync.RWMutex
reportDbTotalSizeInUseInBytes = func() float64 { return 0 } reportDbTotalSizeInUseInBytes = func() float64 { return 0 }
dbOpenReadTxN = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ dbOpenReadTxN = prometheus.NewGaugeFunc(
Namespace: "etcd", prometheus.GaugeOpts{
Subsystem: "mvcc", Namespace: "etcd",
Name: "db_open_read_transactions", Subsystem: "mvcc",
Help: "The number of currently open read transactions", Name: "db_open_read_transactions",
}, Help: "The number of currently open read transactions",
},
func() float64 { func() float64 {
reportDbOpenReadTxNMu.RLock() reportDbOpenReadTxNMu.RLock()
@ -226,12 +244,13 @@ var (
Buckets: prometheus.ExponentialBuckets(.01, 2, 15), Buckets: prometheus.ExponentialBuckets(.01, 2, 15),
}) })
currentRev = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ currentRev = prometheus.NewGaugeFunc(
Namespace: "etcd_debugging", prometheus.GaugeOpts{
Subsystem: "mvcc", Namespace: "etcd_debugging",
Name: "current_revision", Subsystem: "mvcc",
Help: "The current revision of store.", Name: "current_revision",
}, Help: "The current revision of store.",
},
func() float64 { func() float64 {
reportCurrentRevMu.RLock() reportCurrentRevMu.RLock()
defer reportCurrentRevMu.RUnlock() defer reportCurrentRevMu.RUnlock()