From 7b418c36b43b4248b9c94f309e6ab9967d5fb5ae Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 20 Oct 2022 13:50:02 +0400 Subject: [PATCH] [#1930] services/session: Log calling `Create` RPC There is a need to check if session is opened during system testing/debug. Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 1 + cmd/neofs-node/session.go | 4 +--- pkg/services/session/executor.go | 12 +++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5224ba1f..7dedd9618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Changelog for NeoFS Node - `TreeService.GetTrees` RPC (#1902) - All trees synchronization on bootstrap (#1902) - `--force` flag to `neofs-cli control set-status` command (#1916) +- Logging `SessionService.Create` RPC on the server for debug (#1930) ### Changed - Path to a metabase can now be reloaded with a SIGHUP. diff --git a/cmd/neofs-node/session.go b/cmd/neofs-node/session.go index ea8c794d1..df5755713 100644 --- a/cmd/neofs-node/session.go +++ b/cmd/neofs-node/session.go @@ -54,9 +54,7 @@ func initSessionService(c *cfg) { sessionSvc.NewSignService( &c.key.PrivateKey, sessionSvc.NewResponseService( - sessionSvc.NewExecutionService( - c.privateTokenStore, - ), + sessionSvc.NewExecutionService(c.privateTokenStore, c.log), c.respSvc, ), ), diff --git a/pkg/services/session/executor.go b/pkg/services/session/executor.go index 9ca343066..74c66ddcb 100644 --- a/pkg/services/session/executor.go +++ b/pkg/services/session/executor.go @@ -5,6 +5,8 @@ import ( "fmt" "github.com/nspcc-dev/neofs-api-go/v2/session" + "github.com/nspcc-dev/neofs-node/pkg/util/logger" + "go.uber.org/zap" ) type ServiceExecutor interface { @@ -13,16 +15,24 @@ type ServiceExecutor interface { type executorSvc struct { exec ServiceExecutor + + log *logger.Logger } // NewExecutionService wraps ServiceExecutor and returns Session Service interface. -func NewExecutionService(exec ServiceExecutor) Server { +func NewExecutionService(exec ServiceExecutor, l *logger.Logger) Server { return &executorSvc{ exec: exec, + log: l, } } func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) { + s.log.Debug("serving request...", + zap.String("component", "SessionService"), + zap.String("request", "Create"), + ) + respBody, err := s.exec.Create(ctx, req.GetBody()) if err != nil { return nil, fmt.Errorf("could not execute Create request: %w", err)