forked from TrueCloudLab/frostfs-node
[#240] logs: Factor out common service log messages
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
0e31c12e63
commit
cffcc7745e
15 changed files with 53 additions and 64 deletions
|
@ -35,7 +35,7 @@ func (s *Service) Delete(ctx context.Context, prm Prm) error {
|
|||
}
|
||||
|
||||
func (exec *execCtx) execute(ctx context.Context) {
|
||||
exec.log.Debug(logs.DeleteServingRequest)
|
||||
exec.log.Debug(logs.ServingRequest)
|
||||
|
||||
// perform local operation
|
||||
exec.executeLocal(ctx)
|
||||
|
@ -47,9 +47,9 @@ func (exec *execCtx) analyzeStatus(execCnr bool) {
|
|||
// analyze local result
|
||||
switch exec.status {
|
||||
case statusOK:
|
||||
exec.log.Debug(logs.DeleteOperationFinishedSuccessfully)
|
||||
exec.log.Debug(logs.OperationFinishedSuccessfully)
|
||||
default:
|
||||
exec.log.Debug(logs.DeleteOperationFinishedWithError,
|
||||
exec.log.Debug(logs.OperationFinishedWithError,
|
||||
zap.String("error", exec.err.Error()),
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ func (exec *execCtx) executeOnContainer(ctx context.Context) {
|
|||
|
||||
lookupDepth := exec.netmapLookupDepth()
|
||||
|
||||
exec.log.Debug(logs.GetTryingToExecuteInContainer,
|
||||
exec.log.Debug(logs.TryingToExecuteInContainer,
|
||||
zap.Uint64("netmap lookup depth", lookupDepth),
|
||||
)
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (exec *execCtx) executeOnContainer(ctx context.Context) {
|
|||
}
|
||||
|
||||
func (exec *execCtx) processCurrentEpoch(ctx context.Context) bool {
|
||||
exec.log.Debug(logs.GetProcessEpoch,
|
||||
exec.log.Debug(logs.ProcessEpoch,
|
||||
zap.Uint64("number", exec.curProcEpoch),
|
||||
)
|
||||
|
||||
|
@ -61,7 +61,7 @@ func (exec *execCtx) processCurrentEpoch(ctx context.Context) bool {
|
|||
for {
|
||||
addrs := traverser.Next()
|
||||
if len(addrs) == 0 {
|
||||
exec.log.Debug(logs.GetNoMoreNodesAbortPlacementIteration)
|
||||
exec.log.Debug(logs.NoMoreNodesAbortPlacementIteration)
|
||||
|
||||
return false
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func (exec *execCtx) processCurrentEpoch(ctx context.Context) bool {
|
|||
for i := range addrs {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
exec.log.Debug(logs.GetInterruptPlacementIterationByContext,
|
||||
exec.log.Debug(logs.InterruptPlacementIterationByContext,
|
||||
zap.String("error", ctx.Err().Error()),
|
||||
)
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ func (exec *execCtx) initEpoch() bool {
|
|||
exec.status = statusUndefined
|
||||
exec.err = err
|
||||
|
||||
exec.log.Debug(logs.GetCouldNotGetCurrentEpochNumber,
|
||||
exec.log.Debug(logs.CouldNotGetCurrentEpochNumber,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) st
|
|||
}
|
||||
|
||||
func (exec *execCtx) execute(ctx context.Context) {
|
||||
exec.log.Debug(logs.GetServingRequest)
|
||||
exec.log.Debug(logs.ServingRequest)
|
||||
|
||||
// perform local operation
|
||||
exec.executeLocal(ctx)
|
||||
|
@ -96,7 +96,7 @@ func (exec *execCtx) analyzeStatus(ctx context.Context, execCnr bool) {
|
|||
// analyze local result
|
||||
switch exec.status {
|
||||
case statusOK:
|
||||
exec.log.Debug(logs.GetOperationFinishedSuccessfully)
|
||||
exec.log.Debug(logs.OperationFinishedSuccessfully)
|
||||
case statusINHUMED:
|
||||
exec.log.Debug(logs.GetRequestedObjectWasMarkedAsRemoved)
|
||||
case statusVIRTUAL:
|
||||
|
@ -105,7 +105,7 @@ func (exec *execCtx) analyzeStatus(ctx context.Context, execCnr bool) {
|
|||
case statusOutOfRange:
|
||||
exec.log.Debug(logs.GetRequestedRangeIsOutOfObjectBounds)
|
||||
default:
|
||||
exec.log.Debug(logs.GetOperationFinishedWithError,
|
||||
exec.log.Debug(logs.OperationFinishedWithError,
|
||||
zap.String("error", exec.err.Error()),
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ func (exec *execCtx) processNode(ctx context.Context, info client.NodeInfo) bool
|
|||
ctx, span := tracing.StartSpanFromContext(ctx, "getService.processNode")
|
||||
defer span.End()
|
||||
|
||||
exec.log.Debug(logs.GetProcessingNode)
|
||||
exec.log.Debug(logs.ProcessingNode)
|
||||
|
||||
client, ok := exec.remoteClient(info)
|
||||
if !ok {
|
||||
|
|
|
@ -18,7 +18,7 @@ func (exec *execCtx) executeOnContainer(ctx context.Context) {
|
|||
|
||||
lookupDepth := exec.netmapLookupDepth()
|
||||
|
||||
exec.log.Debug(logs.SearchTryingToExecuteInContainer,
|
||||
exec.log.Debug(logs.TryingToExecuteInContainer,
|
||||
zap.Uint64("netmap lookup depth", lookupDepth),
|
||||
)
|
||||
|
||||
|
@ -49,7 +49,7 @@ func (exec *execCtx) executeOnContainer(ctx context.Context) {
|
|||
}
|
||||
|
||||
func (exec *execCtx) processCurrentEpoch(ctx context.Context) bool {
|
||||
exec.log.Debug(logs.SearchProcessEpoch,
|
||||
exec.log.Debug(logs.ProcessEpoch,
|
||||
zap.Uint64("number", exec.curProcEpoch),
|
||||
)
|
||||
|
||||
|
@ -64,7 +64,7 @@ func (exec *execCtx) processCurrentEpoch(ctx context.Context) bool {
|
|||
for {
|
||||
addrs := traverser.Next()
|
||||
if len(addrs) == 0 {
|
||||
exec.log.Debug(logs.SearchNoMoreNodesAbortPlacementIteration)
|
||||
exec.log.Debug(logs.NoMoreNodesAbortPlacementIteration)
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ func (exec *execCtx) processCurrentEpoch(ctx context.Context) bool {
|
|||
defer wg.Done()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
exec.log.Debug(logs.SearchInterruptPlacementIterationByContext,
|
||||
exec.log.Debug(logs.InterruptPlacementIterationByContext,
|
||||
zap.String("error", ctx.Err().Error()))
|
||||
return
|
||||
default:
|
||||
|
@ -87,7 +87,7 @@ func (exec *execCtx) processCurrentEpoch(ctx context.Context) bool {
|
|||
|
||||
client.NodeInfoFromNetmapElement(&info, addrs[i])
|
||||
|
||||
exec.log.Debug(logs.SearchProcessingNode, zap.String("key", hex.EncodeToString(addrs[i].PublicKey())))
|
||||
exec.log.Debug(logs.ProcessingNode, zap.String("key", hex.EncodeToString(addrs[i].PublicKey())))
|
||||
|
||||
c, err := exec.svc.clientConstructor.get(info)
|
||||
if err != nil {
|
||||
|
|
|
@ -81,7 +81,7 @@ func (exec *execCtx) initEpoch() bool {
|
|||
exec.status = statusUndefined
|
||||
exec.err = err
|
||||
|
||||
exec.log.Debug(logs.SearchCouldNotGetCurrentEpochNumber,
|
||||
exec.log.Debug(logs.CouldNotGetCurrentEpochNumber,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ func (s *Service) Search(ctx context.Context, prm Prm) error {
|
|||
}
|
||||
|
||||
func (exec *execCtx) execute(ctx context.Context) {
|
||||
exec.log.Debug(logs.SearchServingRequest)
|
||||
exec.log.Debug(logs.ServingRequest)
|
||||
|
||||
// perform local operation
|
||||
exec.executeLocal()
|
||||
|
@ -36,11 +36,11 @@ func (exec *execCtx) analyzeStatus(ctx context.Context, execCnr bool) {
|
|||
// analyze local result
|
||||
switch exec.status {
|
||||
default:
|
||||
exec.log.Debug(logs.SearchOperationFinishedWithError,
|
||||
exec.log.Debug(logs.OperationFinishedWithError,
|
||||
zap.String("error", exec.err.Error()),
|
||||
)
|
||||
case statusOK:
|
||||
exec.log.Debug(logs.SearchOperationFinishedSuccessfully)
|
||||
exec.log.Debug(logs.OperationFinishedSuccessfully)
|
||||
}
|
||||
|
||||
if execCnr {
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewExecutionService(exec ServiceExecutor, l *logger.Logger) Server {
|
|||
}
|
||||
|
||||
func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
||||
s.log.Debug(logs.SessionServingRequest,
|
||||
s.log.Debug(logs.ServingRequest,
|
||||
zap.String("component", "SessionService"),
|
||||
zap.String("request", "Create"),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue