MCPcopy
hub / github.com/prometheus/client_golang / NewClusterManager

Function NewClusterManager

prometheus/example_clustermanager_test.go:115–122  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

113// wrapping Registerer that adds the zone as a label. In this way, the metrics
114// collected by different ClusterManagerCollectors do not collide.
115func 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
124func ExampleCollector() {
125 // Since we are dealing with custom Collector implementations, it might

Callers 1

ExampleCollectorFunction · 0.85

Calls 2

WrapRegistererWithFunction · 0.92
MustRegisterMethod · 0.65

Tested by

no test coverage detected