()
| 122 | } |
| 123 | |
| 124 | func ExampleCollector() { |
| 125 | // Since we are dealing with custom Collector implementations, it might |
| 126 | // be a good idea to try it out with a pedantic registry. |
| 127 | reg := prometheus.NewPedanticRegistry() |
| 128 | |
| 129 | // Construct cluster managers. In real code, we would assign them to |
| 130 | // variables to then do something with them. |
| 131 | NewClusterManager("db", reg) |
| 132 | NewClusterManager("ca", reg) |
| 133 | |
| 134 | // Add the standard process and Go metrics to the custom registry. |
| 135 | reg.MustRegister( |
| 136 | prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}), |
| 137 | prometheus.NewGoCollector(), |
| 138 | ) |
| 139 | |
| 140 | http.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{})) |
| 141 | log.Fatal(http.ListenAndServe(":8080", nil)) |
| 142 | } |
nothing calls this directly
no test coverage detected