Skip to content

Commit

Permalink
Made suggested change.
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <[email protected]>
  • Loading branch information
cody-littley committed Dec 9, 2024
1 parent aefdb6f commit 794edc0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
3 changes: 0 additions & 3 deletions disperser/controller/encoding_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ func (e *EncodingManager) HandleBatch(ctx context.Context) error {
e.pool.Submit(func() {
start := time.Now()

totalSlept := time.Duration(0)
var i int
var finishedEncodingTime time.Time
var finishedPutBlobCertificateTime time.Time
Expand Down Expand Up @@ -233,12 +232,10 @@ func (e *EncodingManager) HandleBatch(ctx context.Context) error {

e.logger.Error("failed to update blob status to Encoded", "blobKey", blobKey.Hex(), "err", err)
sleepTime := time.Duration(math.Pow(2, float64(i))) * time.Second
totalSlept += sleepTime
time.Sleep(sleepTime) // Wait before retrying
}

e.metrics.reportBatchRetryCount(i)
e.metrics.reportBatchSleepTime(totalSlept)

if success {
e.metrics.reportEncodingLatency(finishedEncodingTime.Sub(start))
Expand Down
15 changes: 0 additions & 15 deletions disperser/controller/encoding_manager_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ type encodingManagerMetrics struct {
batchSize *prometheus.GaugeVec
batchDataSize *prometheus.GaugeVec
batchRetryCount *prometheus.GaugeVec
batchSleepTime *prometheus.GaugeVec
failedSubmissionCount *prometheus.CounterVec
}

Expand Down Expand Up @@ -101,15 +100,6 @@ func newEncodingManagerMetrics(registry *prometheus.Registry) *encodingManagerMe
[]string{},
)

batchSleepTime := promauto.With(registry).NewGaugeVec(
prometheus.GaugeOpts{
Namespace: encodingManagerNamespace,
Name: "batch_sleep_time_ms",
Help: "The time slept during while waiting to retry encoding a blob.",
},
[]string{},
)

failSubmissionCount := promauto.With(registry).NewCounterVec(
prometheus.CounterOpts{
Namespace: encodingManagerNamespace,
Expand All @@ -128,7 +118,6 @@ func newEncodingManagerMetrics(registry *prometheus.Registry) *encodingManagerMe
batchSize: batchSize,
batchDataSize: batchDataSize,
batchRetryCount: batchRetryCount,
batchSleepTime: batchSleepTime,
failedSubmissionCount: failSubmissionCount,
}
}
Expand Down Expand Up @@ -165,10 +154,6 @@ func (m *encodingManagerMetrics) reportBatchRetryCount(count int) {
m.batchRetryCount.WithLabelValues().Set(float64(count))
}

func (m *encodingManagerMetrics) reportBatchSleepTime(duration time.Duration) {
m.batchSleepTime.WithLabelValues().Set(float64(duration.Nanoseconds()) / float64(time.Millisecond))
}

func (m *encodingManagerMetrics) reportFailedSubmission() {
m.failedSubmissionCount.WithLabelValues().Inc()
}

0 comments on commit 794edc0

Please sign in to comment.