github.com/argoproj-labs/argocd-operator@v0.10.0/controllers/argocd/metrics.go (about)

     1  package argocd
     2  
     3  import (
     4  	"github.com/prometheus/client_golang/prometheus"
     5  	"sigs.k8s.io/controller-runtime/pkg/metrics"
     6  )
     7  
     8  var (
     9  	ActiveInstancesByPhase = prometheus.NewGaugeVec(
    10  		prometheus.GaugeOpts{
    11  			Name: "active_argocd_instances_by_phase",
    12  			Help: "Number of active argocd instances by phase",
    13  		},
    14  		[]string{"phase"},
    15  	)
    16  
    17  	ActiveInstancesTotal = prometheus.NewGauge(
    18  		prometheus.GaugeOpts{
    19  			Name: "active_argocd_instances_total",
    20  			Help: "Total number of active argocd instances",
    21  		},
    22  	)
    23  
    24  	ActiveInstanceReconciliationCount = prometheus.NewCounterVec(
    25  		prometheus.CounterOpts{
    26  			Name: "active_argocd_instance_reconciliation_count",
    27  			Help: "Number of reconciliations performed for a given instance",
    28  		},
    29  		[]string{"namespace"},
    30  	)
    31  
    32  	// ReconcileTime is a prometheus metric which keeps track of the duration
    33  	// of reconciliations for a given instance
    34  	ReconcileTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
    35  		Name:    "controller_runtime_reconcile_time_seconds_per_instance",
    36  		Help:    "Length of time per reconciliation per instance",
    37  		Buckets: []float64{0.05, 0.075, 0.1, 0.15, 0.2, 0.22, 0.24, 0.26, 0.28, 0.3, 0.32, 0.34, 0.37, 0.4, 0.42, 0.44, 0.48, 0.5, 0.55, 0.6, 0.75, 0.9, 1.00},
    38  	}, []string{"namespace"})
    39  )
    40  
    41  func init() {
    42  	metrics.Registry.MustRegister(ActiveInstancesTotal, ActiveInstancesByPhase, ActiveInstanceReconciliationCount, ReconcileTime)
    43  }