Skip to content

Commit

Permalink
Add latency log for occ scheduler (#483)
Browse files Browse the repository at this point in the history
## Describe your changes and provide context
This PR add latency and retries to occ scheduler log
## Testing performed to validate your change
  • Loading branch information
yzang2019 authored Apr 16, 2024
1 parent c37e8f7 commit 4e37eb4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tasks/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"sort"
"sync"
"time"

"github.com/cosmos/cosmos-sdk/store/multiversion"
store "github.com/cosmos/cosmos-sdk/store/types"
Expand Down Expand Up @@ -260,6 +261,7 @@ func (s *scheduler) emitMetrics() {
}

func (s *scheduler) ProcessAll(ctx sdk.Context, reqs []*sdk.DeliverTxEntry) ([]types.ResponseDeliverTx, error) {
startTime := time.Now()
var iterations int
// initialize mutli-version stores if they haven't been initialized yet
s.tryInitMultiVersionStore(ctx)
Expand Down Expand Up @@ -321,7 +323,7 @@ func (s *scheduler) ProcessAll(ctx sdk.Context, reqs []*sdk.DeliverTxEntry) ([]t
}
s.metrics.maxIncarnation = s.maxIncarnation

ctx.Logger().Info("occ scheduler", "height", ctx.BlockHeight(), "txs", len(tasks), "maxIncarnation", s.maxIncarnation, "iterations", iterations, "sync", s.synchronous, "workers", s.workers)
ctx.Logger().Info("occ scheduler", "height", ctx.BlockHeight(), "txs", len(tasks), "latency_ms", time.Since(startTime).Milliseconds(), "retries", s.metrics.retries, "maxIncarnation", s.maxIncarnation, "iterations", iterations, "sync", s.synchronous, "workers", s.workers)

return s.collectResponses(tasks), nil
}
Expand Down

0 comments on commit 4e37eb4

Please sign in to comment.