github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/providers/election/streams/stats.go (about)

     1  // Copyright (c) 2017-2021, R.I. Pienaar and the Choria Project contributors
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package election
     6  
     7  import (
     8  	"github.com/prometheus/client_golang/prometheus"
     9  )
    10  
    11  var (
    12  	campaignsCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
    13  		Name: "choria_election_campaigns",
    14  		Help: "The number of campaigns a specific candidate voted in",
    15  	}, []string{"election", "identity", "state"})
    16  
    17  	leaderGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
    18  		Name: "choria_election_leader",
    19  		Help: "Indicates if a specific instance is the current leader",
    20  	}, []string{"election", "identity"})
    21  
    22  	campaignIntervalGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
    23  		Name: "choria_election_interval_seconds",
    24  		Help: "The number of seconds between campaigns",
    25  	}, []string{"election", "identity"})
    26  )
    27  
    28  func init() {
    29  	prometheus.MustRegister(campaignsCounter)
    30  	prometheus.MustRegister(leaderGauge)
    31  	prometheus.MustRegister(campaignIntervalGauge)
    32  }