Exemple #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)
}
Exemple #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")
)
	"github.com/expanse-project/go-expanse/ethdb"
	"github.com/expanse-project/go-expanse/event"
	"github.com/expanse-project/go-expanse/logger"
	"github.com/expanse-project/go-expanse/logger/glog"
	"github.com/expanse-project/go-expanse/metrics"
	"github.com/expanse-project/go-expanse/pow"
	"github.com/expanse-project/go-expanse/rlp"
	"github.com/expanse-project/go-expanse/trie"
	"github.com/hashicorp/golang-lru"
)

var (
	chainlogger = logger.NewLogger("CHAIN")
	jsonlogger  = logger.NewJsonLogger()

	blockInsertTimer = metrics.NewTimer("chain/inserts")

	ErrNoGenesis = errors.New("Genesis not found in chain")
)

const (
	headerCacheLimit    = 512
	bodyCacheLimit      = 256
	tdCacheLimit        = 1024
	blockCacheLimit     = 256
	maxFutureBlocks     = 256
	maxTimeFutureBlocks = 30
	// must be bumped when consensus algorithm is changed, this forces the upgradedb
	// command to be run (forces the blocks to be imported again using the new algorithm)
	BlockChainVersion = 3
)
Exemple #4
0
// 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")
	bodyReqTimer     = metrics.NewTimer("eth/downloader/bodies/req")
// 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")
	bodyFilterOutMeter   = metrics.NewMeter("eth/fetcher/filter/bodies/out")