github.com/igggame/nebulas-go@v2.1.0+incompatible/core/metrics.go (about)

     1  // Copyright (C) 2017 go-nebulas authors
     2  //
     3  // This file is part of the go-nebulas library.
     4  //
     5  // the go-nebulas library is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU General Public License as published by
     7  // the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  //
    10  // the go-nebulas library is distributed in the hope that it will be useful,
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  // GNU General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU General Public License
    16  // along with the go-nebulas library.  If not, see <http://www.gnu.org/licenses/>.
    17  //
    18  
    19  package core
    20  
    21  import (
    22  	metrics "github.com/nebulasio/go-nebulas/metrics"
    23  )
    24  
    25  // Metrics for core
    26  var (
    27  	// block metrics
    28  	metricsBlockHeightGauge      = metrics.NewGauge("neb.block.height")
    29  	metricsBlocktailHashGauge    = metrics.NewGauge("neb.block.tailhash")
    30  	metricsBlockRevertTimesGauge = metrics.NewGauge("neb.block.revertcount")
    31  	metricsBlockRevertMeter      = metrics.NewMeter("neb.block.revert")
    32  	metricsBlockOnchainTimer     = metrics.NewTimer("neb.block.onchain")
    33  	metricsTxOnchainTimer        = metrics.NewTimer("neb.transaction.onchain")
    34  	metricsBlockPackTxTime       = metrics.NewGauge("neb.block.packtx")
    35  
    36  	// block_pool metrics
    37  	metricsCachedNewBlock      = metrics.NewGauge("neb.block.new.cached")
    38  	metricsCachedDownloadBlock = metrics.NewGauge("neb.block.download.cached")
    39  	metricsLruPoolCacheBlock   = metrics.NewGauge("neb.block.lru.poolcached")
    40  	metricsLruCacheBlock       = metrics.NewGauge("neb.block.lru.blocks")
    41  	metricsLruTailBlock        = metrics.NewGauge("neb.block.lru.tailblock")
    42  
    43  	metricsDuplicatedBlock   = metrics.NewCounter("neb.block.duplicated")
    44  	metricsInvalidBlock      = metrics.NewCounter("neb.block.invalid")
    45  	metricsTxsInBlock        = metrics.NewGauge("neb.block.txs")
    46  	metricsBlockVerifiedTime = metrics.NewGauge("neb.block.executed")
    47  	metricsTxVerifiedTime    = metrics.NewGauge("neb.tx.executed")
    48  	metricsTxPackedCount     = metrics.NewGauge("neb.tx.packed")
    49  	metricsTxUnpackedCount   = metrics.NewGauge("neb.tx.unpacked")
    50  	metricsTxGivebackCount   = metrics.NewGauge("neb.tx.giveback")
    51  
    52  	// txpool metrics
    53  	metricsReceivedTx                      = metrics.NewGauge("neb.txpool.received")
    54  	metricsCachedTx                        = metrics.NewGauge("neb.txpool.cached")
    55  	metricsBucketTx                        = metrics.NewGauge("neb.txpool.bucket")
    56  	metricsCandidates                      = metrics.NewGauge("neb.txpool.candidates")
    57  	metricsInvalidTx                       = metrics.NewCounter("neb.txpool.invalid")
    58  	metricsDuplicateTx                     = metrics.NewCounter("neb.txpool.duplicate")
    59  	metricsTxPoolBelowGasPrice             = metrics.NewCounter("neb.txpool.below_gas_price")
    60  	metricsTxPoolOutOfGasLimit             = metrics.NewCounter("neb.txpool.out_of_gas_limit")
    61  	metricsTxPoolGasLimitLessOrEqualToZero = metrics.NewCounter("neb.txpool.gas_limit_less_equal_zero")
    62  
    63  	// transaction metrics
    64  	metricsTxSubmit     = metrics.NewMeter("neb.transaction.submit")
    65  	metricsTxExecute    = metrics.NewMeter("neb.transaction.execute")
    66  	metricsTxExeSuccess = metrics.NewMeter("neb.transaction.execute.success")
    67  	metricsTxExeFailed  = metrics.NewMeter("neb.transaction.execute.failed")
    68  
    69  	// event metrics
    70  	metricsCachedEvent = metrics.NewGauge("neb.event.cached")
    71  
    72  	// unexpect behavior
    73  	metricsUnexpectedBehavior = metrics.NewGauge("neb.unexpected")
    74  )