[BANKINT-231] Add failed label to gauge#54
Merged
Conversation
ahjmorton
commented
Dec 16, 2019
| QUEUE_VIEW_SQL = <<~SQL | ||
| select queue, job_class, priority | ||
| , (case when (retryable AND run_at < now()) then 'true' else 'false' end) as due | ||
| , (case when (NOT retryable AND error_count > 0) then 'true' else 'false' end) as failed |
Author
There was a problem hiding this comment.
Alternatively we could do (NOT retryable AND failed_at IS NOT NULL) I opted for this approach as failed_at isn't updated anywhere in this repository : it is updated over in the que-failure gem.
Given the difference in approaches / legacy here I can't be certain which one is more correct so any comments would be useful.
Contributor
There was a problem hiding this comment.
This project really needs some tlc. Ideally que-failure would be part of this gem, and we'd clean out all the rest of the crap. Given it's not, just assume we only ever use it with que-failure for now
lawrencejones
approved these changes
Dec 17, 2019
Contributor
lawrencejones
left a comment
There was a problem hiding this comment.
Think this looks fine. Let's get it on staging and see
ivgiuliani
approved these changes
Dec 17, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ticket
Add a
failedlabel to queue view metrics to allow monitoring / alerting on failed jobs.Approach
Initially the idea here was to have separate gauge with its own SQL query to retrieve information.
However by having a single gauge with multiple labels we do get some useful properties :
sumin Promethesus.To identify a job as failed we look for jobs where error count is greater than 0 and have the
retryableflag set to false. This is in line with our identification of failed jobs elsewhere.