Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-pubsub
Commits
3f30acdc
Commit
3f30acdc
authored
Nov 11, 2019
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track topics in message tracing
parent
ae0fcc6b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
417 additions
and
111 deletions
+417
-111
pb/trace.pb.go
pb/trace.pb.go
+403
-107
pb/trace.proto
pb/trace.proto
+7
-1
trace.go
trace.go
+7
-3
No files found.
pb/trace.pb.go
View file @
3f30acdc
This diff is collapsed.
Click to expand it.
pb/trace.proto
View file @
3f30acdc
...
...
@@ -39,6 +39,7 @@ message TraceEvent {
message
PublishMessage
{
optional
bytes
messageID
=
1
;
repeated
string
topics
=
2
;
}
message
RejectMessage
{
...
...
@@ -99,11 +100,16 @@ message TraceEvent {
}
message
RPCMeta
{
repeated
bytes
message
ID
s
=
1
;
repeated
MessageMeta
messages
=
1
;
repeated
SubMeta
subscription
=
2
;
optional
ControlMeta
control
=
3
;
}
message
MessageMeta
{
optional
bytes
messageID
=
1
;
repeated
string
topics
=
2
;
}
message
SubMeta
{
optional
bool
subscribe
=
1
;
optional
string
topic
=
2
;
...
...
trace.go
View file @
3f30acdc
...
...
@@ -31,6 +31,7 @@ func (t *pubsubTracer) PublishMessage(msg *Message) {
Timestamp
:
&
now
,
PublishMessage
:
&
pb
.
TraceEvent_PublishMessage
{
MessageID
:
[]
byte
(
msgID
(
msg
.
Message
)),
Topics
:
msg
.
Message
.
TopicIDs
,
},
}
...
...
@@ -192,11 +193,14 @@ func (t *pubsubTracer) DropRPC(rpc *RPC, p peer.ID) {
func
traceRPCMeta
(
rpc
*
RPC
)
*
pb
.
TraceEvent_RPCMeta
{
rpcMeta
:=
new
(
pb
.
TraceEvent_RPCMeta
)
var
m
id
s
[]
[]
byte
var
m
sg
s
[]
*
pb
.
TraceEvent_MessageMeta
for
_
,
m
:=
range
rpc
.
Publish
{
mids
=
append
(
mids
,
[]
byte
(
msgID
(
m
)))
msgs
=
append
(
msgs
,
&
pb
.
TraceEvent_MessageMeta
{
MessageID
:
[]
byte
(
msgID
(
m
)),
Topics
:
m
.
TopicIDs
,
})
}
rpcMeta
.
Message
ID
s
=
m
id
s
rpcMeta
.
Messages
=
m
sg
s
var
subs
[]
*
pb
.
TraceEvent_SubMeta
for
_
,
sub
:=
range
rpc
.
Subscriptions
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment