| 12 | } |
| 13 | |
| 14 | func NewLifecyclerMetrics(ringName string, reg prometheus.Registerer) *LifecyclerMetrics { |
| 15 | return &LifecyclerMetrics{ |
| 16 | consulHeartbeats: promauto.With(reg).NewCounter(prometheus.CounterOpts{ |
| 17 | Name: "member_consul_heartbeats_total", |
| 18 | Help: "The total number of heartbeats sent to consul.", |
| 19 | ConstLabels: prometheus.Labels{"name": ringName}, |
| 20 | }), |
| 21 | shutdownDuration: promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ |
| 22 | Name: "shutdown_duration_seconds", |
| 23 | Help: "Duration (in seconds) of shutdown procedure (ie transfer or flush).", |
| 24 | Buckets: prometheus.ExponentialBuckets(10, 2, 8), // Biggest bucket is 10*2^(9-1) = 2560, or 42 mins. |
| 25 | ConstLabels: prometheus.Labels{"name": ringName}, |
| 26 | }, []string{"op", "status"}), |
| 27 | readonly: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ |
| 28 | Name: "lifecycler_read_only", |
| 29 | Help: "Set to 1 if this lifecycler's instance entry is in read-only state.", |
| 30 | ConstLabels: prometheus.Labels{"name": ringName}, |
| 31 | }), |
| 32 | } |
| 33 | |
| 34 | } |