forked from TrueCloudLab/frostfs-node
[#1619] logger: Set tags for node
components
Change-Id: I55ffcce9d2a74fdd47621674739b07f2e20199e3 Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
36fb15b9a4
commit
100eb8b654
37 changed files with 151 additions and 77 deletions
|
@ -159,7 +159,8 @@ func getSubStorages(ctx context.Context, sh *shardconfig.Config) []blobstor.SubS
|
|||
blobovniczatree.WithOpenedCacheExpInterval(sub.OpenedCacheExpInterval()),
|
||||
blobovniczatree.WithInitWorkerCount(sub.InitWorkerCount()),
|
||||
blobovniczatree.WithWaitBeforeDropDB(sub.RebuildDropTimeout()),
|
||||
blobovniczatree.WithLogger(logger.NewLoggerWrapper(zap.NewNop())),
|
||||
blobovniczatree.WithBlobovniczaLogger(logger.NewLoggerWrapper(zap.NewNop())),
|
||||
blobovniczatree.WithBlobovniczaTreeLogger(logger.NewLoggerWrapper(zap.NewNop())),
|
||||
blobovniczatree.WithObjectSizeLimit(sh.SmallSizeLimit()),
|
||||
}
|
||||
|
||||
|
|
|
@ -891,7 +891,7 @@ func (c *cfg) engineOpts() []engine.Option {
|
|||
|
||||
opts = append(opts,
|
||||
engine.WithErrorThreshold(c.EngineCfg.errorThreshold),
|
||||
engine.WithLogger(c.log),
|
||||
engine.WithLogger(c.log.WithTag(logger.TagEngine)),
|
||||
engine.WithLowMemoryConsumption(c.EngineCfg.lowMem),
|
||||
)
|
||||
|
||||
|
@ -928,7 +928,7 @@ func (c *cfg) getWriteCacheOpts(shCfg shardCfg) []writecache.Option {
|
|||
writecache.WithMaxCacheSize(wcRead.sizeLimit),
|
||||
writecache.WithMaxCacheCount(wcRead.countLimit),
|
||||
writecache.WithNoSync(wcRead.noSync),
|
||||
writecache.WithLogger(c.log),
|
||||
writecache.WithLogger(c.log.WithTag(logger.TagWriteCache)),
|
||||
writecache.WithQoSLimiter(shCfg.limiter),
|
||||
)
|
||||
}
|
||||
|
@ -968,7 +968,8 @@ func (c *cfg) getSubstorageOpts(ctx context.Context, shCfg shardCfg) []blobstor.
|
|||
blobovniczatree.WithOpenedCacheExpInterval(sRead.openedCacheExpInterval),
|
||||
blobovniczatree.WithInitWorkerCount(sRead.initWorkerCount),
|
||||
blobovniczatree.WithWaitBeforeDropDB(sRead.rebuildDropTimeout),
|
||||
blobovniczatree.WithLogger(c.log),
|
||||
blobovniczatree.WithBlobovniczaLogger(c.log.WithTag(logger.TagBlobovnicza)),
|
||||
blobovniczatree.WithBlobovniczaTreeLogger(c.log.WithTag(logger.TagBlobovniczaTree)),
|
||||
blobovniczatree.WithObjectSizeLimit(shCfg.smallSizeObjectLimit),
|
||||
}
|
||||
|
||||
|
@ -991,7 +992,7 @@ func (c *cfg) getSubstorageOpts(ctx context.Context, shCfg shardCfg) []blobstor.
|
|||
fstree.WithPerm(sRead.perm),
|
||||
fstree.WithDepth(sRead.depth),
|
||||
fstree.WithNoSync(sRead.noSync),
|
||||
fstree.WithLogger(c.log),
|
||||
fstree.WithLogger(c.log.WithTag(logger.TagFSTree)),
|
||||
}
|
||||
if c.metricsCollector != nil {
|
||||
fstreeOpts = append(fstreeOpts,
|
||||
|
@ -1023,7 +1024,7 @@ func (c *cfg) getShardOpts(ctx context.Context, shCfg shardCfg) shardOptsWithID
|
|||
blobstoreOpts := []blobstor.Option{
|
||||
blobstor.WithCompression(shCfg.compression),
|
||||
blobstor.WithStorages(ss),
|
||||
blobstor.WithLogger(c.log),
|
||||
blobstor.WithLogger(c.log.WithTag(logger.TagBlobstor)),
|
||||
}
|
||||
if c.metricsCollector != nil {
|
||||
blobstoreOpts = append(blobstoreOpts, blobstor.WithMetrics(lsmetrics.NewBlobstoreMetrics(c.metricsCollector.Blobstore())))
|
||||
|
@ -1048,7 +1049,7 @@ func (c *cfg) getShardOpts(ctx context.Context, shCfg shardCfg) shardOptsWithID
|
|||
var sh shardOptsWithID
|
||||
sh.configID = shCfg.id()
|
||||
sh.shOpts = []shard.Option{
|
||||
shard.WithLogger(c.log),
|
||||
shard.WithLogger(c.log.WithTag(logger.TagShard)),
|
||||
shard.WithRefillMetabase(shCfg.refillMetabase),
|
||||
shard.WithRefillMetabaseWorkersCount(shCfg.refillMetabaseWorkersCount),
|
||||
shard.WithMode(shCfg.mode),
|
||||
|
|
|
@ -22,6 +22,9 @@ func TestLoggerSection_Level(t *testing.T) {
|
|||
require.Equal(t, "debug", loggerconfig.Level(c))
|
||||
require.Equal(t, "journald", loggerconfig.Destination(c))
|
||||
require.Equal(t, true, loggerconfig.Timestamp(c))
|
||||
tags := loggerconfig.Tags(c)
|
||||
require.Equal(t, "main, morph", tags[0][0])
|
||||
require.Equal(t, "debug", tags[0][1])
|
||||
}
|
||||
|
||||
configtest.ForEachFileType(path, fileConfigTest)
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||
netmapEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/subscriber"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/rand"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
|
@ -84,7 +85,7 @@ func initMorphClient(ctx context.Context, c *cfg) {
|
|||
cli, err := client.New(ctx,
|
||||
c.key,
|
||||
client.WithDialTimeout(morphconfig.DialTimeout(c.appCfg)),
|
||||
client.WithLogger(c.log),
|
||||
client.WithLogger(c.log.WithTag(logger.TagMorph)),
|
||||
client.WithMetrics(c.metricsCollector.MorphClientMetrics()),
|
||||
client.WithEndpoints(addresses...),
|
||||
client.WithConnLostCallback(func() {
|
||||
|
@ -165,6 +166,7 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
|||
err error
|
||||
subs subscriber.Subscriber
|
||||
)
|
||||
log := c.log.WithTag(logger.TagMorph)
|
||||
|
||||
fromSideChainBlock, err := c.persistate.UInt32(persistateSideChainLastBlockKey)
|
||||
if err != nil {
|
||||
|
@ -173,14 +175,14 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
|||
}
|
||||
|
||||
subs, err = subscriber.New(ctx, &subscriber.Params{
|
||||
Log: c.log,
|
||||
Log: log,
|
||||
StartFromBlock: fromSideChainBlock,
|
||||
Client: c.cfgMorph.client,
|
||||
})
|
||||
fatalOnErr(err)
|
||||
|
||||
lis, err := event.NewListener(event.ListenerParams{
|
||||
Logger: c.log,
|
||||
Logger: log,
|
||||
Subscriber: subs,
|
||||
})
|
||||
fatalOnErr(err)
|
||||
|
@ -198,7 +200,7 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
|||
setNetmapNotificationParser(c, newEpochNotification, func(src *state.ContainedNotificationEvent) (event.Event, error) {
|
||||
res, err := netmapEvent.ParseNewEpoch(src)
|
||||
if err == nil {
|
||||
c.log.Info(ctx, logs.FrostFSNodeNewEpochEventFromSidechain,
|
||||
log.Info(ctx, logs.FrostFSNodeNewEpochEventFromSidechain,
|
||||
zap.Uint64("number", res.(netmapEvent.NewEpoch).EpochNumber()),
|
||||
)
|
||||
}
|
||||
|
@ -209,11 +211,11 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
|||
registerNotificationHandlers(c.cfgContainer.scriptHash, lis, c.cfgContainer.parsers, c.cfgContainer.subscribers)
|
||||
|
||||
registerBlockHandler(lis, func(ctx context.Context, block *block.Block) {
|
||||
c.log.Debug(ctx, logs.FrostFSNodeNewBlock, zap.Uint32("index", block.Index))
|
||||
log.Debug(ctx, logs.FrostFSNodeNewBlock, zap.Uint32("index", block.Index))
|
||||
|
||||
err = c.persistate.SetUInt32(persistateSideChainLastBlockKey, block.Index)
|
||||
if err != nil {
|
||||
c.log.Warn(ctx, logs.FrostFSNodeCantUpdatePersistentState,
|
||||
log.Warn(ctx, logs.FrostFSNodeCantUpdatePersistentState,
|
||||
zap.String("chain", "side"),
|
||||
zap.Uint32("block_index", block.Index))
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/policer"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/replicator"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
||||
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc"
|
||||
netmapSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
|
@ -217,9 +218,8 @@ func addPolicer(c *cfg, keyStorage *util.KeyStorage, clientConstructor *cache.Cl
|
|||
}
|
||||
|
||||
remoteReader := objectService.NewRemoteReader(keyStorage, clientConstructor)
|
||||
|
||||
pol := policer.New(
|
||||
policer.WithLogger(c.log),
|
||||
policer.WithLogger(c.log.WithTag(logger.TagPolicer)),
|
||||
policer.WithKeySpaceIterator(&keySpaceIterator{ng: ls}),
|
||||
policer.WithBuryFunc(buryFn),
|
||||
policer.WithContainerSource(c.cfgObject.cnrSource),
|
||||
|
@ -291,7 +291,7 @@ func createReplicator(c *cfg, keyStorage *util.KeyStorage, cache *cache.ClientCa
|
|||
ls := c.cfgObject.cfgLocalStorage.localStorage
|
||||
|
||||
return replicator.New(
|
||||
replicator.WithLogger(c.log),
|
||||
replicator.WithLogger(c.log.WithTag(logger.TagReplicator)),
|
||||
replicator.WithPutTimeout(
|
||||
replicatorconfig.PutTimeout(c.appCfg),
|
||||
),
|
||||
|
@ -348,7 +348,7 @@ func createSearchSvc(c *cfg, keyStorage *util.KeyStorage, traverseGen *util.Trav
|
|||
c.netMapSource,
|
||||
keyStorage,
|
||||
containerSource,
|
||||
searchsvc.WithLogger(c.log),
|
||||
searchsvc.WithLogger(c.log.WithTag(logger.TagSearchSvc)),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ func createGetService(c *cfg, keyStorage *util.KeyStorage, traverseGen *util.Tra
|
|||
),
|
||||
coreConstructor,
|
||||
containerSource,
|
||||
getsvc.WithLogger(c.log))
|
||||
getsvc.WithLogger(c.log.WithTag(logger.TagGetSvc)))
|
||||
}
|
||||
|
||||
func createGetServiceV2(c *cfg, sGet *getsvc.Service, keyStorage *util.KeyStorage) *getsvcV2.Service {
|
||||
|
@ -385,7 +385,7 @@ func createGetServiceV2(c *cfg, sGet *getsvc.Service, keyStorage *util.KeyStorag
|
|||
c.netMapSource,
|
||||
c,
|
||||
c.cfgObject.cnrSource,
|
||||
getsvcV2.WithLogger(c.log),
|
||||
getsvcV2.WithLogger(c.log.WithTag(logger.TagGetSvc)),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ func createDeleteService(c *cfg, keyStorage *util.KeyStorage, sGet *getsvc.Servi
|
|||
cfg: c,
|
||||
},
|
||||
keyStorage,
|
||||
deletesvc.WithLogger(c.log),
|
||||
deletesvc.WithLogger(c.log.WithTag(logger.TagDeleteSvc)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/session/storage"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/session/storage/persistent"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/session/storage/temporary"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
|
||||
sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||
|
@ -55,7 +56,7 @@ func initSessionService(c *cfg) {
|
|||
server := sessionTransportGRPC.New(
|
||||
sessionSvc.NewSignService(
|
||||
&c.key.PrivateKey,
|
||||
sessionSvc.NewExecutionService(c.privateTokenStore, c.respSvc, c.log),
|
||||
sessionSvc.NewExecutionService(c.privateTokenStore, c.respSvc, c.log.WithTag(logger.TagSessionSvc)),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||
containerEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/container"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/grpc"
|
||||
|
@ -56,7 +57,7 @@ func initTreeService(c *cfg) {
|
|||
tree.WithFrostfsidSubjectProvider(c.frostfsidClient),
|
||||
tree.WithNetmapSource(c.netMapSource),
|
||||
tree.WithPrivateKey(&c.key.PrivateKey),
|
||||
tree.WithLogger(c.log),
|
||||
tree.WithLogger(c.log.WithTag(logger.TagTreeSvc)),
|
||||
tree.WithStorage(c.cfgObject.cfgLocalStorage.localStorage),
|
||||
tree.WithContainerCacheSize(treeConfig.CacheSize()),
|
||||
tree.WithReplicationTimeout(treeConfig.ReplicationTimeout()),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
FROSTFS_LOGGER_LEVEL=debug
|
||||
FROSTFS_LOGGER_DESTINATION=journald
|
||||
FROSTFS_LOGGER_TIMESTAMP=true
|
||||
FROSTFS_LOGGER_TAGS_0_NAMES="main, morph"
|
||||
FROSTFS_LOGGER_TAGS_0_LEVEL="debug"
|
||||
|
||||
FROSTFS_PPROF_ENABLED=true
|
||||
FROSTFS_PPROF_ADDRESS=localhost:6060
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
"logger": {
|
||||
"level": "debug",
|
||||
"destination": "journald",
|
||||
"timestamp": true
|
||||
"timestamp": true,
|
||||
"tags": [
|
||||
{
|
||||
"names": "main, morph",
|
||||
"level": "debug"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pprof": {
|
||||
"enabled": true,
|
||||
|
|
|
@ -2,6 +2,9 @@ logger:
|
|||
level: debug # logger level: one of "debug", "info" (default), "warn", "error", "dpanic", "panic", "fatal"
|
||||
destination: journald # logger destination: one of "stdout" (default), "journald"
|
||||
timestamp: true
|
||||
tags:
|
||||
- names: "main, morph"
|
||||
level: debug
|
||||
|
||||
systemdnotify:
|
||||
enabled: true
|
||||
|
|
|
@ -112,11 +112,21 @@ Contains logger parameters.
|
|||
```yaml
|
||||
logger:
|
||||
level: info
|
||||
tags:
|
||||
- names: "main, morph"
|
||||
level: debug
|
||||
```
|
||||
|
||||
| Parameter | Type | Default value | Description |
|
||||
|-----------|----------|---------------|---------------------------------------------------------------------------------------------------|
|
||||
| `level` | `string` | `info` | Logging level.<br/>Possible values: `debug`, `info`, `warn`, `error`, `dpanic`, `panic`, `fatal` |
|
||||
| Parameter | Type | Default value | Description |
|
||||
|-----------|-----------------------------------------------|---------------|---------------------------------------------------------------------------------------------------|
|
||||
| `level` | `string` | `info` | Logging level.<br/>Possible values: `debug`, `info`, `warn`, `error`, `dpanic`, `panic`, `fatal` |
|
||||
| `tags` | list of [tags descriptions](#tags-subsection) | | Array of tags description. |
|
||||
|
||||
## `tags` subsection
|
||||
| Parameter | Type | Default value | Description |
|
||||
|-----------|----------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `names` | `string` | | List of components divided by `,`.<br/>Possible values: `main`, `morph`, `grpcsvc`, `ir`, `processor`, `engine`, `blobovnicza`, `blobstor`, `fstree`, `gc`, `shard`, `writecache`, `deletesvc`, `getsvc`, `searchsvc`, `sessionsvc`, `treesvc`, `policer`, `replicator`. |
|
||||
| `level` | `string` | | Logging level for the components from `names`, overrides default logging level. |
|
||||
|
||||
# `contracts` section
|
||||
Contains override values for FrostFS side-chain contract hashes. Most of the time contract
|
||||
|
|
|
@ -110,7 +110,7 @@ func WithFullSizeLimit(lim uint64) Option {
|
|||
// WithLogger returns an option to specify Blobovnicza's logger.
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l.With(zap.String("component", "Blobovnicza"))
|
||||
c.log = l
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ func TestBlobovniczaTree_Concurrency(t *testing.T) {
|
|||
|
||||
st := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(1024),
|
||||
WithBlobovniczaShallowWidth(10),
|
||||
WithBlobovniczaShallowDepth(1),
|
||||
|
|
|
@ -19,7 +19,8 @@ func TestExistsInvalidStorageID(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(1024),
|
||||
WithBlobovniczaShallowWidth(2),
|
||||
WithBlobovniczaShallowDepth(2),
|
||||
|
|
|
@ -15,7 +15,8 @@ func TestGeneric(t *testing.T) {
|
|||
helper := func(t *testing.T, dir string) common.Storage {
|
||||
return NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(maxObjectSize),
|
||||
WithBlobovniczaShallowWidth(2),
|
||||
WithBlobovniczaShallowDepth(2),
|
||||
|
@ -43,7 +44,8 @@ func TestControl(t *testing.T) {
|
|||
newTree := func(t *testing.T) common.Storage {
|
||||
return NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(maxObjectSize),
|
||||
WithBlobovniczaShallowWidth(2),
|
||||
WithBlobovniczaShallowDepth(2),
|
||||
|
|
|
@ -63,10 +63,15 @@ func initConfig(c *cfg) {
|
|||
}
|
||||
}
|
||||
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
func WithBlobovniczaTreeLogger(log *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l
|
||||
c.blzOpts = append(c.blzOpts, blobovnicza.WithLogger(l))
|
||||
c.log = log
|
||||
}
|
||||
}
|
||||
|
||||
func WithBlobovniczaLogger(log *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.blzOpts = append(c.blzOpts, blobovnicza.WithLogger(log))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,8 @@ func testRebuildFailoverObjectDeletedFromSource(t *testing.T) {
|
|||
func testRebuildFailoverValidate(t *testing.T, dir string, obj *objectSDK.Object, mustUpdateStorageID bool) {
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(2048),
|
||||
WithBlobovniczaShallowWidth(2),
|
||||
WithBlobovniczaShallowDepth(2),
|
||||
|
|
|
@ -50,7 +50,8 @@ func TestBlobovniczaTreeFillPercentRebuild(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(64*1024),
|
||||
WithBlobovniczaShallowWidth(1), // single directory
|
||||
WithBlobovniczaShallowDepth(1),
|
||||
|
@ -106,7 +107,8 @@ func TestBlobovniczaTreeFillPercentRebuild(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(64*1024),
|
||||
WithBlobovniczaShallowWidth(1), // single directory
|
||||
WithBlobovniczaShallowDepth(1),
|
||||
|
@ -160,7 +162,8 @@ func TestBlobovniczaTreeFillPercentRebuild(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(64*1024),
|
||||
WithBlobovniczaShallowWidth(1), // single directory
|
||||
WithBlobovniczaShallowDepth(1),
|
||||
|
@ -231,7 +234,8 @@ func TestBlobovniczaTreeFillPercentRebuild(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(64*1024),
|
||||
WithBlobovniczaShallowWidth(1), // single directory
|
||||
WithBlobovniczaShallowDepth(1),
|
||||
|
@ -262,7 +266,8 @@ func TestBlobovniczaTreeFillPercentRebuild(t *testing.T) {
|
|||
require.NoError(t, b.Close(context.Background()))
|
||||
b = NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(64*1024),
|
||||
WithBlobovniczaShallowWidth(1),
|
||||
WithBlobovniczaShallowDepth(1),
|
||||
|
@ -304,7 +309,8 @@ func TestBlobovniczaTreeRebuildLargeObject(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(64*1024), // 64KB object size limit
|
||||
WithBlobovniczaShallowWidth(5),
|
||||
WithBlobovniczaShallowDepth(2), // depth = 2
|
||||
|
@ -332,7 +338,8 @@ func TestBlobovniczaTreeRebuildLargeObject(t *testing.T) {
|
|||
|
||||
b = NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(32*1024), // 32KB object size limit
|
||||
WithBlobovniczaShallowWidth(5),
|
||||
WithBlobovniczaShallowDepth(3), // depth = 3
|
||||
|
@ -374,7 +381,8 @@ func testBlobovniczaTreeRebuildHelper(t *testing.T, sourceDepth, sourceWidth, ta
|
|||
dir := t.TempDir()
|
||||
b := NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(2048),
|
||||
WithBlobovniczaShallowWidth(sourceWidth),
|
||||
WithBlobovniczaShallowDepth(sourceDepth),
|
||||
|
@ -415,7 +423,8 @@ func testBlobovniczaTreeRebuildHelper(t *testing.T, sourceDepth, sourceWidth, ta
|
|||
|
||||
b = NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
WithLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
WithObjectSizeLimit(2048),
|
||||
WithBlobovniczaShallowWidth(targetWidth),
|
||||
WithBlobovniczaShallowDepth(targetDepth),
|
||||
|
|
|
@ -91,7 +91,7 @@ func WithStorages(st []SubStorage) Option {
|
|||
// WithLogger returns option to specify BlobStor's logger.
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l.With(zap.String("component", "BlobStor"))
|
||||
c.log = l
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"io/fs"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type Option func(*FSTree)
|
||||
|
@ -53,6 +52,6 @@ func WithFileCounter(c FileCounter) Option {
|
|||
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(f *FSTree) {
|
||||
f.log = l.With(zap.String("component", "FSTree"))
|
||||
f.log = l
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,8 @@ func newStorages(t testing.TB, root string, smallSize uint64) []blobstor.SubStor
|
|||
blobovniczatree.WithBlobovniczaShallowDepth(1),
|
||||
blobovniczatree.WithBlobovniczaShallowWidth(1),
|
||||
blobovniczatree.WithPermissions(0o700),
|
||||
blobovniczatree.WithLogger(test.NewLogger(t))),
|
||||
blobovniczatree.WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithBlobovniczaTreeLogger(test.NewLogger(t))),
|
||||
Policy: func(_ *objectSDK.Object, data []byte) bool {
|
||||
return uint64(len(data)) < smallSize
|
||||
},
|
||||
|
|
|
@ -37,7 +37,8 @@ func Test_ObjectNotFoundIfNotDeletedFromMetabase(t *testing.T) {
|
|||
{
|
||||
Storage: blobovniczatree.NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
blobovniczatree.WithLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")),
|
||||
blobovniczatree.WithBlobovniczaShallowDepth(1),
|
||||
blobovniczatree.WithBlobovniczaShallowWidth(1)),
|
||||
|
|
|
@ -28,9 +28,10 @@ func TestShard_Lock(t *testing.T) {
|
|||
var sh *Shard
|
||||
|
||||
rootPath := t.TempDir()
|
||||
l := logger.NewLoggerWrapper(zap.NewNop())
|
||||
opts := []Option{
|
||||
WithID(NewIDFromBytes([]byte{})),
|
||||
WithLogger(logger.NewLoggerWrapper(zap.NewNop())),
|
||||
WithLogger(l),
|
||||
WithBlobStorOptions(
|
||||
blobstor.WithStorages([]blobstor.SubStorage{
|
||||
{
|
||||
|
|
|
@ -79,7 +79,8 @@ func testShardGetRange(t *testing.T, hasWriteCache bool) {
|
|||
{
|
||||
Storage: blobovniczatree.NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
blobovniczatree.WithLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithRootPath(filepath.Join(t.TempDir(), "blob", "blobovnicza")),
|
||||
blobovniczatree.WithBlobovniczaShallowDepth(1),
|
||||
blobovniczatree.WithBlobovniczaShallowWidth(1)),
|
||||
|
|
|
@ -205,7 +205,7 @@ func WithPiloramaOptions(opts ...pilorama.Option) Option {
|
|||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l
|
||||
c.gcCfg.log = l
|
||||
c.gcCfg.log = l.WithTag(logger.TagGC)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ func newCustomShard(t testing.TB, enableWriteCache bool, o shardOptions) *Shard
|
|||
{
|
||||
Storage: blobovniczatree.NewBlobovniczaTree(
|
||||
context.Background(),
|
||||
blobovniczatree.WithLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithBlobovniczaLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithBlobovniczaTreeLogger(test.NewLogger(t)),
|
||||
blobovniczatree.WithRootPath(filepath.Join(o.rootPath, "blob", "blobovnicza")),
|
||||
blobovniczatree.WithBlobovniczaShallowDepth(1),
|
||||
blobovniczatree.WithBlobovniczaShallowWidth(1)),
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Option represents write-cache configuration option.
|
||||
|
@ -46,7 +45,7 @@ type options struct {
|
|||
// WithLogger sets logger.
|
||||
func WithLogger(log *logger.Logger) Option {
|
||||
return func(o *options) {
|
||||
o.log = log.With(zap.String("component", "WriteCache"))
|
||||
o.log = log
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,6 @@ func New(gs *getsvc.Service,
|
|||
// WithLogger returns option to specify Delete service's logger.
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l.With(zap.String("component", "objectSDK.Delete service"))
|
||||
c.log = l
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,6 @@ func New(
|
|||
// WithLogger returns option to specify Get service's logger.
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(s *Service) {
|
||||
s.log = l.With(zap.String("component", "Object.Get service"))
|
||||
s.log = l
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,6 @@ func (s *Service) Head(ctx context.Context, req *objectV2.HeadRequest) (*objectV
|
|||
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l.With(zap.String("component", "Object.Get V2 service"))
|
||||
c.log = l
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,6 @@ func New(e *engine.StorageEngine,
|
|||
// WithLogger returns option to specify Get service's logger.
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l.With(zap.String("component", "Object.Search service"))
|
||||
c.log = l
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/assert"
|
||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||
lru "github.com/hashicorp/golang-lru/v2"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type objectsInWork struct {
|
||||
|
@ -56,8 +55,6 @@ func New(opts ...Option) *Policer {
|
|||
opts[i](c)
|
||||
}
|
||||
|
||||
c.log = c.log.With(zap.String("component", "Object Policer"))
|
||||
|
||||
cache, err := lru.New[oid.Address, time.Time](int(c.cacheSize))
|
||||
assert.NoError(err, fmt.Sprintf("could not create LRU cache with %d size", c.cacheSize))
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
objectwriter "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/common/writer"
|
||||
getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Replicator represents the utility that replicates
|
||||
|
@ -45,8 +44,6 @@ func New(opts ...Option) *Replicator {
|
|||
opts[i](c)
|
||||
}
|
||||
|
||||
c.log = c.log.With(zap.String("component", "Object Replicator"))
|
||||
|
||||
return &Replicator{
|
||||
cfg: c,
|
||||
}
|
||||
|
|
|
@ -33,10 +33,7 @@ func NewExecutionService(exec ServiceExecutor, respSvc *response.Service, l *log
|
|||
}
|
||||
|
||||
func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
||||
s.log.Debug(ctx, logs.ServingRequest,
|
||||
zap.String("component", "SessionService"),
|
||||
zap.String("request", "Create"),
|
||||
)
|
||||
s.log.Debug(ctx, logs.ServingRequest, zap.String("request", "Create"))
|
||||
|
||||
respBody, err := s.exec.Create(ctx, req.GetBody())
|
||||
if err != nil {
|
||||
|
|
|
@ -238,5 +238,6 @@ func NewLoggerWrapper(z *zap.Logger) *Logger {
|
|||
return &Logger{
|
||||
z: z.WithOptions(zap.AddCallerSkip(1)),
|
||||
t: TagMain,
|
||||
c: z.Core(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,26 @@ func _() {
|
|||
_ = x[TagGrpcSvc-3]
|
||||
_ = x[TagIr-4]
|
||||
_ = x[TagProcessor-5]
|
||||
_ = x[TagEngine-6]
|
||||
_ = x[TagBlobovnicza-7]
|
||||
_ = x[TagBlobovniczaTree-8]
|
||||
_ = x[TagBlobstor-9]
|
||||
_ = x[TagFSTree-10]
|
||||
_ = x[TagGC-11]
|
||||
_ = x[TagShard-12]
|
||||
_ = x[TagWriteCache-13]
|
||||
_ = x[TagDeleteSvc-14]
|
||||
_ = x[TagGetSvc-15]
|
||||
_ = x[TagSearchSvc-16]
|
||||
_ = x[TagSessionSvc-17]
|
||||
_ = x[TagTreeSvc-18]
|
||||
_ = x[TagPolicer-19]
|
||||
_ = x[TagReplicator-20]
|
||||
}
|
||||
|
||||
const _Tag_name = "mainmorphgrpc_svcirprocessor"
|
||||
const _Tag_name = "mainmorphgrpcsvcirprocessorengineblobovniczablobovniczatreeblobstorfstreegcshardwritecachedeletesvcgetsvcsearchsvcsessionsvctreesvcpolicerreplicator"
|
||||
|
||||
var _Tag_index = [...]uint8{0, 4, 9, 17, 19, 28}
|
||||
var _Tag_index = [...]uint8{0, 4, 9, 16, 18, 27, 33, 44, 59, 67, 73, 75, 80, 90, 99, 105, 114, 124, 131, 138, 148}
|
||||
|
||||
func (i Tag) String() string {
|
||||
i -= 1
|
||||
|
|
|
@ -13,12 +13,27 @@ import (
|
|||
type Tag uint8
|
||||
|
||||
const (
|
||||
_ Tag = iota //
|
||||
TagMain // main
|
||||
TagMorph // morph
|
||||
TagGrpcSvc // grpc_svc
|
||||
TagIr // ir
|
||||
TagProcessor // processor
|
||||
_ Tag = iota //
|
||||
TagMain // main
|
||||
TagMorph // morph
|
||||
TagGrpcSvc // grpcsvc
|
||||
TagIr // ir
|
||||
TagProcessor // processor
|
||||
TagEngine // engine
|
||||
TagBlobovnicza // blobovnicza
|
||||
TagBlobovniczaTree // blobovniczatree
|
||||
TagBlobstor // blobstor
|
||||
TagFSTree // fstree
|
||||
TagGC // gc
|
||||
TagShard // shard
|
||||
TagWriteCache // writecache
|
||||
TagDeleteSvc // deletesvc
|
||||
TagGetSvc // getsvc
|
||||
TagSearchSvc // searchsvc
|
||||
TagSessionSvc // sessionsvc
|
||||
TagTreeSvc // treesvc
|
||||
TagPolicer // policer
|
||||
TagReplicator // replicator
|
||||
|
||||
defaultLevel = zapcore.InfoLevel
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue