New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EN 6813 p2p debugger #1978
EN 6813 p2p debugger #1978
Conversation
…rk/elrond-go into EN-6813-p2p-debugger
debug/p2p/p2pDebugger.go
Outdated
|
||
var log = logger.GetOrCreate("debug/p2p") | ||
|
||
const printTimeOneSecond = time.Second //if this needs to be changed, remember to divide the values when computing metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a const for X * time.second - use X for division :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should have never wrote that comment :))))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
debug/p2p/p2pDebugger.go
Outdated
return pd | ||
} | ||
|
||
func (pd *p2pDebugger) checkLogTrace() bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isLogTrace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
mut sync.Mutex | ||
data map[string]*metric | ||
cancelFunc func() | ||
shouldProcessDataFn func() bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for these 2 function pointers - shouldProcessDataFn and printStringFn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need them to properly test this struct
debug/p2p/p2pDebugger.go
Outdated
} | ||
} | ||
|
||
func (pd *p2pDebugger) doStatsString() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startsToString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statsToString
debug/p2p/p2pDebugger.go
Outdated
return m | ||
} | ||
|
||
func (pd *p2pDebugger) doStats(ctx context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a better name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuouslyPrintStatistics
@@ -277,3 +277,10 @@ type Cacher interface { | |||
HasOrAdd(key []byte, value interface{}, sizeInBytes int) (ok, evicted bool) | |||
IsInterfaceNil() bool | |||
} | |||
|
|||
type Debugger interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment to public interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just what Robert found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System tests passed.
To enable it, run the node with
*:INFO,debug/p2p:TRACE