open-cluster-management.io/governance-policy-propagator@v0.13.0/controllers/policymetrics/metrics.go (about)

     1  // Copyright (c) 2021 Red Hat, Inc.
     2  // Copyright Contributors to the Open Cluster Management project
     3  
     4  package policymetrics
     5  
     6  import (
     7  	"github.com/prometheus/client_golang/prometheus"
     8  	"sigs.k8s.io/controller-runtime/pkg/metrics"
     9  )
    10  
    11  var policyStatusGauge = prometheus.NewGaugeVec(
    12  	prometheus.GaugeOpts{
    13  		Name: "policy_governance_info",
    14  		Help: "The compliance status of the named policy. 0 == Compliant. 1 == NonCompliant",
    15  	},
    16  	[]string{
    17  		"type",              // "root" or "propagated"
    18  		"policy",            // The name of the root policy
    19  		"policy_namespace",  // The namespace where the root policy is defined
    20  		"cluster_namespace", // The namespace where the policy was propagated
    21  	},
    22  )
    23  
    24  func init() {
    25  	metrics.Registry.MustRegister(
    26  		policyStatusGauge,
    27  	)
    28  }