mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-09 10:18:04 +08:00
Fix metrics being injected after node initalization
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
parent
62fcf7e9e2
commit
de34ef813b
@ -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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user