Skip to content
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

Merged
merged 7 commits into from Jun 19, 2020
Merged

EN 6813 p2p debugger #1978

merged 7 commits into from Jun 19, 2020

Conversation

iulianpascalau
Copy link
Contributor

  • added p2p debugger component that will display bandwidth used by a node split by topic usage.
    To enable it, run the node with *:INFO,debug/p2p:TRACE

@iulianpascalau iulianpascalau self-assigned this Jun 18, 2020
@sasurobert sasurobert self-requested a review June 18, 2020 16:10

var log = logger.GetOrCreate("debug/p2p")

const printTimeOneSecond = time.Second //if this needs to be changed, remember to divide the values when computing metrics
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return pd
}

func (pd *p2pDebugger) checkLogTrace() bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isLogTrace

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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

}
}

func (pd *p2pDebugger) doStatsString() string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startsToString

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statsToString

return m
}

func (pd *p2pDebugger) doStats(ctx context.Context) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a better name ?

Copy link
Contributor Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment to public interface

@AdoAdoAdo AdoAdoAdo requested review from AdoAdoAdo and BeniaminDrasovean and removed request for AdoAdoAdo June 19, 2020 07:20
Copy link
Contributor

@BeniaminDrasovean BeniaminDrasovean left a 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.

Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System tests passed.

@LucianMincu LucianMincu merged commit 5ea972d into release-candidate Jun 19, 2020
@LucianMincu LucianMincu deleted the EN-6813-p2p-debugger branch June 19, 2020 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants