Skip to content

Commit

Permalink
feat(da): status gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxcanfly committed Oct 25, 2024
1 parent 9619f88 commit 5b4db36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions sequencing/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Metrics struct {
// Wallet Balance
// WalletBalance metrics.Gauge
// Transaction Status
TransactionStatus metrics.Histogram
TransactionStatus metrics.Gauge
// Number of pending blocks.
NumPendingBlocks metrics.Gauge
// Last included block height
Expand Down Expand Up @@ -67,11 +67,10 @@ func PrometheusMetrics(labelsAndValues ...string) *Metrics {
Name: "last_blob_size",
Help: "The size in bytes of the last DA blob.",
}, labels).With(labelsAndValues...),
TransactionStatus: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{
TransactionStatus: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Subsystem: MetricsSubsystem,
Name: "transaction_status",
Help: "Distribution of transaction statuses for DA submissions.",
Buckets: []float64{0, 1, 2, 3, 4, 5, 6, 7},
Help: "Count of transaction statuses for DA submissions",
}, labels).With(labelsAndValues...),
NumPendingBlocks: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Subsystem: MetricsSubsystem,
Expand All @@ -91,7 +90,7 @@ func NopMetrics() *Metrics {
return &Metrics{
GasPrice: discard.NewGauge(),
LastBlobSize: discard.NewGauge(),
TransactionStatus: discard.NewHistogram(),
TransactionStatus: discard.NewGauge(),
NumPendingBlocks: discard.NewGauge(),
IncludedBlockHeight: discard.NewGauge(),
}
Expand Down
4 changes: 2 additions & 2 deletions sequencing/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,11 @@ func (c *Sequencer) publishBatch() error {
return nil
}

func (c *Sequencer) recordMetrics(gasPrice float64, blobSize uint64, status da.StatusCode, numPendingBlocks int, includedBlockHeight uint64) {
func (c *Sequencer) recordMetrics(gasPrice float64, blobSize uint64, statusCode da.StatusCode, numPendingBlocks int, includedBlockHeight uint64) {
if c.metrics != nil {
c.metrics.GasPrice.Set(float64(gasPrice))
c.metrics.LastBlobSize.Set(float64(blobSize))
c.metrics.TransactionStatus.Observe(float64(status))
c.metrics.TransactionStatus.With("status", fmt.Sprintf("%d", statusCode)).Add(1)
c.metrics.NumPendingBlocks.Set(float64(numPendingBlocks))
c.metrics.IncludedBlockHeight.Set(float64(includedBlockHeight))
}
Expand Down

0 comments on commit 5b4db36

Please sign in to comment.