Skip to content

Commit

Permalink
Merge pull request #25 from Layr-Labs/add-quorum-label-to-updatestake…
Browse files Browse the repository at this point in the history
…attempt-metric

metric updates
  • Loading branch information
samlaf authored Mar 31, 2024
2 parents 58d372a + 528df32 commit 2c8dd5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions avssync.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ func (a *AvsSync) updateStakes() {
// this one we update all quorums at once, since we're only updating a subset of operators (which should be a small number)
receipt, err := a.avsWriter.UpdateStakesOfOperatorSubsetForAllQuorums(timeoutCtx, a.operators)
if err != nil {
updateStakeAttempt.With(prometheus.Labels{"status": string(UpdateStakeStatusError)}).Inc()
// no quorum label means we are updating all quorums
updateStakeAttempt.With(prometheus.Labels{"status": string(UpdateStakeStatusError), "quorum": ""}).Inc()
a.logger.Error("Error updating stakes of operator subset for all quorums", err)
return
} else if receipt.Status == gethtypes.ReceiptStatusFailed {
Expand Down Expand Up @@ -188,10 +189,10 @@ func (a *AvsSync) tryNTimesUpdateStakesOfEntireOperatorSetForQuorum(quorum byte,
a.logger.Error("Update stakes of entire operator set for quorum reverted", "quorum", int(quorum))
continue
}
updateStakeAttempt.With(prometheus.Labels{"status": string(UpdateStakeStatusSucceed)}).Inc()
updateStakeAttempt.With(prometheus.Labels{"status": string(UpdateStakeStatusSucceed), "quorum": strconv.Itoa(int(quorum))}).Inc()
return
}
updateStakeAttempt.With(prometheus.Labels{"status": string(UpdateStakeStatusError)}).Inc()
updateStakeAttempt.With(prometheus.Labels{"status": string(UpdateStakeStatusError), "quorum": strconv.Itoa(int(quorum))}).Inc()
a.logger.Error("Giving up after retrying", "retryNTimes", retryNTimes)
}

Expand Down
2 changes: 1 addition & 1 deletion metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
Namespace: metricsNamespace,
Name: "update_stake_attempt",
Help: "Result from an update stake attempt. Either succeed or error (either tx was mined but reverted, or failed to get processed by chain).",
}, []string{"status"})
}, []string{"status", "quorum"})
txRevertedTotal = promauto.NewCounter(prometheus.CounterOpts{
Namespace: metricsNamespace,
Name: "tx_reverted_total",
Expand Down

0 comments on commit 2c8dd5d

Please sign in to comment.