Skip to content

Commit

Permalink
feat: remove tracking error count
Browse files Browse the repository at this point in the history
  • Loading branch information
rustcandy committed Nov 11, 2024
1 parent 44fe002 commit 433d74b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 62 deletions.
2 changes: 0 additions & 2 deletions cmd/start/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ func enqueueMissingBlocks(exportQueue types.HeightQueue, ctx *parser.Context) {
lastDBBlockHeight, err := ctx.Database.GetLastBlockHeight()
if err != nil {
ctx.Logger.Error("failed to get last block height from database", "error", err)
prometheus.SignalDBOperationError()
}

// Get the start height, default to the config's height
Expand Down Expand Up @@ -203,7 +202,6 @@ func mustGetLatestHeight(ctx *parser.Context) int64 {
}

ctx.Logger.Error("failed to get last block from rpc client", "err", err, "retry count", retryCount)
prometheus.SignalRPCRequestError()

time.Sleep(ctx.Config.GetAvgBlockTime() * time.Duration(retryCount))
}
Expand Down
3 changes: 0 additions & 3 deletions parser/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ func (w Worker) Start() {
err := w.ProcessIfNotExists(i.Height)
if err != nil {
go func() {
// Signal that an error occurred while processing this block
prometheus.SignalBlockError(i.Height)

// Build the block with the updated retry count and log the error
newBlock := i.IncrementRetryCount(err)
w.logger.Debug("re-enqueuing failed block", "height", i.Height, "err", err, "count", newBlock.RetryCount)
Expand Down
57 changes: 0 additions & 57 deletions prometheus/prometheus.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package prometheus

import (
"fmt"

"github.com/prometheus/client_golang/prometheus"
)

Expand Down Expand Up @@ -31,63 +29,8 @@ var LatestIndexedHeightByWorker = prometheus.NewGaugeVec(
[]string{"worker_index"},
)

// ErrorsCount represents the Telemetry counter used to track the number of errors emitted
var ErrorsCount = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "juno_errors",
Help: "Total number of errors emitted.",
},
)

// RPCRequestErrorsCount represents the Telemetry counter used to track the number of RPC request errors
var RPCRequestErrorsCount = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "juno_rpc_errors",
Help: "Total number of errors occurred during RPC requests",
},
)

// DBOperationErrorsCount represents the Telemetry counter used to track the number of database operation errors
var DBOperationErrorsCount = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "juno_db_errors",
Help: "Total number of errors occurred during database operations",
},
)

// BlockErrorsCount represents the Telemetry counter used to track the number of errors per block
var BlockErrorsCount = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "juno_block_errors",
Help: "Total number of errors per block",
},
[]string{"block"},
)

// SignalRPCRequestError signal that a new rpc request error occurred
func SignalRPCRequestError() {
RPCRequestErrorsCount.Inc()
}

// SignalDBOperationError signal that a new error occurred while interacting
// with the database
func SignalDBOperationError() {
DBOperationErrorsCount.Inc()
}

// SignalBlockError increments the error counter for the given block
func SignalBlockError(blockHeight int64) {
blockStr := fmt.Sprintf("%d", blockHeight)
BlockErrorsCount.WithLabelValues(blockStr).Inc()
prometheus.MustRegister()
}

func init() {
prometheus.MustRegister(StartHeight)
prometheus.MustRegister(WorkersCount)
prometheus.MustRegister(LatestIndexedHeightByWorker)
prometheus.MustRegister(ErrorsCount)
prometheus.MustRegister(RPCRequestErrorsCount)
prometheus.MustRegister(DBOperationErrorsCount)
prometheus.MustRegister(BlockErrorsCount)
}

0 comments on commit 433d74b

Please sign in to comment.