Skip to content

Commit

Permalink
metrics: do explicit metrics injection
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Sep 13, 2016
1 parent c7d8966 commit 9cbeffa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ import (

"gx/ipfs/QmPpRcbNUXauP3zWZ1NJMLWpe4QnmEHrd2ba2D3yqWznw7/go-multiaddr-net"
"gx/ipfs/QmR3KwhXCRLTNZB59vELb2HhEWrGy9nuychepxFtj3wWYa/client_golang/prometheus"

conn "gx/ipfs/QmUuwQUJmtvC6ReYcu7xaYKEUM3pD46H18dFn3LBhVt2Di/go-libp2p/p2p/net/conn"
mprome "gx/ipfs/QmXWro6iddJRbGWUoZDpTu6tjo5EXX4xJHHR9VczeoGZbw/go-metrics-prometheus"
ma "gx/ipfs/QmYzDkkgAEmrcNzFCiYo6L1dTX4EAG1gZkbtdbd9trL4vd/go-multiaddr"
util "gx/ipfs/QmZNVWh8LLjAavuQ2JXuFmuYH3C11xo988vSgp7UQrTRj1/go-ipfs-util"
pstore "gx/ipfs/QmdMfSLMDBDYhtc4oF3NYGCZr5dy4wQb6Ji26N4D4mdxa2/go-libp2p-peerstore"

_ "gx/ipfs/QmSd7rE8qjihopcQpg7VXzcPX8X4FJ5XkXVkUQggmmWyvG/go-metrics-prometheus"
_ "gx/ipfs/QmV3NSS3A1kX5s28r7yLczhDsXzkgo65cqRgKFXYunWZmD/metrics/runtime"
)

Expand Down Expand Up @@ -360,6 +361,10 @@ 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")
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@
},
{
"author": "ipfs",
"hash": "QmSd7rE8qjihopcQpg7VXzcPX8X4FJ5XkXVkUQggmmWyvG",
"hash": "QmXWro6iddJRbGWUoZDpTu6tjo5EXX4xJHHR9VczeoGZbw",
"name": "go-metrics-prometheus",
"version": "0.1.2"
"version": "0.3.0"
},
{
"author": "ipfs",
Expand Down

0 comments on commit 9cbeffa

Please sign in to comment.