Fix metrics being injected after node initalization

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent 62fcf7e9
......@@ -181,6 +181,13 @@ func defaultMux(path string) corehttp.ServeOption {
var fileDescriptorCheck = func() error { return nil }
func daemonFunc(req cmds.Request, res cmds.Response) {
// Inject metrics before we do anything
err := mprome.Inject()
if err != nil {
log.Warningf("Injecting prometheus handler for metrics failed with message: %s\n", err.Error())
}
// let the user know we're going.
fmt.Printf("Initializing daemon...\n")
......@@ -388,10 +395,6 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
}
// initialize metrics collector
err = mprome.Inject()
if err != nil {
log.Warningf("Injecting prometheus handler for metrics failed with message: %s\n", err.Error())
}
prometheus.MustRegister(&corehttp.IpfsNodeCollector{Node: node})
fmt.Printf("Daemon is ready\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment