Skip to content

Commit

Permalink
Add a lateStart indicator, differentiate on Error/Warn/Info
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed May 22, 2021
1 parent 888c63b commit a64800a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"

"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/gen/slashfilter"

Expand Down Expand Up @@ -438,21 +439,31 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
}
}

log.Infow(
"completed mineOne",
"tookMilliseconds", (build.Clock.Now().UnixNano()-start.UnixNano())/1_000_000,
isLate := uint64(start.Unix()) > (base.TipSet.MinTimestamp() + uint64(base.NullRounds*builtin.EpochDurationSeconds) + build.PropagationDelaySecs)

logStruct := []interface{}{
"tookMilliseconds", (build.Clock.Now().UnixNano() - start.UnixNano()) / 1_000_000,
"forRound", int64(round),
"baseEpoch", int64(base.TipSet.Height()),
"baseDeltaSeconds", uint64(start.Unix())-base.TipSet.MinTimestamp(),
"baseDeltaSeconds", uint64(start.Unix()) - base.TipSet.MinTimestamp(),
"nullRounds", int64(base.NullRounds),
"lateStart", isLate,
"beaconEpoch", uint64(rbase.Round),
"lookbackEpochs", int64(policy.ChainFinality), // hardcoded as it is unlikely to change again: https://github.com/filecoin-project/lotus/blob/v1.8.0/chain/actors/policy/policy.go#L180-L186
"networkPowerAtLookback", mbi.NetworkPower.String(),
"minerPowerAtLookback", mbi.MinerPower.String(),
"isEligible", mbi.EligibleForMining,
"isWinner", (winner != nil),
"error", err,
)
}

if err != nil {
log.Errorw("completed mineOne", logStruct)
} else if isLate {
log.Warnw("completed mineOne", logStruct)
} else {
log.Infow("completed mineOne", logStruct)
}
}()

mbi, err = m.api.MinerGetBaseInfo(ctx, m.address, round, base.TipSet.Key())
Expand Down

0 comments on commit a64800a

Please sign in to comment.