forked from TrueCloudLab/frostfs-node
[#240] logs: Move log messages to constants
Drop duplicate entities. Format entities. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
d29b13454f
commit
0e31c12e63
149 changed files with 1481 additions and 687 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"crypto/sha256"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
clientcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
||||
netmapcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/storagegroup"
|
||||
|
@ -24,23 +25,23 @@ func (ap *Processor) processStartAudit(epoch uint64) {
|
|||
|
||||
skipped := ap.taskManager.Reset()
|
||||
if skipped > 0 {
|
||||
ap.log.Info("some tasks from previous epoch are skipped",
|
||||
ap.log.Info(logs.AuditSomeTasksFromPreviousEpochAreSkipped,
|
||||
zap.Int("amount", skipped),
|
||||
)
|
||||
}
|
||||
|
||||
containers, err := ap.selectContainersToAudit(epoch)
|
||||
if err != nil {
|
||||
log.Error("container selection failure", zap.String("error", err.Error()))
|
||||
log.Error(logs.AuditContainerSelectionFailure, zap.String("error", err.Error()))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("select containers for audit", zap.Int("amount", len(containers)))
|
||||
log.Info(logs.AuditSelectContainersForAudit, zap.Int("amount", len(containers)))
|
||||
|
||||
nm, err := ap.netmapClient.GetNetMap(0)
|
||||
if err != nil {
|
||||
ap.log.Error("can't fetch network map",
|
||||
ap.log.Error(logs.AuditCantFetchNetworkMap,
|
||||
zap.String("error", err.Error()))
|
||||
|
||||
return
|
||||
|
@ -64,7 +65,7 @@ func (ap *Processor) startAuditTasksOnContainers(cancelChannel <-chan struct{},
|
|||
for i := range containers {
|
||||
cnr, err := cntClient.Get(ap.containerClient, containers[i]) // get container structure
|
||||
if err != nil {
|
||||
log.Error("can't get container info, ignore",
|
||||
log.Error(logs.AuditCantGetContainerInfoIgnore,
|
||||
zap.Stringer("cid", containers[i]),
|
||||
zap.String("error", err.Error()))
|
||||
|
||||
|
@ -76,7 +77,7 @@ func (ap *Processor) startAuditTasksOnContainers(cancelChannel <-chan struct{},
|
|||
// find all container nodes for current epoch
|
||||
nodes, err := nm.ContainerNodes(cnr.Value.PlacementPolicy(), pivot)
|
||||
if err != nil {
|
||||
log.Info("can't build placement for container, ignore",
|
||||
log.Info(logs.AuditCantBuildPlacementForContainerIgnore,
|
||||
zap.Stringer("cid", containers[i]),
|
||||
zap.String("error", err.Error()))
|
||||
|
||||
|
@ -92,13 +93,13 @@ func (ap *Processor) startAuditTasksOnContainers(cancelChannel <-chan struct{},
|
|||
|
||||
// search storage groups
|
||||
storageGroupsIDs := ap.findStorageGroups(containers[i], n)
|
||||
log.Info("select storage groups for audit",
|
||||
log.Info(logs.AuditSelectStorageGroupsForAudit,
|
||||
zap.Stringer("cid", containers[i]),
|
||||
zap.Int("amount", len(storageGroupsIDs)))
|
||||
|
||||
// filter expired storage groups
|
||||
storageGroups := ap.filterExpiredSG(containers[i], storageGroupsIDs, nodes, *nm)
|
||||
log.Info("filter expired storage groups for audit",
|
||||
log.Info(logs.AuditFilterExpiredStorageGroupsForAudit,
|
||||
zap.Stringer("cid", containers[i]),
|
||||
zap.Int("amount", len(storageGroups)))
|
||||
|
||||
|
@ -146,7 +147,7 @@ func (ap *Processor) findStorageGroups(cnr cid.ID, shuffled netmapcore.Nodes) []
|
|||
|
||||
err := clientcore.NodeInfoFromRawNetmapElement(&info, netmapcore.Node(shuffled[i]))
|
||||
if err != nil {
|
||||
log.Warn("parse client node info", zap.String("error", err.Error()))
|
||||
log.Warn(logs.AuditParseClientNodeInfo, zap.String("error", err.Error()))
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ func (ap *Processor) findStorageGroups(cnr cid.ID, shuffled netmapcore.Nodes) []
|
|||
cancel()
|
||||
|
||||
if err != nil {
|
||||
log.Warn("error in storage group search", zap.String("error", err.Error()))
|
||||
log.Warn(logs.AuditErrorInStorageGroupSearch, zap.String("error", err.Error()))
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue