Skip to content
Snippets Groups Projects
Select Git revision
  • aa210a5439c2aa56912948bca9526533cab6628c
  • without_tipselection default
  • develop protected
  • fix/grafana-local-dashboard
  • wasp
  • fix/dashboard-explorer-freeze
  • master
  • feat/timerqueue
  • test/sync_debug_and_650
  • feat/sync_revamp_inv
  • wip/sync
  • tool/db-recovery
  • portcheck/fix
  • fix/synchronization
  • feat/new-dashboard-analysis
  • feat/refactored-analysis-dashboard
  • feat/new-analysis-dashboard
  • test/demo-prometheus-fpc
  • prometheus_metrics
  • wip/analysis-server
  • merge/fpc-test-value-transfer
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.3
  • v0.1.2
  • v0.1.1
  • v0.1.0
28 results

plugin.go

Blame
  • plugin.go 864 B
    package metrics
    
    import (
    	"time"
    
    	"github.com/iotaledger/goshimmer/packages/model/meta_transaction"
    	"github.com/iotaledger/goshimmer/packages/timeutil"
    	"github.com/iotaledger/goshimmer/plugins/gossip"
    	"github.com/iotaledger/hive.go/daemon"
    	"github.com/iotaledger/hive.go/events"
    	"github.com/iotaledger/hive.go/node"
    )
    
    var PLUGIN = node.NewPlugin("Metrics", node.Enabled, configure, run)
    
    func configure(plugin *node.Plugin) {
    	// increase received TPS counter whenever we receive a new transaction
    	gossip.Events.ReceiveTransaction.Attach(events.NewClosure(func(_ *meta_transaction.MetaTransaction) { increaseReceivedTPSCounter() }))
    }
    
    func run(plugin *node.Plugin) {
    	// create a background worker that "measures" the TPS value every second
    	daemon.BackgroundWorker("Metrics TPS Updater", func() { timeutil.Ticker(measureReceivedTPS, 1*time.Second) })
    }