()
| 28 | var addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.") |
| 29 | |
| 30 | func main() { |
| 31 | flag.Parse() |
| 32 | |
| 33 | // Create non-global registry. |
| 34 | reg := prometheus.NewRegistry() |
| 35 | |
| 36 | // Add go runtime metrics and process collectors. |
| 37 | reg.MustRegister( |
| 38 | collectors.NewGoCollector(), |
| 39 | collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}), |
| 40 | ) |
| 41 | |
| 42 | // Expose /metrics HTTP endpoint using the created custom registry. |
| 43 | http.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{Registry: reg})) |
| 44 | log.Fatal(http.ListenAndServe(*addr, nil)) |
| 45 | } |
nothing calls this directly
no test coverage detected