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 timer to track queue delay in InstrumentedSource.queue #7601

Merged
merged 3 commits into from
Oct 8, 2020

Conversation

ghost
Copy link

@ghost ghost commented Oct 7, 2020

Add timer to track queue delay in InstrumentedSource.queue and use it from TrackerImpl.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@ghost ghost self-requested a review October 7, 2020 16:16
and use it from TrackerImpl.

CHANGELOG_BEGIN
CHANGELOG_END
@ghost ghost force-pushed the jussi/queue-delay-metric branch from a9b4767 to ce2fab6 Compare October 7, 2020 16:18
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Broadly looks great to me. Just some minor suggestions.

Comment on lines 66 to 70
.map { x =>
// Sleep to delay the processing of the next element.
Thread.sleep(5)
x
}
Copy link

Choose a reason for hiding this comment

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

Perhaps use the scheduler here rather than blocking a Future thread?

Suggested change
.map { x =>
// Sleep to delay the processing of the next element.
Thread.sleep(5)
x
}
.mapAsync(1) { x =>
scheduler.scheduleOnce(5.seconds)(Future(x))
}

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, good suggestion. I'll give it a try. (It's 5 millis though).

Copy link
Author

Choose a reason for hiding this comment

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

scheduler didn't have the right methods, but found this instead: https://doc.akka.io/docs/akka/current/futures.html.

Copy link

Choose a reason for hiding this comment

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

Oh, my bad. Totally fine with the Thread.sleep then.

@ghost ghost removed the request for review from SamirTalwar October 8, 2020 07:47
@ghost ghost added the automerge label Oct 8, 2020
@mergify mergify bot merged commit 2031ae8 into master Oct 8, 2020
@mergify mergify bot deleted the jussi/queue-delay-metric branch October 8, 2020 13:18
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.

1 participant