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

Add metrics + max buffer size to schedule workflow #3872

Merged
merged 2 commits into from
Feb 3, 2023

Conversation

dnr
Copy link
Member

@dnr dnr commented Jan 31, 2023

What changed?

  • Add some metrics to scheduler workflow
  • Add max buffer size to prevent it from growing indefinitely
  • Reduce some log levels
  • Include namespace in logs

Why?
Observability

How did you test it?
existing tests, mostly just adding metrics

Potential risks

Is hotfix candidate?

@dnr dnr requested a review from a team as a code owner January 31, 2023 08:53
service/worker/scheduler/workflow.go Show resolved Hide resolved
@@ -673,6 +682,11 @@ func (s *scheduler) resolveOverlapPolicy(overlapPolicy enumspb.ScheduleOverlapPo

func (s *scheduler) addStart(nominalTime, actualTime time.Time, overlapPolicy enumspb.ScheduleOverlapPolicy, manual bool) {
s.logger.Debug("addStart", "nominal", nominalTime, "actual", actualTime, "overlapPolicy", overlapPolicy, "manual", manual)
if s.tweakables.MaxBufferSize > 0 && len(s.State.BufferedStarts) >= s.tweakables.MaxBufferSize {
s.logger.Error("Buffer too large")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add some detail for better debugging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think would be useful here? it's tagged with namespace and schedule id already, which should be enough for someone to find the workload that's causing this. I could add the start time, overlap policy, manual?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could add schedule spec, start time, buffer size etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little reluctant to just dump the spec in here since it might be large, and this log might end up repeated a lot. Maybe we should log it once per schedule start so it can be referenced?

Buffer size will always just be the limit here so that's not that useful.

I can log the other args I guess.

@@ -673,6 +682,11 @@ func (s *scheduler) resolveOverlapPolicy(overlapPolicy enumspb.ScheduleOverlapPo

func (s *scheduler) addStart(nominalTime, actualTime time.Time, overlapPolicy enumspb.ScheduleOverlapPolicy, manual bool) {
s.logger.Debug("addStart", "nominal", nominalTime, "actual", actualTime, "overlapPolicy", overlapPolicy, "manual", manual)
if s.tweakables.MaxBufferSize > 0 && len(s.State.BufferedStarts) >= s.tweakables.MaxBufferSize {
s.logger.Error("Buffer too large")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could add schedule spec, start time, buffer size etc.

@dnr dnr merged commit a4943bb into temporalio:master Feb 3, 2023
@dnr dnr deleted the sched39 branch February 3, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants