Skip to content

Commit

Permalink
feat(da): add metric for consecutive failed da submissions (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
srene authored Jul 26, 2024
1 parent 242acb7 commit e922dea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions da/avail/avail.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ func (c *DataAvailabilityLayerClient) Init(config []byte, pubsubServer *pubsub.S
}
}

types.RollappConsecutiveFailedDASubmission.Set(0)

c.ctx, c.cancel = context.WithCancel(context.Background())
return nil
}
Expand Down Expand Up @@ -265,6 +267,7 @@ func (c *DataAvailabilityLayerClient) submitBatchLoop(dataBlob []byte) da.Result
var err error
daBlockHeight, err = c.broadcastTx(dataBlob)
if err != nil {
types.RollappConsecutiveFailedDASubmission.Inc()
c.logger.Error("broadcasting batch", "error", err)
if errors.Is(err, da.ErrTxBroadcastConfigError) {
err = retry.Unrecoverable(err)
Expand Down Expand Up @@ -295,6 +298,7 @@ func (c *DataAvailabilityLayerClient) submitBatchLoop(dataBlob []byte) da.Result
c.logger.Error(err.Error())
continue
}
types.RollappConsecutiveFailedDASubmission.Set(0)

c.logger.Debug("Successfully submitted batch.")
return da.ResultSubmitBatch{
Expand Down
5 changes: 5 additions & 0 deletions da/celestia/celestia.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func (c *DataAvailabilityLayerClient) Init(config []byte, pubsubServer *pubsub.S
apply(c)
}

types.RollappConsecutiveFailedDASubmission.Set(0)

return nil
}

Expand Down Expand Up @@ -203,6 +205,7 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS
height, commitment, err := c.submit(data)
if err != nil {
c.logger.Error("Submit blob.", "error", err)
types.RollappConsecutiveFailedDASubmission.Inc()
backoff.Sleep()
continue
}
Expand All @@ -219,6 +222,7 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS
result := c.CheckBatchAvailability(daMetaData)
if result.Code != da.StatusSuccess {
c.logger.Error("Check batch availability: submitted batch but did not get availability success status.", "error", err)
types.RollappConsecutiveFailedDASubmission.Inc()
backoff.Sleep()
continue
}
Expand All @@ -228,6 +232,7 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS

c.logger.Debug("Blob availability check passed successfully.")

types.RollappConsecutiveFailedDASubmission.Set(0)
return da.ResultSubmitBatch{
BaseResult: da.BaseResult{
Code: da.StatusSuccess,
Expand Down
5 changes: 5 additions & 0 deletions types/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ var RollappPendingSubmissionsSkewNumBytes = promauto.NewGauge(prometheus.GaugeOp
Name: "rollapp_pending_submissions_skew_num_bytes",
Help: "The number of bytes (of blocks and commits) which have been accumulated but not yet submitted.",
})

var RollappConsecutiveFailedDASubmission = promauto.NewGauge(prometheus.GaugeOpts{
Name: "rollapp_consecutive_failed_da_submissions",
Help: "The number of consecutive times the da fails to submit.",
})

0 comments on commit e922dea

Please sign in to comment.