From 06a12f17b7dedc12ef8f57e833411320d5002be8 Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 1 Sep 2020 20:22:30 +0300 Subject: [PATCH] reduce log verbosity; debug mostly --- comm.go | 6 +++--- gossipsub.go | 2 +- pubsub.go | 8 ++++---- score.go | 4 ++-- tag_tracer.go | 2 +- tracer.go | 8 ++++---- validation.go | 10 +++++----- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/comm.go b/comm.go index 2d03e88a..db4ff0db 100644 --- a/comm.go +++ b/comm.go @@ -49,7 +49,7 @@ func (p *PubSub) handleNewStream(s network.Stream) { if err != nil { if err != io.EOF { s.Reset() - log.Infof("error reading rpc from %s: %s", s.Conn().RemotePeer(), err) + log.Debugf("error reading rpc from %s: %s", s.Conn().RemotePeer(), err) } else { // Just be nice. They probably won't read this // but it doesn't hurt to send it. @@ -108,7 +108,7 @@ func (p *PubSub) handlePeerEOF(ctx context.Context, s network.Stream) { } return } - log.Warn("unexpected message from ", s.Conn().RemotePeer()) + log.Debugf("unexpected message from %s", s.Conn().RemotePeer()) } } @@ -136,7 +136,7 @@ func (p *PubSub) handleSendingMessages(ctx context.Context, s network.Stream, ou err := writeMsg(&rpc.RPC) if err != nil { s.Reset() - log.Infof("writing message to %s: %s", s.Conn().RemotePeer(), err) + log.Debugf("writing message to %s: %s", s.Conn().RemotePeer(), err) return } case <-ctx.Done(): diff --git a/gossipsub.go b/gossipsub.go index 489cfbb3..6cf7164b 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -1059,7 +1059,7 @@ func (gs *GossipSubRouter) sendRPC(p peer.ID, out *RPC) { } func (gs *GossipSubRouter) doDropRPC(rpc *RPC, p peer.ID, reason string) { - log.Warnf("dropping message to peer %s: %s", p.Pretty(), reason) + log.Debugf("dropping message to peer %s: %s", p.Pretty(), reason) gs.tracer.DropRPC(rpc, p) // push control messages that need to be retried ctl := rpc.GetControl() diff --git a/pubsub.go b/pubsub.go index 5cb01ac5..9bb751a1 100644 --- a/pubsub.go +++ b/pubsub.go @@ -924,13 +924,13 @@ func (p *PubSub) handleIncomingRPC(rpc *RPC) { // ask the router to vet the peer before commiting any processing resources if !p.rt.AcceptFrom(rpc.from) { - log.Infof("received message from router graylisted peer %s. Dropping RPC", rpc.from) + log.Debugf("received message from router graylisted peer %s. Dropping RPC", rpc.from) return } for _, pmsg := range rpc.GetPublish() { if !(p.subscribedToMsg(pmsg) || p.canRelayMsg(pmsg)) { - log.Warn("received message we didn't subscribe to. Dropping.") + log.Debug("received message we didn't subscribe to. Dropping.") continue } @@ -951,14 +951,14 @@ func (p *PubSub) pushMsg(msg *Message) { src := msg.ReceivedFrom // reject messages from blacklisted peers if p.blacklist.Contains(src) { - log.Warnf("dropping message from blacklisted peer %s", src) + log.Debugf("dropping message from blacklisted peer %s", src) p.tracer.RejectMessage(msg, rejectBlacklstedPeer) return } // even if they are forwarded by good peers if p.blacklist.Contains(msg.GetFrom()) { - log.Warnf("dropping message from blacklisted source %s", src) + log.Debugf("dropping message from blacklisted source %s", src) p.tracer.RejectMessage(msg, rejectBlacklistedSource) return } diff --git a/score.go b/score.go index 5e2b58bf..92e36108 100644 --- a/score.go +++ b/score.go @@ -632,7 +632,7 @@ func (ps *peerScore) DeliverMessage(msg *Message) { // defensive check that this is the first delivery trace -- delivery status should be unknown if drec.status != deliveryUnknown { - log.Warnf("unexpected delivery trace: message from %s was first seen %s ago and has delivery status %d", msg.ReceivedFrom, time.Now().Sub(drec.firstSeen), drec.status) + log.Debugf("unexpected delivery trace: message from %s was first seen %s ago and has delivery status %d", msg.ReceivedFrom, time.Now().Sub(drec.firstSeen), drec.status) return } @@ -683,7 +683,7 @@ func (ps *peerScore) RejectMessage(msg *Message, reason string) { // defensive check that this is the first rejection trace -- delivery status should be unknown if drec.status != deliveryUnknown { - log.Warnf("unexpected rejection trace: message from %s was first seen %s ago and has delivery status %d", msg.ReceivedFrom, time.Now().Sub(drec.firstSeen), drec.status) + log.Debugf("unexpected rejection trace: message from %s was first seen %s ago and has delivery status %d", msg.ReceivedFrom, time.Now().Sub(drec.firstSeen), drec.status) return } diff --git a/tag_tracer.go b/tag_tracer.go index 3b7e994a..95919396 100644 --- a/tag_tracer.go +++ b/tag_tracer.go @@ -58,7 +58,7 @@ type tagTracer struct { func newTagTracer(cmgr connmgr.ConnManager) *tagTracer { decayer, ok := connmgr.SupportsDecay(cmgr) if !ok { - log.Warnf("connection manager does not support decaying tags, delivery tags will not be applied") + log.Debugf("connection manager does not support decaying tags, delivery tags will not be applied") } return &tagTracer{ cmgr: cmgr, diff --git a/tracer.go b/tracer.go index 84156efb..582d4457 100644 --- a/tracer.go +++ b/tracer.go @@ -204,7 +204,7 @@ func (t *RemoteTracer) doWrite() { s, err := t.openStream() if err != nil { - log.Warnf("error opening remote tracer stream: %s", err.Error()) + log.Debugf("error opening remote tracer stream: %s", err.Error()) return } @@ -239,13 +239,13 @@ func (t *RemoteTracer) doWrite() { err = w.WriteMsg(&batch) if err != nil { - log.Warnf("error writing trace event batch: %s", err) + log.Debugf("error writing trace event batch: %s", err) goto end } err = gzipW.Flush() if err != nil { - log.Warnf("error flushin gzip stream: %s", err) + log.Debugf("error flushin gzip stream: %s", err) goto end } @@ -269,7 +269,7 @@ func (t *RemoteTracer) doWrite() { s.Reset() s, err = t.openStream() if err != nil { - log.Warnf("error opening remote tracer stream: %s", err.Error()) + log.Debugf("error opening remote tracer stream: %s", err.Error()) return } diff --git a/validation.go b/validation.go index c922c59c..9359f87c 100644 --- a/validation.go +++ b/validation.go @@ -200,7 +200,7 @@ func (v *validation) Push(src peer.ID, msg *Message) bool { select { case v.validateQ <- &validateReq{vals, src, msg}: default: - log.Warnf("message validation throttled: queue full; dropping message from %s", src) + log.Debugf("message validation throttled: queue full; dropping message from %s", src) v.tracer.RejectMessage(msg, rejectValidationQueueFull) } return false @@ -245,7 +245,7 @@ func (v *validation) validate(vals []*topicVal, src peer.ID, msg *Message) { // the Signature is required to be nil upon receiving the message in PubSub.pushMsg. if msg.Signature != nil { if !v.validateSignature(msg) { - log.Warnf("message signature validation failed; dropping message from %s", src) + log.Debugf("message signature validation failed; dropping message from %s", src) v.tracer.RejectMessage(msg, rejectInvalidSignature) return } @@ -285,7 +285,7 @@ loop: } if result == ValidationReject { - log.Warnf("message validation failed; dropping message from %s", src) + log.Debugf("message validation failed; dropping message from %s", src) v.tracer.RejectMessage(msg, rejectValidationFailed) return } @@ -299,7 +299,7 @@ loop: <-v.validateThrottle }() default: - log.Warnf("message validation throttled; dropping message from %s", src) + log.Debugf("message validation throttled; dropping message from %s", src) v.tracer.RejectMessage(msg, rejectValidationThrottled) } return @@ -343,7 +343,7 @@ func (v *validation) doValidateTopic(vals []*topicVal, src peer.ID, msg *Message v.tracer.RejectMessage(msg, rejectValidationIgnored) return case validationThrottled: - log.Warnf("message validation throttled; ignoring message from %s", src) + log.Debugf("message validation throttled; ignoring message from %s", src) v.tracer.RejectMessage(msg, rejectValidationThrottled) default: