Skip to content
Snippets Groups Projects
Select Git revision
  • 203c1286832064ac59e65398f819a301718c42f5
  • main default protected
2 results

binary_classification_workflow.py

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) })
    }