From 24ef8c8c2847ca95951bc6101539affae23ab95d Mon Sep 17 00:00:00 2001 From: Lukas Vogel Date: Thu, 3 Jan 2019 10:27:21 +0100 Subject: [PATCH] PS: Improve logging Print destination for remote requests --- go/path_srv/internal/handlers/segreq.go | 9 ++++----- go/path_srv/internal/handlers/segreqnoncore.go | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/go/path_srv/internal/handlers/segreq.go b/go/path_srv/internal/handlers/segreq.go index 56c721ad1f..e9dad3dc1e 100644 --- a/go/path_srv/internal/handlers/segreq.go +++ b/go/path_srv/internal/handlers/segreq.go @@ -32,7 +32,6 @@ import ( "github.com/scionproto/scion/go/lib/revcache" "github.com/scionproto/scion/go/lib/scrypto" "github.com/scionproto/scion/go/lib/scrypto/trc" - "github.com/scionproto/scion/go/lib/snet" "github.com/scionproto/scion/go/path_srv/internal/segutil" "github.com/scionproto/scion/go/proto" ) @@ -111,6 +110,8 @@ func (h *segReqHandler) fetchDownSegs(ctx context.Context, msger infra.Messenger if err != nil { return nil, err } + logger := log.FromCtx(ctx) + logger.Debug("[segReqHandler] Fetch down segments", "dst", dst, "remote", cAddr) if err = h.fetchAndSaveSegs(ctx, msger, addr.IA{}, dst, cAddr); err != nil { return nil, err } @@ -124,9 +125,6 @@ func (h *segReqHandler) fetchAndSaveSegs(ctx context.Context, msger infra.Messen logger := log.FromCtx(ctx) queryTime := time.Now() r := &path_mgmt.SegReq{RawSrcIA: src.IAInt(), RawDstIA: dst.IAInt()} - if snetAddr, ok := cPSAddr.(*snet.Addr); ok { - logger.Trace("[segReqHandler] Sending segment request", "NextHop", snetAddr.NextHop) - } segs, err := h.getSegsFromNetwork(ctx, r, cPSAddr, messenger.NextId()) if err != nil { return err @@ -194,7 +192,8 @@ func (h *segReqHandler) sendReply(ctx context.Context, msger infra.Messenger, if err != nil { logger.Error("[segReqHandler] Failed to send reply!", "err", err) } - logger.Debug("[segReqHandler] reply sent", "id", h.request.ID) + logger.Debug("[segReqHandler] reply sent", "id", h.request.ID, + "ups", len(upSegs), "cores", len(coreSegs), "downs", len(downSegs)) } func (h *segReqHandler) collectSegs(upSegs, coreSegs, downSegs []*seg.PathSegment) []*seg.Meta { diff --git a/go/path_srv/internal/handlers/segreqnoncore.go b/go/path_srv/internal/handlers/segreqnoncore.go index cf3be4466d..5e05fd529b 100644 --- a/go/path_srv/internal/handlers/segreqnoncore.go +++ b/go/path_srv/internal/handlers/segreqnoncore.go @@ -16,7 +16,6 @@ package handlers import ( "context" - "fmt" "math/rand" "net" "time" @@ -232,7 +231,6 @@ func (h *segReqNonCoreHandler) fetchCoreSegs(ctx context.Context, msger infra.Messenger, src, dst addr.IA, dbOnly bool) ([]*seg.PathSegment, error) { logger := log.FromCtx(ctx) - logger.Debug("[segReqHanlder:fetchCoreSegs]", "query", fmt.Sprintf("%v->%v", src, dst)) // try local cache first, inverse query since core segs are stored in inverse direction. q := &query.Params{ SegTypes: []proto.PathSegType{proto.PathSegType_core}, @@ -260,6 +258,7 @@ func (h *segReqNonCoreHandler) fetchCoreSegs(ctx context.Context, if err != nil { return nil, err } + logger.Debug("[segReqHandler] Request core segments", "src", src, "dst", dst, "remote", cPS) if err = h.fetchAndSaveSegs(ctx, msger, src, dst, cPS); err != nil { return nil, err }