Normalize filesystem/blob logs (#13644)

This commit is contained in:
Radosław Kapka 2024-02-21 18:34:57 +01:00 committed by GitHub
parent e09ae75c9f
commit f85e027141
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 7 deletions

View File

@ -5,6 +5,7 @@ go_library(
srcs = [ srcs = [
"blob.go", "blob.go",
"ephemeral.go", "ephemeral.go",
"log.go",
"metrics.go", "metrics.go",
"pruner.go", "pruner.go",
], ],

View File

@ -16,7 +16,7 @@ import (
"github.com/prysmaticlabs/prysm/v5/io/file" "github.com/prysmaticlabs/prysm/v5/io/file"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/logging" "github.com/prysmaticlabs/prysm/v5/runtime/logging"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/afero" "github.com/spf13/afero"
) )
@ -83,7 +83,7 @@ func (bs *BlobStorage) WarmCache() {
} }
go func() { go func() {
if err := bs.pruner.prune(0); err != nil { if err := bs.pruner.prune(0); err != nil {
log.WithError(err).Error("Error encountered while warming up blob pruner cache.") log.WithError(err).Error("Error encountered while warming up blob pruner cache")
} }
}() }()
} }
@ -98,7 +98,7 @@ func (bs *BlobStorage) Save(sidecar blocks.VerifiedROBlob) error {
return err return err
} }
if exists { if exists {
log.WithFields(logging.BlobFields(sidecar.ROBlob)).Debug("ignoring a duplicate blob sidecar Save attempt") log.WithFields(logging.BlobFields(sidecar.ROBlob)).Debug("Ignoring a duplicate blob sidecar save attempt")
return nil return nil
} }
if bs.pruner != nil { if bs.pruner != nil {
@ -126,9 +126,9 @@ func (bs *BlobStorage) Save(sidecar blocks.VerifiedROBlob) error {
// It's expected to error if the save is successful. // It's expected to error if the save is successful.
err = bs.fs.Remove(partPath) err = bs.fs.Remove(partPath)
if err == nil { if err == nil {
log.WithFields(log.Fields{ log.WithFields(logrus.Fields{
"partPath": partPath, "partPath": partPath,
}).Debugf("removed partial file") }).Debugf("Removed partial file")
} }
}() }()

View File

@ -0,0 +1,5 @@
package filesystem
import "github.com/sirupsen/logrus"
var log = logrus.WithField("prefix", "filesystem")

View File

@ -16,7 +16,7 @@ import (
"github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v5/time/slots" "github.com/prysmaticlabs/prysm/v5/time/slots"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/afero" "github.com/spf13/afero"
) )
@ -87,7 +87,7 @@ func (p *blobPruner) prune(pruneBefore primitives.Slot) error {
}() }()
} else { } else {
defer func() { defer func() {
log.WithFields(log.Fields{ log.WithFields(logrus.Fields{
"upToEpoch": slots.ToEpoch(pruneBefore), "upToEpoch": slots.ToEpoch(pruneBefore),
"duration": time.Since(start).String(), "duration": time.Since(start).String(),
"filesRemoved": totalPruned, "filesRemoved": totalPruned,