[#xx] Create innerring metrics before metrics usage

Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
Alejandro Lopez 2023-06-01 10:07:48 +03:00
parent 4476a1dbaf
commit f7c4c07453

View file

@ -326,7 +326,10 @@ func (s *Server) registerStarter(f func() error) {
// New creates instance of inner ring sever structure.
func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan<- error) (*Server, error) {
var err error
server := &Server{log: log}
server := &Server{
log: log,
metrics: metrics.NewInnerRingMetrics(),
}
server.setHealthStatus(control.HealthStatus_HEALTH_STATUS_UNDEFINED)
@ -393,8 +396,6 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
return nil, err
}
server.metrics = metrics.NewInnerRingMetrics()
return server, nil
}