summaryrefslogtreecommitdiff
path: root/service/metrics/service.go
diff options
context:
space:
mode:
Diffstat (limited to 'service/metrics/service.go')
-rw-r--r--service/metrics/service.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/service/metrics/service.go b/service/metrics/service.go
index 0ae86c83..b3d0e2da 100644
--- a/service/metrics/service.go
+++ b/service/metrics/service.go
@@ -26,13 +26,8 @@ func (s *Service) Init(cfg *Config, r *rpc.Service) (bool, error) {
s.cfg = cfg
s.registry = prometheus.NewRegistry()
- if err := s.registry.Register(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{})); err != nil {
- return false, err
- }
-
- if err := s.registry.Register(prometheus.NewGoCollector()); err != nil {
- return false, err
- }
+ s.registry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}))
+ s.registry.MustRegister(prometheus.NewGoCollector())
if r != nil {
if err := r.Register(ID, &rpcServer{s}); err != nil {
@@ -55,9 +50,7 @@ func (s *Service) Register(c prometheus.Collector) error {
// MustRegister registers new collector or fails with panic.
func (s *Service) MustRegister(c prometheus.Collector) {
- if err := s.registry.Register(c); err != nil {
- panic(err)
- }
+ s.registry.MustRegister(c)
}
// Serve prometheus metrics service.