forked from TrueCloudLab/frostfs-node
[#1619] logger: Set tags for ir
components
Change-Id: Ifab575bc2a3cd83c9001cd68fffaf94c91494043 Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
dfe2f9956a
commit
12fc7850dd
6 changed files with 26 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
|||
FROSTFS_IR_LOGGER_LEVEL=info
|
||||
FROSTFS_IR_LOGGER_TIMESTAMP=true
|
||||
FROSTFS_IR_LOGGER_TAGS_0_NAMES="main, morph"
|
||||
FROSTFS_IR_LOGGER_TAGS_0_LEVEL="debug"
|
||||
|
||||
FROSTFS_IR_WALLET_PATH=/path/to/wallet.json
|
||||
FROSTFS_IR_WALLET_ADDRESS=NUHtW3eM6a4mmFCgyyr4rj4wygsTKB88XX
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
logger:
|
||||
level: info # Logger level: one of "debug", "info" (default), "warn", "error", "dpanic", "panic", "fatal"
|
||||
timestamp: true
|
||||
tags:
|
||||
- names: "main, morph" # Possible values: `main`, `morph`, `grpc_svc`, `ir`, `processor`.
|
||||
level: debug
|
||||
|
||||
wallet:
|
||||
path: /path/to/wallet.json # Path to NEP-6 NEO wallet file
|
||||
|
|
|
@ -50,7 +50,7 @@ func (s *Server) initNetmapProcessor(ctx context.Context, cfg *viper.Viper,
|
|||
|
||||
var err error
|
||||
s.netmapProcessor, err = netmap.New(&netmap.Params{
|
||||
Log: s.log,
|
||||
Log: s.log.WithTag(logger.TagProcessor),
|
||||
Metrics: s.irMetrics,
|
||||
PoolSize: poolSize,
|
||||
NetmapClient: netmap.NewNetmapClient(s.netmapClient),
|
||||
|
@ -159,7 +159,7 @@ func (s *Server) createAlphaSync(cfg *viper.Viper, frostfsCli *frostfsClient.Cli
|
|||
} else {
|
||||
// create governance processor
|
||||
governanceProcessor, err := governance.New(&governance.Params{
|
||||
Log: s.log,
|
||||
Log: s.log.WithTag(logger.TagProcessor),
|
||||
Metrics: s.irMetrics,
|
||||
FrostFSClient: frostfsCli,
|
||||
AlphabetState: s,
|
||||
|
@ -225,7 +225,7 @@ func (s *Server) initAlphabetProcessor(ctx context.Context, cfg *viper.Viper) er
|
|||
// create alphabet processor
|
||||
s.alphabetProcessor, err = alphabet.New(&alphabet.Params{
|
||||
ParsedWallets: parsedWallets,
|
||||
Log: s.log,
|
||||
Log: s.log.WithTag(logger.TagProcessor),
|
||||
Metrics: s.irMetrics,
|
||||
PoolSize: poolSize,
|
||||
AlphabetContracts: s.contracts.alphabet,
|
||||
|
@ -247,7 +247,7 @@ func (s *Server) initContainerProcessor(ctx context.Context, cfg *viper.Viper, c
|
|||
s.log.Debug(ctx, logs.ContainerContainerWorkerPool, zap.Int("size", poolSize))
|
||||
// container processor
|
||||
containerProcessor, err := cont.New(&cont.Params{
|
||||
Log: s.log,
|
||||
Log: s.log.WithTag(logger.TagProcessor),
|
||||
Metrics: s.irMetrics,
|
||||
PoolSize: poolSize,
|
||||
AlphabetState: s,
|
||||
|
@ -268,7 +268,7 @@ func (s *Server) initBalanceProcessor(ctx context.Context, cfg *viper.Viper, fro
|
|||
s.log.Debug(ctx, logs.BalanceBalanceWorkerPool, zap.Int("size", poolSize))
|
||||
// create balance processor
|
||||
balanceProcessor, err := balance.New(&balance.Params{
|
||||
Log: s.log,
|
||||
Log: s.log.WithTag(logger.TagProcessor),
|
||||
Metrics: s.irMetrics,
|
||||
PoolSize: poolSize,
|
||||
FrostFSClient: frostfsCli,
|
||||
|
@ -291,7 +291,7 @@ func (s *Server) initFrostFSMainnetProcessor(ctx context.Context, cfg *viper.Vip
|
|||
s.log.Debug(ctx, logs.FrostFSFrostfsWorkerPool, zap.Int("size", poolSize))
|
||||
|
||||
frostfsProcessor, err := frostfs.New(&frostfs.Params{
|
||||
Log: s.log,
|
||||
Log: s.log.WithTag(logger.TagProcessor),
|
||||
Metrics: s.irMetrics,
|
||||
PoolSize: poolSize,
|
||||
FrostFSContract: s.contracts.frostfs,
|
||||
|
@ -342,7 +342,7 @@ func (s *Server) initGRPCServer(ctx context.Context, cfg *viper.Viper, log *logg
|
|||
|
||||
controlSvc := controlsrv.NewAuditService(controlsrv.New(p, s.netmapClient, s.containerClient,
|
||||
controlsrv.WithAllowedKeys(authKeys),
|
||||
), log, audit)
|
||||
), log.WithTag(logger.TagGrpcSvc), audit)
|
||||
|
||||
grpcControlSrv := grpc.NewServer()
|
||||
control.RegisterControlServiceServer(grpcControlSrv, controlSvc)
|
||||
|
@ -458,7 +458,7 @@ func (s *Server) initMorph(ctx context.Context, cfg *viper.Viper, errChan chan<-
|
|||
}
|
||||
|
||||
morphChain := &chainParams{
|
||||
log: s.log,
|
||||
log: s.log.WithTag(logger.TagMorph),
|
||||
cfg: cfg,
|
||||
key: s.key,
|
||||
name: morphPrefix,
|
||||
|
|
|
@ -339,7 +339,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
|
|||
) (*Server, error) {
|
||||
var err error
|
||||
server := &Server{
|
||||
log: log,
|
||||
log: log.WithTag(logger.TagIr),
|
||||
irMetrics: metrics,
|
||||
cmode: cmode,
|
||||
}
|
||||
|
|
|
@ -9,11 +9,15 @@ func _() {
|
|||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[TagMain-1]
|
||||
_ = x[TagMorph-2]
|
||||
_ = x[TagGrpcSvc-3]
|
||||
_ = x[TagIr-4]
|
||||
_ = x[TagProcessor-5]
|
||||
}
|
||||
|
||||
const _Tag_name = "main"
|
||||
const _Tag_name = "mainmorphgrpc_svcirprocessor"
|
||||
|
||||
var _Tag_index = [...]uint8{0, 4}
|
||||
var _Tag_index = [...]uint8{0, 4, 9, 17, 19, 28}
|
||||
|
||||
func (i Tag) String() string {
|
||||
i -= 1
|
||||
|
|
|
@ -13,8 +13,12 @@ import (
|
|||
type Tag uint8
|
||||
|
||||
const (
|
||||
_ Tag = iota //
|
||||
TagMain // main
|
||||
_ Tag = iota //
|
||||
TagMain // main
|
||||
TagMorph // morph
|
||||
TagGrpcSvc // grpc_svc
|
||||
TagIr // ir
|
||||
TagProcessor // processor
|
||||
|
||||
defaultLevel = zapcore.InfoLevel
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue