blob: 06f8b58015f9541d7e11fb3ecca69ba796f2488c [file] [log] [blame]
khenaidoo59ce9dd2019-11-11 13:05:32 -05001// Copyright 2018 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 lease
16
17import (
18 "github.com/prometheus/client_golang/prometheus"
19)
20
21var (
22 leaseGranted = prometheus.NewCounter(prometheus.CounterOpts{
23 Namespace: "etcd_debugging",
24 Subsystem: "lease",
25 Name: "granted_total",
26 Help: "The total number of granted leases.",
27 })
28
29 leaseRevoked = prometheus.NewCounter(prometheus.CounterOpts{
30 Namespace: "etcd_debugging",
31 Subsystem: "lease",
32 Name: "revoked_total",
33 Help: "The total number of revoked leases.",
34 })
35
36 leaseRenewed = prometheus.NewCounter(prometheus.CounterOpts{
37 Namespace: "etcd_debugging",
38 Subsystem: "lease",
39 Name: "renewed_total",
40 Help: "The number of renewed leases seen by the leader.",
41 })
42
43 leaseTotalTTLs = prometheus.NewHistogram(
44 prometheus.HistogramOpts{
45 Namespace: "etcd_debugging",
46 Subsystem: "lease",
47 Name: "ttl_total",
48 Help: "Bucketed histogram of lease TTLs.",
49 // 1 second -> 3 months
50 Buckets: prometheus.ExponentialBuckets(1, 2, 24),
51 })
52)
53
54func init() {
55 prometheus.MustRegister(leaseGranted)
56 prometheus.MustRegister(leaseRevoked)
57 prometheus.MustRegister(leaseRenewed)
58 prometheus.MustRegister(leaseTotalTTLs)
59}