// Meter configures the database metrics collectors and func (self *LDBDatabase) Meter(prefix string) { // Initialize all the metrics collector at the requested prefix self.getTimer = metrics.NewTimer(prefix + "user/gets") self.putTimer = metrics.NewTimer(prefix + "user/puts") self.delTimer = metrics.NewTimer(prefix + "user/dels") self.missMeter = metrics.NewMeter(prefix + "user/misses") self.readMeter = metrics.NewMeter(prefix + "user/reads") self.writeMeter = metrics.NewMeter(prefix + "user/writes") self.compTimeMeter = metrics.NewMeter(prefix + "compact/time") self.compReadMeter = metrics.NewMeter(prefix + "compact/input") self.compWriteMeter = metrics.NewMeter(prefix + "compact/output") // Create a quit channel for the periodic collector and run it self.quitLock.Lock() self.quitChan = make(chan chan error) self.quitLock.Unlock() go self.meter(3 * time.Second) }
// // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // Contains the meters and timers used by the networking layer. package p2p import ( "net" "github.com/gophergala2016/etherapis/etherapis/Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics" ) var ( ingressConnectMeter = metrics.NewMeter("p2p/InboundConnects") ingressTrafficMeter = metrics.NewMeter("p2p/InboundTraffic") egressConnectMeter = metrics.NewMeter("p2p/OutboundConnects") egressTrafficMeter = metrics.NewMeter("p2p/OutboundTraffic") ) // meteredConn is a wrapper around a network TCP connection that meters both the // inbound and outbound network traffic. type meteredConn struct { *net.TCPConn // Network connection to wrap with metering } // newMeteredConn creates a new metered connection, also bumping the ingress or // egress connection meter. If the metrics system is disabled, this function // returns the original object. func newMeteredConn(conn net.Conn, ingress bool) net.Conn {
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // Contains the metrics collected by the fetcher. package fetcher import ( "github.com/gophergala2016/etherapis/etherapis/Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics" ) var ( propAnnounceInMeter = metrics.NewMeter("eth/fetcher/prop/announces/in") propAnnounceOutTimer = metrics.NewTimer("eth/fetcher/prop/announces/out") propAnnounceDropMeter = metrics.NewMeter("eth/fetcher/prop/announces/drop") propAnnounceDOSMeter = metrics.NewMeter("eth/fetcher/prop/announces/dos") propBroadcastInMeter = metrics.NewMeter("eth/fetcher/prop/broadcasts/in") propBroadcastOutTimer = metrics.NewTimer("eth/fetcher/prop/broadcasts/out") propBroadcastDropMeter = metrics.NewMeter("eth/fetcher/prop/broadcasts/drop") propBroadcastDOSMeter = metrics.NewMeter("eth/fetcher/prop/broadcasts/dos") blockFetchMeter = metrics.NewMeter("eth/fetcher/fetch/blocks") headerFetchMeter = metrics.NewMeter("eth/fetcher/fetch/headers") bodyFetchMeter = metrics.NewMeter("eth/fetcher/fetch/bodies") blockFilterInMeter = metrics.NewMeter("eth/fetcher/filter/blocks/in") blockFilterOutMeter = metrics.NewMeter("eth/fetcher/filter/blocks/out")
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // Contains the metrics collected by the downloader. package downloader import ( "github.com/gophergala2016/etherapis/etherapis/Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics" ) var ( hashInMeter = metrics.NewMeter("eth/downloader/hashes/in") hashReqTimer = metrics.NewTimer("eth/downloader/hashes/req") hashDropMeter = metrics.NewMeter("eth/downloader/hashes/drop") hashTimeoutMeter = metrics.NewMeter("eth/downloader/hashes/timeout") blockInMeter = metrics.NewMeter("eth/downloader/blocks/in") blockReqTimer = metrics.NewTimer("eth/downloader/blocks/req") blockDropMeter = metrics.NewMeter("eth/downloader/blocks/drop") blockTimeoutMeter = metrics.NewMeter("eth/downloader/blocks/timeout") headerInMeter = metrics.NewMeter("eth/downloader/headers/in") headerReqTimer = metrics.NewTimer("eth/downloader/headers/req") headerDropMeter = metrics.NewMeter("eth/downloader/headers/drop") headerTimeoutMeter = metrics.NewMeter("eth/downloader/headers/timeout") bodyInMeter = metrics.NewMeter("eth/downloader/bodies/in")
// but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. package eth import ( "github.com/gophergala2016/etherapis/etherapis/Godeps/_workspace/src/github.com/ethereum/go-ethereum/metrics" "github.com/gophergala2016/etherapis/etherapis/Godeps/_workspace/src/github.com/ethereum/go-ethereum/p2p" ) var ( propTxnInPacketsMeter = metrics.NewMeter("eth/prop/txns/in/packets") propTxnInTrafficMeter = metrics.NewMeter("eth/prop/txns/in/traffic") propTxnOutPacketsMeter = metrics.NewMeter("eth/prop/txns/out/packets") propTxnOutTrafficMeter = metrics.NewMeter("eth/prop/txns/out/traffic") propHashInPacketsMeter = metrics.NewMeter("eth/prop/hashes/in/packets") propHashInTrafficMeter = metrics.NewMeter("eth/prop/hashes/in/traffic") propHashOutPacketsMeter = metrics.NewMeter("eth/prop/hashes/out/packets") propHashOutTrafficMeter = metrics.NewMeter("eth/prop/hashes/out/traffic") propBlockInPacketsMeter = metrics.NewMeter("eth/prop/blocks/in/packets") propBlockInTrafficMeter = metrics.NewMeter("eth/prop/blocks/in/traffic") propBlockOutPacketsMeter = metrics.NewMeter("eth/prop/blocks/out/packets") propBlockOutTrafficMeter = metrics.NewMeter("eth/prop/blocks/out/traffic") reqHashInPacketsMeter = metrics.NewMeter("eth/req/hashes/in/packets") reqHashInTrafficMeter = metrics.NewMeter("eth/req/hashes/in/traffic") reqHashOutPacketsMeter = metrics.NewMeter("eth/req/hashes/out/packets") reqHashOutTrafficMeter = metrics.NewMeter("eth/req/hashes/out/traffic")