Skip to content

Commit

Permalink
jobs: make the registry logging less chatty
Browse files Browse the repository at this point in the history
The "toggling idleness" log message was the 4th most voluminous log
event source in CC, logged 4x more frequently than the first next
event source in volume.

This commit makes it less verbose.

Release note: None
  • Loading branch information
knz committed Sep 30, 2022
1 parent 4f3bb99 commit 0b8409a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/jobs/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,15 +960,18 @@ func (r *Registry) cleanupOldJobsPage(

log.VEventf(ctx, 2, "read potentially expired jobs: %d", numRows)
if len(toDelete.Array) > 0 {
log.Infof(ctx, "attempting to clean up %d expired job records", len(toDelete.Array))
log.VEventf(ctx, 2, "attempting to clean up %d expired job records", len(toDelete.Array))
const stmt = `DELETE FROM system.jobs WHERE id = ANY($1)`
var nDeleted int
if nDeleted, err = r.ex.Exec(
ctx, "gc-jobs", nil /* txn */, stmt, toDelete,
); err != nil {
log.Warningf(ctx, "error cleaning up %d jobs: %v", len(toDelete.Array), err)
return false, 0, errors.Wrap(err, "deleting old jobs")
}
log.Infof(ctx, "cleaned up %d expired job records", nDeleted)
if nDeleted > 0 {
log.Infof(ctx, "cleaned up %d expired job records", nDeleted)
}
}
// If we got as many rows as we asked for, there might be more.
morePages := numRows == pageSize
Expand Down Expand Up @@ -1419,7 +1422,7 @@ func (r *Registry) MarkIdle(job *Job, isIdle bool) {
jobType := payload.Type()
jm := r.metrics.JobMetrics[jobType]
if aj.isIdle != isIdle {
log.Infof(r.serverCtx, "%s job %d: toggling idleness to %+v", jobType, job.ID(), isIdle)
log.VEventf(r.serverCtx, 2, "%s job %d: toggling idleness to %+v", jobType, job.ID(), isIdle)
if isIdle {
r.metrics.RunningNonIdleJobs.Dec(1)
jm.CurrentlyIdle.Inc(1)
Expand Down

0 comments on commit 0b8409a

Please sign in to comment.