Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
To develop #2265 we need a queue that is able to choose between FIFO and LIFO. Our current JobQueue does not support that since
it-pushable
hardcodes a FIFO module inside it.Description
I've taken this opportunity to refactor the queue with backed-in metrics that will be used on all of it's consumers
sleep(0)
${prefix}_length
: Count of total queue length${prefix}_dropped_jobs_total
: Count of total dropped jobs${prefix}_job_time_seconds
: Time (async) to process queue jobThe metrics use a new API from
prom-client
: the.collect()
function available in v13. It allows to de-duplicated state from the prometheus client if that state is already tracked by the application. This is used in the queue length metric, and only computed on demand.