[#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
e297a7d928
commit
b0cf6f51c0
23 changed files with 145 additions and 39 deletions
|
@ -22,6 +22,9 @@ func TestLoggerSection_Level(t *testing.T) {
|
||||||
require.Equal(t, "debug", loggerconfig.Level(c))
|
require.Equal(t, "debug", loggerconfig.Level(c))
|
||||||
require.Equal(t, "journald", loggerconfig.Destination(c))
|
require.Equal(t, "journald", loggerconfig.Destination(c))
|
||||||
require.Equal(t, true, loggerconfig.Timestamp(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)
|
configtest.ForEachFileType(path, fileConfigTest)
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||||
netmapEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/netmap"
|
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/morph/subscriber"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/rand"
|
"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/block"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||||
|
@ -83,7 +84,7 @@ func initMorphClient(ctx context.Context, c *cfg) {
|
||||||
cli, err := client.New(ctx,
|
cli, err := client.New(ctx,
|
||||||
c.key,
|
c.key,
|
||||||
client.WithDialTimeout(morphconfig.DialTimeout(c.appCfg)),
|
client.WithDialTimeout(morphconfig.DialTimeout(c.appCfg)),
|
||||||
client.WithLogger(c.log),
|
client.WithLogger(c.log.WithTag(logger.TagMorph)),
|
||||||
client.WithMetrics(c.metricsCollector.MorphClientMetrics()),
|
client.WithMetrics(c.metricsCollector.MorphClientMetrics()),
|
||||||
client.WithEndpoints(addresses...),
|
client.WithEndpoints(addresses...),
|
||||||
client.WithConnLostCallback(func() {
|
client.WithConnLostCallback(func() {
|
||||||
|
@ -164,6 +165,7 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
||||||
err error
|
err error
|
||||||
subs subscriber.Subscriber
|
subs subscriber.Subscriber
|
||||||
)
|
)
|
||||||
|
log := c.log.WithTag(logger.TagMorph)
|
||||||
|
|
||||||
fromSideChainBlock, err := c.persistate.UInt32(persistateSideChainLastBlockKey)
|
fromSideChainBlock, err := c.persistate.UInt32(persistateSideChainLastBlockKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -172,14 +174,14 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
subs, err = subscriber.New(ctx, &subscriber.Params{
|
subs, err = subscriber.New(ctx, &subscriber.Params{
|
||||||
Log: c.log,
|
Log: log,
|
||||||
StartFromBlock: fromSideChainBlock,
|
StartFromBlock: fromSideChainBlock,
|
||||||
Client: c.cfgMorph.client,
|
Client: c.cfgMorph.client,
|
||||||
})
|
})
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
|
|
||||||
lis, err := event.NewListener(event.ListenerParams{
|
lis, err := event.NewListener(event.ListenerParams{
|
||||||
Logger: c.log,
|
Logger: log,
|
||||||
Subscriber: subs,
|
Subscriber: subs,
|
||||||
})
|
})
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
|
@ -197,7 +199,7 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
||||||
setNetmapNotificationParser(c, newEpochNotification, func(src *state.ContainedNotificationEvent) (event.Event, error) {
|
setNetmapNotificationParser(c, newEpochNotification, func(src *state.ContainedNotificationEvent) (event.Event, error) {
|
||||||
res, err := netmapEvent.ParseNewEpoch(src)
|
res, err := netmapEvent.ParseNewEpoch(src)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
c.log.Info(ctx, logs.FrostFSNodeNewEpochEventFromSidechain,
|
log.Info(ctx, logs.FrostFSNodeNewEpochEventFromSidechain,
|
||||||
zap.Uint64("number", res.(netmapEvent.NewEpoch).EpochNumber()),
|
zap.Uint64("number", res.(netmapEvent.NewEpoch).EpochNumber()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -208,11 +210,11 @@ func listenMorphNotifications(ctx context.Context, c *cfg) {
|
||||||
registerNotificationHandlers(c.cfgContainer.scriptHash, lis, c.cfgContainer.parsers, c.cfgContainer.subscribers)
|
registerNotificationHandlers(c.cfgContainer.scriptHash, lis, c.cfgContainer.parsers, c.cfgContainer.subscribers)
|
||||||
|
|
||||||
registerBlockHandler(lis, func(ctx context.Context, block *block.Block) {
|
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)
|
err = c.persistate.SetUInt32(persistateSideChainLastBlockKey, block.Index)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log.Warn(ctx, logs.FrostFSNodeCantUpdatePersistentState,
|
log.Warn(ctx, logs.FrostFSNodeCantUpdatePersistentState,
|
||||||
zap.String("chain", "side"),
|
zap.String("chain", "side"),
|
||||||
zap.Uint32("block_index", block.Index))
|
zap.Uint32("block_index", block.Index))
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/session/storage/persistent"
|
"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/services/session/storage/temporary"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
|
||||||
sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc"
|
sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
|
@ -55,7 +56,7 @@ func initSessionService(c *cfg) {
|
||||||
server := sessionTransportGRPC.New(
|
server := sessionTransportGRPC.New(
|
||||||
sessionSvc.NewSignService(
|
sessionSvc.NewSignService(
|
||||||
&c.key.PrivateKey,
|
&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"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||||
containerEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/container"
|
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/services/tree"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
@ -56,7 +57,7 @@ func initTreeService(c *cfg) {
|
||||||
tree.WithFrostfsidSubjectProvider(c.shared.frostfsidClient),
|
tree.WithFrostfsidSubjectProvider(c.shared.frostfsidClient),
|
||||||
tree.WithNetmapSource(c.netMapSource),
|
tree.WithNetmapSource(c.netMapSource),
|
||||||
tree.WithPrivateKey(&c.key.PrivateKey),
|
tree.WithPrivateKey(&c.key.PrivateKey),
|
||||||
tree.WithLogger(c.log),
|
tree.WithLogger(c.log.WithTag(logger.TagTreeSvc)),
|
||||||
tree.WithStorage(c.cfgObject.cfgLocalStorage.localStorage),
|
tree.WithStorage(c.cfgObject.cfgLocalStorage.localStorage),
|
||||||
tree.WithContainerCacheSize(treeConfig.CacheSize()),
|
tree.WithContainerCacheSize(treeConfig.CacheSize()),
|
||||||
tree.WithReplicationTimeout(treeConfig.ReplicationTimeout()),
|
tree.WithReplicationTimeout(treeConfig.ReplicationTimeout()),
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
FROSTFS_LOGGER_LEVEL=debug
|
FROSTFS_LOGGER_LEVEL=debug
|
||||||
FROSTFS_LOGGER_DESTINATION=journald
|
FROSTFS_LOGGER_DESTINATION=journald
|
||||||
FROSTFS_LOGGER_TIMESTAMP=true
|
FROSTFS_LOGGER_TIMESTAMP=true
|
||||||
|
FROSTFS_LOGGER_TAGS_0_NAMES="main, morph"
|
||||||
|
FROSTFS_LOGGER_TAGS_0_LEVEL="debug"
|
||||||
|
|
||||||
FROSTFS_PPROF_ENABLED=true
|
FROSTFS_PPROF_ENABLED=true
|
||||||
FROSTFS_PPROF_ADDRESS=localhost:6060
|
FROSTFS_PPROF_ADDRESS=localhost:6060
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
"logger": {
|
"logger": {
|
||||||
"level": "debug",
|
"level": "debug",
|
||||||
"destination": "journald",
|
"destination": "journald",
|
||||||
"timestamp": true
|
"timestamp": true,
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"names": "main, morph",
|
||||||
|
"level": "debug"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"pprof": {
|
"pprof": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|
|
@ -2,6 +2,9 @@ logger:
|
||||||
level: debug # logger level: one of "debug", "info" (default), "warn", "error", "dpanic", "panic", "fatal"
|
level: debug # logger level: one of "debug", "info" (default), "warn", "error", "dpanic", "panic", "fatal"
|
||||||
destination: journald # logger destination: one of "stdout" (default), "journald"
|
destination: journald # logger destination: one of "stdout" (default), "journald"
|
||||||
timestamp: true
|
timestamp: true
|
||||||
|
tags:
|
||||||
|
- names: "main, morph"
|
||||||
|
level: debug
|
||||||
|
|
||||||
systemdnotify:
|
systemdnotify:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
|
@ -111,11 +111,21 @@ Contains logger parameters.
|
||||||
```yaml
|
```yaml
|
||||||
logger:
|
logger:
|
||||||
level: info
|
level: info
|
||||||
|
tags:
|
||||||
|
- names: "main, morph"
|
||||||
|
level: debug
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default value | Description |
|
| Parameter | Type | Default value | Description |
|
||||||
|-----------|----------|---------------|---------------------------------------------------------------------------------------------------|
|
|-----------|-----------------------------------------------|---------------|---------------------------------------------------------------------------------------------------|
|
||||||
| `level` | `string` | `info` | Logging level.<br/>Possible values: `debug`, `info`, `warn`, `error`, `dpanic`, `panic`, `fatal` |
|
| `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`, `grpc_svc`, `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
|
# `contracts` section
|
||||||
Contains override values for FrostFS side-chain contract hashes. Most of the time contract
|
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.
|
// WithLogger returns an option to specify Blobovnicza's logger.
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.log = l.With(zap.String("component", "Blobovnicza"))
|
c.log = l.WithTag(logger.TagBlobovnicza)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ func WithStorages(st []SubStorage) Option {
|
||||||
// WithLogger returns option to specify BlobStor's logger.
|
// WithLogger returns option to specify BlobStor's logger.
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.log = l.With(zap.String("component", "BlobStor"))
|
c.log = l.WithTag(logger.TagBlobstor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||||
"go.uber.org/zap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Option func(*FSTree)
|
type Option func(*FSTree)
|
||||||
|
@ -53,6 +52,6 @@ func WithFileCounter(c FileCounter) Option {
|
||||||
|
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(f *FSTree) {
|
return func(f *FSTree) {
|
||||||
f.log = l.With(zap.String("component", "FSTree"))
|
f.log = l.WithTag(logger.TagFSTree)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ func New(opts ...Option) *StorageEngine {
|
||||||
// WithLogger returns option to set StorageEngine's logger.
|
// WithLogger returns option to set StorageEngine's logger.
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.log = l
|
c.log = l.WithTag(logger.TagEngine)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -495,7 +495,7 @@ func (s *Shard) collectExpiredTombstones(ctx context.Context, e Event) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
epoch := e.(newEpoch).epoch
|
epoch := e.(newEpoch).epoch
|
||||||
log := s.log.With(zap.Uint64("epoch", epoch))
|
log := s.log.With(zap.Uint64("epoch", epoch)).WithTag(logger.TagGC)
|
||||||
|
|
||||||
log.Debug(ctx, logs.ShardStartedExpiredTombstonesHandling)
|
log.Debug(ctx, logs.ShardStartedExpiredTombstonesHandling)
|
||||||
defer log.Debug(ctx, logs.ShardFinishedExpiredTombstonesHandling)
|
defer log.Debug(ctx, logs.ShardFinishedExpiredTombstonesHandling)
|
||||||
|
|
|
@ -204,8 +204,8 @@ func WithPiloramaOptions(opts ...pilorama.Option) Option {
|
||||||
// WithLogger returns option to set Shard's logger.
|
// WithLogger returns option to set Shard's logger.
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.log = l
|
c.log = l.WithTag(logger.TagShard)
|
||||||
c.gcCfg.log = l
|
c.gcCfg.log = l.WithTag(logger.TagGC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||||
"go.uber.org/zap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Option represents write-cache configuration option.
|
// Option represents write-cache configuration option.
|
||||||
|
@ -46,7 +45,7 @@ type options struct {
|
||||||
// WithLogger sets logger.
|
// WithLogger sets logger.
|
||||||
func WithLogger(log *logger.Logger) Option {
|
func WithLogger(log *logger.Logger) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
o.log = log.With(zap.String("component", "WriteCache"))
|
o.log = log.WithTag(logger.TagWriteCache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,6 @@ func New(gs *getsvc.Service,
|
||||||
// WithLogger returns option to specify Delete service's logger.
|
// WithLogger returns option to specify Delete service's logger.
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.log = l.With(zap.String("component", "objectSDK.Delete service"))
|
c.log = l.WithTag(logger.TagDeleteSvc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,6 @@ func New(
|
||||||
// WithLogger returns option to specify Get service's logger.
|
// WithLogger returns option to specify Get service's logger.
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(s *Service) {
|
return func(s *Service) {
|
||||||
s.log = l.With(zap.String("component", "Object.Get service"))
|
s.log = l.WithTag(logger.TagGetSvc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,6 @@ func (s *Service) Head(ctx context.Context, req *objectV2.HeadRequest) (*objectV
|
||||||
|
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.log = l.With(zap.String("component", "Object.Get V2 service"))
|
c.log = l.WithTag(logger.TagGetSvc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,6 @@ func New(e *engine.StorageEngine,
|
||||||
// WithLogger returns option to specify Get service's logger.
|
// WithLogger returns option to specify Get service's logger.
|
||||||
func WithLogger(l *logger.Logger) Option {
|
func WithLogger(l *logger.Logger) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.log = l.With(zap.String("component", "Object.Search service"))
|
c.log = l.WithTag(logger.TagSearchSvc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
lru "github.com/hashicorp/golang-lru/v2"
|
lru "github.com/hashicorp/golang-lru/v2"
|
||||||
"go.uber.org/zap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type objectsInWork struct {
|
type objectsInWork struct {
|
||||||
|
@ -54,7 +54,7 @@ func New(opts ...Option) *Policer {
|
||||||
opts[i](c)
|
opts[i](c)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.log = c.log.With(zap.String("component", "Object Policer"))
|
c.log = c.log.WithTag(logger.TagPolicer)
|
||||||
|
|
||||||
cache, err := lru.New[oid.Address, time.Time](int(c.cacheSize))
|
cache, err := lru.New[oid.Address, time.Time](int(c.cacheSize))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
objectwriter "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/common/writer"
|
objectwriter "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/common/writer"
|
||||||
getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get"
|
getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||||
"go.uber.org/zap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Replicator represents the utility that replicates
|
// Replicator represents the utility that replicates
|
||||||
|
@ -45,7 +44,7 @@ func New(opts ...Option) *Replicator {
|
||||||
opts[i](c)
|
opts[i](c)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.log = c.log.With(zap.String("component", "Object Replicator"))
|
c.log = c.log.WithTag(logger.TagReplicator)
|
||||||
|
|
||||||
return &Replicator{
|
return &Replicator{
|
||||||
cfg: c,
|
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) {
|
func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
||||||
s.log.Debug(ctx, logs.ServingRequest,
|
s.log.Debug(ctx, logs.ServingRequest, zap.String("request", "Create"))
|
||||||
zap.String("component", "SessionService"),
|
|
||||||
zap.String("request", "Create"),
|
|
||||||
)
|
|
||||||
|
|
||||||
respBody, err := s.exec.Create(ctx, req.GetBody())
|
respBody, err := s.exec.Create(ctx, req.GetBody())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -16,12 +16,40 @@ const (
|
||||||
TagGrpcSvc
|
TagGrpcSvc
|
||||||
TagIr
|
TagIr
|
||||||
TagProcessor
|
TagProcessor
|
||||||
|
TagEngine
|
||||||
|
TagBlobovnicza
|
||||||
|
TagBlobstor
|
||||||
|
TagFSTree
|
||||||
|
TagGC
|
||||||
|
TagShard
|
||||||
|
TagWriteCache
|
||||||
|
TagDeleteSvc
|
||||||
|
TagGetSvc
|
||||||
|
TagSearchSvc
|
||||||
|
TagSessionSvc
|
||||||
|
TagTreeSvc
|
||||||
|
TagPolicer
|
||||||
|
TagReplicator
|
||||||
|
|
||||||
tagMain = "main"
|
tagMain = "main"
|
||||||
tagMorph = "morph"
|
tagMorph = "morph"
|
||||||
tagGrpcSvc = "grpc_svc"
|
tagGrpcSvc = "grpc_svc"
|
||||||
tagIr = "ir"
|
tagIr = "ir"
|
||||||
tagProcessor = "processor"
|
tagProcessor = "processor"
|
||||||
|
tagEngine = "engine"
|
||||||
|
tagBlobovnicza = "blobovnicza"
|
||||||
|
tagBlobstor = "blobstor"
|
||||||
|
tagFSTree = "fstree"
|
||||||
|
tagGC = "gc"
|
||||||
|
tagShard = "shard"
|
||||||
|
tagWriteCache = "writecache"
|
||||||
|
tagDeleteSvc = "deletesvc"
|
||||||
|
tagGetSvc = "getsvc"
|
||||||
|
tagSearchSvc = "searchsvc"
|
||||||
|
tagSessionSvc = "sessionsvc"
|
||||||
|
tagTreeSvc = "treesvc"
|
||||||
|
tagPolicer = "policer"
|
||||||
|
tagReplicator = "replicator"
|
||||||
)
|
)
|
||||||
|
|
||||||
// tagToMask return bit mask for the tag, encoded in uint32.
|
// tagToMask return bit mask for the tag, encoded in uint32.
|
||||||
|
@ -37,6 +65,34 @@ func tagFromString(str string) (Tag, error) {
|
||||||
return TagIr, nil
|
return TagIr, nil
|
||||||
case tagProcessor:
|
case tagProcessor:
|
||||||
return TagProcessor, nil
|
return TagProcessor, nil
|
||||||
|
case tagEngine:
|
||||||
|
return TagEngine, nil
|
||||||
|
case tagBlobovnicza:
|
||||||
|
return TagBlobovnicza, nil
|
||||||
|
case tagBlobstor:
|
||||||
|
return TagBlobstor, nil
|
||||||
|
case tagFSTree:
|
||||||
|
return TagFSTree, nil
|
||||||
|
case tagGC:
|
||||||
|
return TagGC, nil
|
||||||
|
case tagShard:
|
||||||
|
return TagShard, nil
|
||||||
|
case tagWriteCache:
|
||||||
|
return TagWriteCache, nil
|
||||||
|
case tagDeleteSvc:
|
||||||
|
return TagDeleteSvc, nil
|
||||||
|
case tagGetSvc:
|
||||||
|
return TagGetSvc, nil
|
||||||
|
case tagSearchSvc:
|
||||||
|
return TagSearchSvc, nil
|
||||||
|
case tagSessionSvc:
|
||||||
|
return TagSessionSvc, nil
|
||||||
|
case tagTreeSvc:
|
||||||
|
return TagTreeSvc, nil
|
||||||
|
case tagPolicer:
|
||||||
|
return TagPolicer, nil
|
||||||
|
case tagReplicator:
|
||||||
|
return TagReplicator, nil
|
||||||
default:
|
default:
|
||||||
return math.MaxUint8, fmt.Errorf("unsupported tag %s", str)
|
return math.MaxUint8, fmt.Errorf("unsupported tag %s", str)
|
||||||
}
|
}
|
||||||
|
@ -55,6 +111,34 @@ func tagToString(tag Tag) string {
|
||||||
return tagIr
|
return tagIr
|
||||||
case TagProcessor:
|
case TagProcessor:
|
||||||
return tagProcessor
|
return tagProcessor
|
||||||
|
case TagEngine:
|
||||||
|
return tagEngine
|
||||||
|
case TagBlobovnicza:
|
||||||
|
return tagBlobovnicza
|
||||||
|
case TagBlobstor:
|
||||||
|
return tagBlobstor
|
||||||
|
case TagFSTree:
|
||||||
|
return tagFSTree
|
||||||
|
case TagGC:
|
||||||
|
return tagGC
|
||||||
|
case TagShard:
|
||||||
|
return tagShard
|
||||||
|
case TagWriteCache:
|
||||||
|
return tagWriteCache
|
||||||
|
case TagDeleteSvc:
|
||||||
|
return tagDeleteSvc
|
||||||
|
case TagGetSvc:
|
||||||
|
return tagGetSvc
|
||||||
|
case TagSearchSvc:
|
||||||
|
return tagSearchSvc
|
||||||
|
case TagSessionSvc:
|
||||||
|
return tagSessionSvc
|
||||||
|
case TagTreeSvc:
|
||||||
|
return tagTreeSvc
|
||||||
|
case TagPolicer:
|
||||||
|
return tagPolicer
|
||||||
|
case TagReplicator:
|
||||||
|
return tagReplicator
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue