File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,12 @@ limitations under the License.
1616
1717package metrics
1818
19- import "github.com/prometheus/client_golang/prometheus"
19+ import (
20+ "regexp"
21+
22+ "github.com/prometheus/client_golang/prometheus"
23+ "github.com/prometheus/client_golang/prometheus/collectors"
24+ )
2025
2126// RegistererGatherer combines both parts of the API of a Prometheus
2227// registry, both the Registerer and the Gatherer interfaces.
@@ -27,4 +32,22 @@ type RegistererGatherer interface {
2732
2833// Registry is a prometheus registry for storing metrics within the
2934// controller-runtime.
30- var Registry RegistererGatherer = prometheus .NewRegistry ()
35+ var Registry RegistererGatherer = NewRegistry ()
36+
37+ func NewRegistry () * prometheus.Registry {
38+ r := prometheus .NewRegistry ()
39+
40+ // default registers
41+ r .MustRegister (
42+ collectors .NewGoCollector (
43+ collectors .WithGoCollectorRuntimeMetrics (
44+ collectors .MetricsGC ,
45+ collectors .MetricsScheduler ,
46+ collectors .MetricsMemory ,
47+ collectors.GoRuntimeMetricsRule {Matcher : regexp .MustCompile (`^/sync/.*` )},
48+ ),
49+ ),
50+ collectors .NewProcessCollector (collectors.ProcessCollectorOpts {}),
51+ )
52+ return r
53+ }
You can’t perform that action at this time.
0 commit comments