Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue where ProcessingJobMetric doesnt work as expected #11

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ func (c *Controller) processBatchLogs(listener Listener, fromHeight, toHeight ui
continue
}
metrics.Pusher.IncrCounter(metrics.PreparingSuccessJobMetric, 1)
metrics.Pusher.IncrGauge(metrics.ProcessingJobMetric, 1)
c.JobChan <- job
}
}
Expand Down
3 changes: 2 additions & 1 deletion job.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ func (w *Worker) start() {
case job := <-w.workerChan:
log.Info("processing job", "id", job.GetID(), "nextTry", job.GetNextTry(), "retryCount", job.GetRetryCount(), "type", job.GetType())
if job.GetNextTry() == 0 || job.GetNextTry() <= time.Now().Unix() {
metrics.Pusher.IncrGauge(metrics.ProcessingJobMetric, 1)
w.processJob(job)
metrics.Pusher.IncrGauge(metrics.ProcessingJobMetric, -1)
continue
}
// push the job back to mainChan
Expand All @@ -107,7 +109,6 @@ func (w *Worker) processJob(job JobHandler) {
err error
val []byte
)
defer metrics.Pusher.IncrGauge(metrics.ProcessingJobMetric, -1)

val, err = job.Process()
if err != nil {
Expand Down