-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add child logger & remove method names from log messages #412
Conversation
15f3ee3
to
f54001a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore the nits. When I see tip
I think gas tip
(ie priority fee), but maybe thats just me ¯_(ツ)_/¯
common/geth/client.go
Outdated
break | ||
} else { | ||
return receipt, nil | ||
} | ||
} else { | ||
c.Logger.Debug("EnsureTransactionEvaled: failed to get chain tip while waiting for transaction to mine", "err", err) | ||
c.Logger.Debug("failed to get chain tip while waiting for transaction to mine", "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: failed to query block height
disperser/batcher/txn_manager.go
Outdated
@@ -261,7 +261,7 @@ func (t *txnManager) monitorTransaction(ctx context.Context, req *TxnRequest) (* | |||
} | |||
txID, err := t.wallet.SendTransaction(ctx, newTx) | |||
if err != nil { | |||
t.logger.Error("failed to send txn", "component", "TxnManager", "method", "monitorTransaction", "tag", req.Tag, "txn", req.Tx.Hash().Hex(), "attempt", retryFromFailure, "maxRetry", maxSpeedUpRetry, "err", err) | |||
t.logger.Warn("failed to send txn", "component", "TxnManager", "method", "monitorTransaction", "tag", req.Tag, "txn", req.Tx.Hash().Hex(), "attempt", retryFromFailure, "maxRetry", maxSpeedUpRetry, "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe log Warn("failed to send txn - retrying"
when retrying and Error("failed to send txn - retries exhaused"
when we give up.
common/geth/client.go
Outdated
@@ -265,13 +266,13 @@ func (c *EthClient) waitMined(ctx context.Context, txs []*types.Transaction) (*t | |||
chainTip, err := c.BlockNumber(ctx) | |||
if err == nil { | |||
if receipt.BlockNumber.Uint64()+uint64(c.numConfirmations) > chainTip { | |||
c.Logger.Debug("EnsureTransactionEvaled: transaction has been mined but don't have enough confirmations at current chain tip", "txnBlockNumber", receipt.BlockNumber.Uint64(), "numConfirmations", c.numConfirmations, "chainTip", chainTip) | |||
c.Logger.Debug("transaction has been mined but don't have enough confirmations at current chain tip", "txnBlockNumber", receipt.BlockNumber.Uint64(), "numConfirmations", c.numConfirmations, "chainTip", chainTip) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: don't -> doesn't
and tip -> head
retriever/metrics.go
Outdated
@@ -44,7 +44,7 @@ func NewMetrics(httpPort string, logger logging.Logger) *Metrics { | |||
}, | |||
), | |||
httpPort: httpPort, | |||
logger: logger, | |||
logger: logger.With("component", "retriever.Metrics"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Should we standarize on camel case? So this should be "RetrieverMetrics"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I standardized it to the struct name and prefixed by the <package_name>.
when the struct name is vague.
I guess it's cleaner to just camel case it
operators/churner/server.go
Outdated
@@ -39,7 +39,7 @@ func NewServer( | |||
churner: churner, | |||
latestExpiry: int64(0), | |||
lastRequestTimeByOperatorID: make(map[core.OperatorID]time.Time), | |||
logger: logger, | |||
logger: logger.With("component", "churner.Server"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment for everything that has a "." in the name
@@ -41,10 +41,11 @@ var _ common.EthClient = (*EthClient)(nil) | |||
// NewClient creates a new Ethereum client. | |||
// If PrivateKeyString in the config is empty, the client will not be able to send transactions, and it will use the senderAddress to create transactions. | |||
// If PrivateKeyString in the config is not empty, the client will be able to send transactions, and the senderAddress is ignored. | |||
func NewClient(config EthClientConfig, senderAddress gethcommon.Address, rpcIndex int, logger logging.Logger) (*EthClient, error) { | |||
func NewClient(config EthClientConfig, senderAddress gethcommon.Address, rpcIndex int, _logger logging.Logger) (*EthClient, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why adding a new naming convention with underscore prefix? May keep is simple and consistent with others
f54001a
to
cfe54c8
Compare
Why are these changes needed?
Refactoring loggers across codebase.
component
attribute for better filteringsource
attributeChecks