github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/metrics/reconciling.go (about)

     1  package metrics
     2  
     3  import (
     4  	"github.com/prometheus/client_golang/prometheus"
     5  	"strconv"
     6  )
     7  
     8  func SuccessfulReconcilingBundle(bundle string) {
     9  	metrics.reconcilingBundle.With(prometheus.Labels{
    10  		"result": "success",
    11  		"bundle": bundle,
    12  	}).Inc()
    13  }
    14  
    15  func FailureReconcilingBundle(bundle string) {
    16  	metrics.reconcilingBundle.With(prometheus.Labels{
    17  		"result": "failure",
    18  		"bundle": bundle,
    19  	}).Inc()
    20  }
    21  
    22  func SuccessfulReconcilingApplication(app string, templator string, deploy bool) {
    23  	labels := prometheus.Labels{
    24  		"application": app,
    25  		"deploy":      strconv.FormatBool(deploy),
    26  		"templator":   templator,
    27  	}
    28  	metrics.gyrReconciling.Set(success)
    29  
    30  	labels["result"] = "success"
    31  	metrics.reconcilingApplication.With(labels).Inc()
    32  }
    33  
    34  func FailureReconcilingApplication(app string, templator string, deploy bool) {
    35  	labels := prometheus.Labels{
    36  		"application": app,
    37  		"deploy":      strconv.FormatBool(deploy),
    38  		"templator":   templator,
    39  	}
    40  	metrics.gyrReconciling.Set(failed)
    41  
    42  	labels["result"] = "failure"
    43  	metrics.reconcilingApplication.With(labels).Inc()
    44  }