File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 13
13
14
14
package prometheus_test
15
15
16
- import "github.com/prometheus/client_golang/prometheus"
16
+ import (
17
+ "log"
18
+ "net/http"
19
+
20
+ "github.com/prometheus/client_golang/prometheus"
21
+ "github.com/prometheus/client_golang/prometheus/promhttp"
22
+ )
17
23
18
24
// ClusterManager is an example for a system that might have been built without
19
25
// Prometheus in mind. It models a central manager of jobs running in a
@@ -124,4 +130,13 @@ func ExampleCollector() {
124
130
// variables to then do something with them.
125
131
NewClusterManager ("db" , reg )
126
132
NewClusterManager ("ca" , reg )
133
+
134
+ // Add the built in process and golang metrics to this 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 ))
127
142
}
You can’t perform that action at this time.
0 commit comments