Merge pull request #3330 from filecoin-project/feat/slightly-better-log-info

print block 'age' when validating blocks during sync
This commit is contained in:
Łukasz Magiera 2020-08-27 11:13:49 +02:00 committed by GitHub
commit efd2129187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -655,7 +655,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) (er
validationStart := build.Clock.Now() validationStart := build.Clock.Now()
defer func() { defer func() {
stats.Record(ctx, metrics.BlockValidationDurationMilliseconds.M(metrics.SinceInMilliseconds(validationStart))) stats.Record(ctx, metrics.BlockValidationDurationMilliseconds.M(metrics.SinceInMilliseconds(validationStart)))
log.Infow("block validation", "took", time.Since(validationStart), "height", b.Header.Height) log.Infow("block validation", "took", time.Since(validationStart), "height", b.Header.Height, "age", time.Since(time.Unix(int64(b.Header.Timestamp), 0)))
}() }()
ctx, span := trace.StartSpan(ctx, "validateBlock") ctx, span := trace.StartSpan(ctx, "validateBlock")