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

Function main

examples/simple/main.go:30–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28var addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.")
29
30func 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}

Callers

nothing calls this directly

Calls 6

MustRegisterMethod · 0.95
NewRegistryFunction · 0.92
NewGoCollectorFunction · 0.92
NewProcessCollectorFunction · 0.92
HandlerForFunction · 0.92
HandleMethod · 0.80

Tested by

no test coverage detected