[#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 <ctulhurider@gmail.com>
This commit is contained in:
Leonard Lyubich 2022-10-20 13:50:02 +04:00 committed by fyrchik
parent 8bba490c30
commit 7b418c36b4
3 changed files with 13 additions and 4 deletions

View file

@ -10,6 +10,7 @@ Changelog for NeoFS Node
- `TreeService.GetTrees` RPC (#1902) - `TreeService.GetTrees` RPC (#1902)
- All trees synchronization on bootstrap (#1902) - All trees synchronization on bootstrap (#1902)
- `--force` flag to `neofs-cli control set-status` command (#1916) - `--force` flag to `neofs-cli control set-status` command (#1916)
- Logging `SessionService.Create` RPC on the server for debug (#1930)
### Changed ### Changed
- Path to a metabase can now be reloaded with a SIGHUP. - Path to a metabase can now be reloaded with a SIGHUP.

View file

@ -54,9 +54,7 @@ func initSessionService(c *cfg) {
sessionSvc.NewSignService( sessionSvc.NewSignService(
&c.key.PrivateKey, &c.key.PrivateKey,
sessionSvc.NewResponseService( sessionSvc.NewResponseService(
sessionSvc.NewExecutionService( sessionSvc.NewExecutionService(c.privateTokenStore, c.log),
c.privateTokenStore,
),
c.respSvc, c.respSvc,
), ),
), ),

View file

@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"github.com/nspcc-dev/neofs-api-go/v2/session" "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 { type ServiceExecutor interface {
@ -13,16 +15,24 @@ type ServiceExecutor interface {
type executorSvc struct { type executorSvc struct {
exec ServiceExecutor exec ServiceExecutor
log *logger.Logger
} }
// NewExecutionService wraps ServiceExecutor and returns Session Service interface. // NewExecutionService wraps ServiceExecutor and returns Session Service interface.
func NewExecutionService(exec ServiceExecutor) Server { func NewExecutionService(exec ServiceExecutor, l *logger.Logger) Server {
return &executorSvc{ return &executorSvc{
exec: exec, exec: exec,
log: l,
} }
} }
func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) { 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()) respBody, err := s.exec.Create(ctx, req.GetBody())
if err != nil { if err != nil {
return nil, fmt.Errorf("could not execute Create request: %w", err) return nil, fmt.Errorf("could not execute Create request: %w", err)