Skip to content
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

Log the batch validation latency breakdown #619

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,12 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs
}

func (n *Node) ValidateBatch(ctx context.Context, header *core.BatchHeader, blobs []*core.BlobMessage) error {
start := time.Now()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be ok to take "operatorState, err := n.ChainState.GetOperatorStateByOperator(ctx, header.ReferenceBlockNumber, n.Config.ID)" out of the function.

then in the caller context, use grafana to emit the metrics

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's too much to have a metric to just track a RPC call, I think logging is appropriate.

operatorState, err := n.ChainState.GetOperatorStateByOperator(ctx, header.ReferenceBlockNumber, n.Config.ID)
if err != nil {
return err
}
getStateDuration := time.Since(start)

pool := workerpool.New(n.Config.NumBatchValidators)
err = n.Validator.ValidateBatch(header, blobs, operatorState, pool)
Expand All @@ -408,6 +410,7 @@ func (n *Node) ValidateBatch(ctx context.Context, header *core.BatchHeader, blob
}
return fmt.Errorf("failed to validate batch with operator state %x: %w", strings.Join(hStr, ","), err)
}
n.Logger.Debug("ValidateBatch completed", "get operator state duration", getStateDuration, "total duration", time.Since(start))
return nil
}

Expand Down
Loading