[#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>
support/v0.34
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)
- 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.

View File

@ -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,
),
),

View File

@ -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)