disable certain traces to avoid extreme copy overhead

This commit is contained in:
Cassandra Heart 2024-08-10 19:34:03 -05:00
parent 139c6747d3
commit 9d0cf0bc68
No known key found for this signature in database
GPG Key ID: 6352152859385958

View File

@ -148,19 +148,20 @@ func (t *pubsubTracer) DuplicateMessage(msg *Message) {
return
}
now := time.Now().UnixNano()
evt := &pb.TraceEvent{
Type: pb.TraceEvent_DUPLICATE_MESSAGE.Enum(),
PeerID: []byte(t.pid),
Timestamp: &now,
DuplicateMessage: &pb.TraceEvent_DuplicateMessage{
MessageID: []byte(t.idGen.ID(msg)),
ReceivedFrom: []byte(msg.ReceivedFrom),
Bitmask: msg.Bitmask,
},
}
// disable for now
// now := time.Now().UnixNano()
// evt := &pb.TraceEvent{
// Type: pb.TraceEvent_DUPLICATE_MESSAGE.Enum(),
// PeerID: []byte(t.pid),
// Timestamp: &now,
// DuplicateMessage: &pb.TraceEvent_DuplicateMessage{
// MessageID: []byte(t.idGen.ID(msg)),
// ReceivedFrom: []byte(msg.ReceivedFrom),
// Bitmask: msg.Bitmask,
// },
// }
t.tracer.Trace(evt)
// t.tracer.Trace(evt)
}
func (t *pubsubTracer) DeliverMessage(msg *Message) {
@ -260,18 +261,19 @@ func (t *pubsubTracer) RecvRPC(rpc *RPC) {
return
}
now := time.Now().UnixNano()
evt := &pb.TraceEvent{
Type: pb.TraceEvent_RECV_RPC.Enum(),
PeerID: []byte(t.pid),
Timestamp: &now,
RecvRPC: &pb.TraceEvent_RecvRPC{
ReceivedFrom: []byte(rpc.from),
Meta: t.traceRPCMeta(rpc),
},
}
// disable for now
// now := time.Now().UnixNano()
// evt := &pb.TraceEvent{
// Type: pb.TraceEvent_RECV_RPC.Enum(),
// PeerID: []byte(t.pid),
// Timestamp: &now,
// RecvRPC: &pb.TraceEvent_RecvRPC{
// ReceivedFrom: []byte(rpc.from),
// Meta: t.traceRPCMeta(rpc),
// },
// }
t.tracer.Trace(evt)
// t.tracer.Trace(evt)
}
func (t *pubsubTracer) SendRPC(rpc *RPC, p peer.ID) {
@ -287,18 +289,19 @@ func (t *pubsubTracer) SendRPC(rpc *RPC, p peer.ID) {
return
}
now := time.Now().UnixNano()
evt := &pb.TraceEvent{
Type: pb.TraceEvent_SEND_RPC.Enum(),
PeerID: []byte(t.pid),
Timestamp: &now,
SendRPC: &pb.TraceEvent_SendRPC{
SendTo: []byte(p),
Meta: t.traceRPCMeta(rpc),
},
}
// disable for now
// now := time.Now().UnixNano()
// evt := &pb.TraceEvent{
// Type: pb.TraceEvent_SEND_RPC.Enum(),
// PeerID: []byte(t.pid),
// Timestamp: &now,
// SendRPC: &pb.TraceEvent_SendRPC{
// SendTo: []byte(p),
// Meta: t.traceRPCMeta(rpc),
// },
// }
t.tracer.Trace(evt)
// t.tracer.Trace(evt)
}
func (t *pubsubTracer) DropRPC(rpc *RPC, p peer.ID) {
@ -314,18 +317,19 @@ func (t *pubsubTracer) DropRPC(rpc *RPC, p peer.ID) {
return
}
now := time.Now().UnixNano()
evt := &pb.TraceEvent{
Type: pb.TraceEvent_DROP_RPC.Enum(),
PeerID: []byte(t.pid),
Timestamp: &now,
DropRPC: &pb.TraceEvent_DropRPC{
SendTo: []byte(p),
Meta: t.traceRPCMeta(rpc),
},
}
// disable for now
// now := time.Now().UnixNano()
// evt := &pb.TraceEvent{
// Type: pb.TraceEvent_DROP_RPC.Enum(),
// PeerID: []byte(t.pid),
// Timestamp: &now,
// DropRPC: &pb.TraceEvent_DropRPC{
// SendTo: []byte(p),
// Meta: t.traceRPCMeta(rpc),
// },
// }
t.tracer.Trace(evt)
// t.tracer.Trace(evt)
}
func (t *pubsubTracer) UndeliverableMessage(msg *Message) {