Commit bfeecbdb authored by zhiqiangxu's avatar zhiqiangxu Committed by GitHub

show tx count in log for span batch (#10743)

parent aac0480c
......@@ -451,6 +451,14 @@ func (b *SpanBatch) GetTimestamp() uint64 {
return b.Batches[0].Timestamp
}
// TxCount returns the tx count for the batch
func (b *SpanBatch) TxCount() (count uint64) {
for _, txCount := range b.blockTxCounts {
count += txCount
}
return
}
// LogContext creates a new log context that contains information of the batch
func (b *SpanBatch) LogContext(log log.Logger) log.Logger {
if len(b.Batches) == 0 {
......@@ -464,6 +472,7 @@ func (b *SpanBatch) LogContext(log log.Logger) log.Logger {
"start_epoch_number", b.GetStartEpochNum(),
"end_epoch_number", b.GetBlockEpochNum(len(b.Batches)-1),
"block_count", len(b.Batches),
"txs", b.TxCount(),
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment