Skip to content

Commit

Permalink
Add a new metric so total batches and removed batches are aligned (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix committed Dec 13, 2023
1 parent 03cd96a commit afa62bb
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions node/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type Metrics struct {
// The latency (in ms) to process the request.
RequestLatency *prometheus.SummaryVec
// Accumulated number and size of batches processed by their statuses.
// TODO: this metrics should be removed in future release.
AccuBatchesDeprecated *prometheus.CounterVec
// Accumulated number and size of batches processed by their statuses.
AccuBatches *prometheus.CounterVec
// Accumulated number and size of batches that have been removed from the Node.
AccuRemovedBatches *prometheus.CounterVec
Expand Down Expand Up @@ -58,7 +61,7 @@ func NewMetrics(eigenMetrics eigenmetrics.Metrics, reg *prometheus.Registry, log
prometheus.CounterOpts{
Namespace: Namespace,
Name: "eigenda_rpc_requests_total",
Help: "the total number of requests handled by the DA node",
Help: "the total number of requests processed by the DA node",
},
[]string{"method", "status"},
),
Expand All @@ -71,13 +74,21 @@ func NewMetrics(eigenMetrics eigenmetrics.Metrics, reg *prometheus.Registry, log
},
[]string{"method", "stage"},
),
AccuBatchesDeprecated: promauto.With(reg).NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Name: "eigenda_batches_total",
Help: "the total number and size of batches processed by the DA node",
},
[]string{"type", "status"},
),
// The "status" label has values: received, validated, stored, signed.
// These are the lifecycle of a batch at the DA Node.
AccuBatches: promauto.With(reg).NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Name: "eigenda_batches_total",
Help: "the total number and size of batches handled by the DA node",
Name: "eigenda_processed_batches_total",
Help: "the total number and size of batches processed by the DA node",
},
[]string{"type", "status"},
),
Expand Down Expand Up @@ -129,6 +140,8 @@ func (g *Metrics) RemoveNCurrentBatch(numBatches int, totalBatchSize int64) {
}

func (g *Metrics) AcceptBatches(status string, batchSize int64) {
g.AccuBatchesDeprecated.WithLabelValues("number", status).Inc()
g.AccuBatchesDeprecated.WithLabelValues("size", status).Add(float64(batchSize))
g.AccuBatches.WithLabelValues("number", status).Inc()
g.AccuBatches.WithLabelValues("size", status).Add(float64(batchSize))
}

0 comments on commit afa62bb

Please sign in to comment.