Skip to content
Draft
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions service/matching/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/api/serviceerror"
persistencespb "go.temporal.io/server/api/persistence/v1"
"go.temporal.io/server/common/locks"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/log/tag"
"go.temporal.io/server/common/metrics"
Expand Down Expand Up @@ -729,10 +730,10 @@ func (db *taskQueueDB) emitBacklogGaugesLocked() {
return
}

var approximateBacklogCount, totalLag int64
var totalLag int64
var oldestTime time.Time
for _, s := range db.subqueues {
approximateBacklogCount += s.ApproximateBacklogCount
metrics.ApproximateBacklogCount.With(db.metricsHandler).Record(float64(s.ApproximateBacklogCount), metrics.PriorityTag(locks.Priority(s.Key.Priority)))
oldestTime = minNonZeroTime(oldestTime, s.oldestTime)
// note: this metric is only an estimation for the lag.
// taskID in DB may not be continuous, especially when task list ownership changes.
Expand All @@ -745,7 +746,6 @@ func (db *taskQueueDB) emitBacklogGaugesLocked() {
}
}

metrics.ApproximateBacklogCount.With(db.metricsHandler).Record(float64(approximateBacklogCount))
if oldestTime.IsZero() {
metrics.ApproximateBacklogAgeSeconds.With(db.metricsHandler).Record(0)
} else {
Expand Down
Loading