-
Notifications
You must be signed in to change notification settings - Fork 189
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
tracing support #227
Merged
Merged
tracing support #227
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
67275a6
tracing scaffolding
vyzo 89c7ed4
trace publish
vyzo fd73973
add tracing to floodsub/randomsub
vyzo 958e09a
remove useless nil check when initializing subsystem tracers
vyzo fb11aa9
initialize tracer with peer ID, trace RPC from join/leave announcements
vyzo 0a25f24
trace event protobuf
vyzo 040cabe
some minor fixes in trace pb
vyzo 151ec25
implement tracing details
vyzo ae0fcc6
add traces for send/drop rpc
vyzo 3f30acd
track topics in message tracing
vyzo 3545acf
json tracer
vyzo 8ff321c
move tracer implementation to its own file
vyzo f134d65
add protobuf file tracer
vyzo 0aa629c
use *pb.TraceEvent as argument for Trace in the EventTracer interface
vyzo 57ea27e
remote tracer
vyzo 2fc5518
remote tracer: wait a second to accumulate batches
vyzo db8e219
remove CompressedTraceEventBatch from trace protobuf
vyzo abe4763
compress entire stream in remote tracer
vyzo cce30a4
reset remote tracer stream on errors
vyzo 91527e2
lossy tracing for remote tracers
vyzo 24a1181
move niling of trace buffer to the end
vyzo 7a5aaa8
don't blanket wait for 1s to accumulate a batch.
vyzo 40e5a49
store the remote trace peer address in the peerstore
vyzo cd7f42e
make tracer.Close safer
vyzo 7065297
nits and beauty
vyzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ func NewFloodSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, err | |
type FloodSubRouter struct { | ||
p *PubSub | ||
protocols []protocol.ID | ||
tracer *pubsubTracer | ||
} | ||
|
||
func (fs *FloodSubRouter) Protocols() []protocol.ID { | ||
|
@@ -39,11 +40,16 @@ func (fs *FloodSubRouter) Protocols() []protocol.ID { | |
|
||
func (fs *FloodSubRouter) Attach(p *PubSub) { | ||
fs.p = p | ||
fs.tracer = p.tracer | ||
} | ||
|
||
func (fs *FloodSubRouter) AddPeer(peer.ID, protocol.ID) {} | ||
func (fs *FloodSubRouter) AddPeer(p peer.ID, proto protocol.ID) { | ||
fs.tracer.AddPeer(p, proto) | ||
} | ||
|
||
func (fs *FloodSubRouter) RemovePeer(peer.ID) {} | ||
func (fs *FloodSubRouter) RemovePeer(p peer.ID) { | ||
fs.tracer.RemovePeer(p) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, it could be in either place, just felt more natural to do it in the router. |
||
} | ||
|
||
func (fs *FloodSubRouter) EnoughPeers(topic string, suggested int) bool { | ||
// check all peers in the topic | ||
|
@@ -91,13 +97,19 @@ func (fs *FloodSubRouter) Publish(from peer.ID, msg *pb.Message) { | |
|
||
select { | ||
case mch <- out: | ||
fs.tracer.SendRPC(out, pid) | ||
default: | ||
log.Infof("dropping message to peer %s: queue full", pid) | ||
fs.tracer.DropRPC(out, pid) | ||
// Drop it. The peer is too slow. | ||
} | ||
} | ||
} | ||
|
||
func (fs *FloodSubRouter) Join(topic string) {} | ||
func (fs *FloodSubRouter) Join(topic string) { | ||
fs.tracer.Join(topic) | ||
} | ||
|
||
func (fs *FloodSubRouter) Leave(topic string) {} | ||
func (fs *FloodSubRouter) Leave(topic string) { | ||
fs.tracer.Join(topic) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 this be in the router or in the part that calls
AddPeer
?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.
We could have it in the control substrate, it just felt more natural to do it in the router.
Other than that there is no particular reason for the choice.