protocol / beyond-bitswap

Other
34 stars 9 forks source link

Refactor emitMetrics function #2

Open adlrocha opened 3 years ago

adlrocha commented 3 years ago

This function is a nightmare and needs to be cleaned!

func (n *IPFSNode) EmitMetrics(runenv *runtime.RunEnv, runNum int, seq int64, grpseq int64,
    latency time.Duration, bandwidthMB int, fileSize int, nodetp NodeType, tpindex int, timeToFetch int64, tcpFetch int64, leechFails int64) error

Create a NodeMetrics struct to track all the metrics for a node. Already tested the approach but I chose to leave it for when the full code is refactores and working.

type NodeMetrics struct {
   TimeToFetch int64
   TCPFetch int64
   LeechFails int64
}