NewClusterManager first creates a Prometheus-ignorant ClusterManager instance. Then, it creates a ClusterManagerCollector for the just created ClusterManager. Finally, it registers the ClusterManagerCollector with a wrapping Registerer that adds the zone as a label. In this way, the metrics collecte
(zone string, reg prometheus.Registerer)
| 113 | // wrapping Registerer that adds the zone as a label. In this way, the metrics |
| 114 | // collected by different ClusterManagerCollectors do not collide. |
| 115 | func NewClusterManager(zone string, reg prometheus.Registerer) *ClusterManager { |
| 116 | c := &ClusterManager{ |
| 117 | Zone: zone, |
| 118 | } |
| 119 | cc := ClusterManagerCollector{ClusterManager: c} |
| 120 | prometheus.WrapRegistererWith(prometheus.Labels{"zone": zone}, reg).MustRegister(cc) |
| 121 | return c |
| 122 | } |
| 123 | |
| 124 | func ExampleCollector() { |
| 125 | // Since we are dealing with custom Collector implementations, it might |
no test coverage detected