Skip to content

Commit

Permalink
jobs,schedule: Annotate context with schedule ID.
Browse files Browse the repository at this point in the history
Annotate context passed to job execution with the schedule ID.

Release Justification: Low danger, observability imporovement; category 4.
Release Notes: None
  • Loading branch information
Yevgeniy Miretskiy committed Sep 8, 2021
1 parent 44c9505 commit 6279b9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/jobs/job_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/metric"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/errors"
"github.com/cockroachdb/logtags"
)

// CreatedByScheduledJobs identifies the job that was created
Expand Down Expand Up @@ -180,7 +181,8 @@ func (s *jobScheduler) processSchedule(
schedule.ScheduleID(), schedule.ScheduleLabel(),
schedule.ScheduledRunTime(), schedule.NextRun())

if err := executor.ExecuteJob(ctx, s.JobExecutionConfig, s.env, schedule, txn); err != nil {
execCtx := logtags.AddTag(ctx, "schedule", schedule.ScheduleID())
if err := executor.ExecuteJob(execCtx, s.JobExecutionConfig, s.env, schedule, txn); err != nil {
return errors.Wrapf(err, "executing schedule %d", schedule.ScheduleID())
}

Expand Down

0 comments on commit 6279b9b

Please sign in to comment.