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_LEVEL=info
|
||||||
FROSTFS_IR_LOGGER_TIMESTAMP=true
|
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_PATH=/path/to/wallet.json
|
||||||
FROSTFS_IR_WALLET_ADDRESS=NUHtW3eM6a4mmFCgyyr4rj4wygsTKB88XX
|
FROSTFS_IR_WALLET_ADDRESS=NUHtW3eM6a4mmFCgyyr4rj4wygsTKB88XX
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
logger:
|
logger:
|
||||||
level: info # Logger level: one of "debug", "info" (default), "warn", "error", "dpanic", "panic", "fatal"
|
level: info # Logger level: one of "debug", "info" (default), "warn", "error", "dpanic", "panic", "fatal"
|
||||||
timestamp: true
|
timestamp: true
|
||||||
|
tags:
|
||||||
|
- names: "main, morph" # Possible values: `main`, `morph`, `grpc_svc`, `ir`, `processor`.
|
||||||
|
level: debug
|
||||||
|
|
||||||
wallet:
|
wallet:
|
||||||
path: /path/to/wallet.json # Path to NEP-6 NEO wallet file
|
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
|
var err error
|
||||||
s.netmapProcessor, err = netmap.New(&netmap.Params{
|
s.netmapProcessor, err = netmap.New(&netmap.Params{
|
||||||
Log: s.log,
|
Log: s.log.WithTag(logger.TagProcessor),
|
||||||
Metrics: s.irMetrics,
|
Metrics: s.irMetrics,
|
||||||
PoolSize: poolSize,
|
PoolSize: poolSize,
|
||||||
NetmapClient: netmap.NewNetmapClient(s.netmapClient),
|
NetmapClient: netmap.NewNetmapClient(s.netmapClient),
|
||||||
|
@ -159,7 +159,7 @@ func (s *Server) createAlphaSync(cfg *viper.Viper, frostfsCli *frostfsClient.Cli
|
||||||
} else {
|
} else {
|
||||||
// create governance processor
|
// create governance processor
|
||||||
governanceProcessor, err := governance.New(&governance.Params{
|
governanceProcessor, err := governance.New(&governance.Params{
|
||||||
Log: s.log,
|
Log: s.log.WithTag(logger.TagProcessor),
|
||||||
Metrics: s.irMetrics,
|
Metrics: s.irMetrics,
|
||||||
FrostFSClient: frostfsCli,
|
FrostFSClient: frostfsCli,
|
||||||
AlphabetState: s,
|
AlphabetState: s,
|
||||||
|
@ -225,7 +225,7 @@ func (s *Server) initAlphabetProcessor(ctx context.Context, cfg *viper.Viper) er
|
||||||
// create alphabet processor
|
// create alphabet processor
|
||||||
s.alphabetProcessor, err = alphabet.New(&alphabet.Params{
|
s.alphabetProcessor, err = alphabet.New(&alphabet.Params{
|
||||||
ParsedWallets: parsedWallets,
|
ParsedWallets: parsedWallets,
|
||||||
Log: s.log,
|
Log: s.log.WithTag(logger.TagProcessor),
|
||||||
Metrics: s.irMetrics,
|
Metrics: s.irMetrics,
|
||||||
PoolSize: poolSize,
|
PoolSize: poolSize,
|
||||||
AlphabetContracts: s.contracts.alphabet,
|
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))
|
s.log.Debug(ctx, logs.ContainerContainerWorkerPool, zap.Int("size", poolSize))
|
||||||
// container processor
|
// container processor
|
||||||
containerProcessor, err := cont.New(&cont.Params{
|
containerProcessor, err := cont.New(&cont.Params{
|
||||||
Log: s.log,
|
Log: s.log.WithTag(logger.TagProcessor),
|
||||||
Metrics: s.irMetrics,
|
Metrics: s.irMetrics,
|
||||||
PoolSize: poolSize,
|
PoolSize: poolSize,
|
||||||
AlphabetState: s,
|
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))
|
s.log.Debug(ctx, logs.BalanceBalanceWorkerPool, zap.Int("size", poolSize))
|
||||||
// create balance processor
|
// create balance processor
|
||||||
balanceProcessor, err := balance.New(&balance.Params{
|
balanceProcessor, err := balance.New(&balance.Params{
|
||||||
Log: s.log,
|
Log: s.log.WithTag(logger.TagProcessor),
|
||||||
Metrics: s.irMetrics,
|
Metrics: s.irMetrics,
|
||||||
PoolSize: poolSize,
|
PoolSize: poolSize,
|
||||||
FrostFSClient: frostfsCli,
|
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))
|
s.log.Debug(ctx, logs.FrostFSFrostfsWorkerPool, zap.Int("size", poolSize))
|
||||||
|
|
||||||
frostfsProcessor, err := frostfs.New(&frostfs.Params{
|
frostfsProcessor, err := frostfs.New(&frostfs.Params{
|
||||||
Log: s.log,
|
Log: s.log.WithTag(logger.TagProcessor),
|
||||||
Metrics: s.irMetrics,
|
Metrics: s.irMetrics,
|
||||||
PoolSize: poolSize,
|
PoolSize: poolSize,
|
||||||
FrostFSContract: s.contracts.frostfs,
|
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,
|
controlSvc := controlsrv.NewAuditService(controlsrv.New(p, s.netmapClient, s.containerClient,
|
||||||
controlsrv.WithAllowedKeys(authKeys),
|
controlsrv.WithAllowedKeys(authKeys),
|
||||||
), log, audit)
|
), log.WithTag(logger.TagGrpcSvc), audit)
|
||||||
|
|
||||||
grpcControlSrv := grpc.NewServer()
|
grpcControlSrv := grpc.NewServer()
|
||||||
control.RegisterControlServiceServer(grpcControlSrv, controlSvc)
|
control.RegisterControlServiceServer(grpcControlSrv, controlSvc)
|
||||||
|
@ -458,7 +458,7 @@ func (s *Server) initMorph(ctx context.Context, cfg *viper.Viper, errChan chan<-
|
||||||
}
|
}
|
||||||
|
|
||||||
morphChain := &chainParams{
|
morphChain := &chainParams{
|
||||||
log: s.log,
|
log: s.log.WithTag(logger.TagMorph),
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
key: s.key,
|
key: s.key,
|
||||||
name: morphPrefix,
|
name: morphPrefix,
|
||||||
|
|
|
@ -339,7 +339,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
|
||||||
) (*Server, error) {
|
) (*Server, error) {
|
||||||
var err error
|
var err error
|
||||||
server := &Server{
|
server := &Server{
|
||||||
log: log,
|
log: log.WithTag(logger.TagIr),
|
||||||
irMetrics: metrics,
|
irMetrics: metrics,
|
||||||
cmode: cmode,
|
cmode: cmode,
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,15 @@ func _() {
|
||||||
// Re-run the stringer command to generate them again.
|
// Re-run the stringer command to generate them again.
|
||||||
var x [1]struct{}
|
var x [1]struct{}
|
||||||
_ = x[TagMain-1]
|
_ = 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 {
|
func (i Tag) String() string {
|
||||||
i -= 1
|
i -= 1
|
||||||
|
|
|
@ -13,8 +13,12 @@ import (
|
||||||
type Tag uint8
|
type Tag uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_ Tag = iota //
|
_ Tag = iota //
|
||||||
TagMain // main
|
TagMain // main
|
||||||
|
TagMorph // morph
|
||||||
|
TagGrpcSvc // grpc_svc
|
||||||
|
TagIr // ir
|
||||||
|
TagProcessor // processor
|
||||||
|
|
||||||
defaultLevel = zapcore.InfoLevel
|
defaultLevel = zapcore.InfoLevel
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue