示例#1
0
// 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)
}
示例#2
0
//
// The go-expanse library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-expanse library is distributed in the hope that it will be useful,
// 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-expanse library. If not, see <http://www.gnu.org/licenses/>.

// Contains the metrics collected by the fetcher.

package fetcher

import (
	"github.com/expanse-project/go-expanse/metrics"
)

var (
	announceMeter  = metrics.NewMeter("exp/sync/RemoteAnnounces")
	announceTimer  = metrics.NewTimer("exp/sync/LocalAnnounces")
	broadcastMeter = metrics.NewMeter("exp/sync/RemoteBroadcasts")
	broadcastTimer = metrics.NewTimer("exp/sync/LocalBroadcasts")
	discardMeter   = metrics.NewMeter("exp/sync/DiscardedBlocks")
	futureMeter    = metrics.NewMeter("exp/sync/FutureBlocks")
)
示例#3
0
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-expanse 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/expanse-project/go-expanse/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 {
示例#4
0
// 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 exp

import (
	"github.com/expanse-project/go-expanse/metrics"
	"github.com/expanse-project/go-expanse/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")
	reqHeaderInPacketsMeter   = metrics.NewMeter("eth/req/headers/in/packets")
	reqHeaderInTrafficMeter   = metrics.NewMeter("eth/req/headers/in/traffic")
	reqHeaderOutPacketsMeter  = metrics.NewMeter("eth/req/headers/out/packets")
	reqHeaderOutTrafficMeter  = metrics.NewMeter("eth/req/headers/out/traffic")
示例#5
0
// 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/expanse-project/go-expanse/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")
示例#6
0
// 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/expanse-project/go-expanse/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")

	headerFetchMeter = metrics.NewMeter("eth/fetcher/fetch/headers")
	bodyFetchMeter   = metrics.NewMeter("eth/fetcher/fetch/bodies")

	headerFilterInMeter  = metrics.NewMeter("eth/fetcher/filter/headers/in")
	headerFilterOutMeter = metrics.NewMeter("eth/fetcher/filter/headers/out")
	bodyFilterInMeter    = metrics.NewMeter("eth/fetcher/filter/bodies/in")
示例#7
0
// The go-expanse library is distributed in the hope that it will be useful,
// 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-expanse library. If not, see <http://www.gnu.org/licenses/>.

package exp

import (
	"github.com/expanse-project/go-expanse/metrics"
)

var (
	propTxnInPacketsMeter    = metrics.NewMeter("exp/prop/txns/in/packets")
	propTxnInTrafficMeter    = metrics.NewMeter("exp/prop/txns/in/traffic")
	propTxnOutPacketsMeter   = metrics.NewMeter("exp/prop/txns/out/packets")
	propTxnOutTrafficMeter   = metrics.NewMeter("exp/prop/txns/out/traffic")
	propHashInPacketsMeter   = metrics.NewMeter("exp/prop/hashes/in/packets")
	propHashInTrafficMeter   = metrics.NewMeter("exp/prop/hashes/in/traffic")
	propHashOutPacketsMeter  = metrics.NewMeter("exp/prop/hashes/out/packets")
	propHashOutTrafficMeter  = metrics.NewMeter("exp/prop/hashes/out/traffic")
	propBlockInPacketsMeter  = metrics.NewMeter("exp/prop/blocks/in/packets")
	propBlockInTrafficMeter  = metrics.NewMeter("exp/prop/blocks/in/traffic")
	propBlockOutPacketsMeter = metrics.NewMeter("exp/prop/blocks/out/packets")
	propBlockOutTrafficMeter = metrics.NewMeter("exp/prop/blocks/out/traffic")
	reqHashInPacketsMeter    = metrics.NewMeter("exp/req/hashes/in/packets")
	reqHashInTrafficMeter    = metrics.NewMeter("exp/req/hashes/in/traffic")
	reqHashOutPacketsMeter   = metrics.NewMeter("exp/req/hashes/out/packets")
	reqHashOutTrafficMeter   = metrics.NewMeter("exp/req/hashes/out/traffic")