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
Make types of Que jobs Prometheus metrics exclusive #345
Merged
Conversation
This file contains 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
Added type="expired" -> jobs that failed and ran out of retry attempts, so they won't be retried any longer
Test in OpenShift[scaled zync-que down to 0] oc exec -it $(oc get pods | grep zync-que | grep Running | awk '{ print $1 }') -- bash -c 'curl http://localhost:9394/metrics | grep que_jobs_scheduled_total' | grep 'UpdateJob'
que_jobs_scheduled_total{job="UpdateJob"} 0
que_jobs_scheduled_total{job="UpdateJob",type="ready"} 0
que_jobs_scheduled_total{job="UpdateJob",type="scheduled"} 0
que_jobs_scheduled_total{job="UpdateJob",type="finished"} 0
que_jobs_scheduled_total{job="UpdateJob",type="failed"} 0
que_jobs_scheduled_total{job="UpdateJob",type="expired"} 0 oc exec -it $(oc get pods | grep zync-database | grep Running | awk '{ print $1 }') -- bash -c 'psql -U zync zync_production' select id, run_at from que_jobs;
id | run_at
----+-----------------------------------
76 | 2020-06-25 12:47:22.409502+00 type=scheduled update que_jobs set run_at='2020-06-26 12:47:22.409502+00' where id=76; [scaled zync-que up to 1] oc exec -it $(oc get pods | grep zync-que | grep Running | awk '{ print $1 }') -- bash -c 'curl http://localhost:9394/metrics | grep que_jobs_scheduled_total' | grep 'UpdateJob'
que_jobs_scheduled_total{job="UpdateJob"} 1
que_jobs_scheduled_total{job="UpdateJob",type="ready"} 0
que_jobs_scheduled_total{job="UpdateJob",type="scheduled"} 1
que_jobs_scheduled_total{job="UpdateJob",type="finished"} 0
que_jobs_scheduled_total{job="UpdateJob",type="failed"} 0
que_jobs_scheduled_total{job="UpdateJob",type="expired"} 0 type=failed update que_jobs set error_count=1 where id=76; oc exec -it $(oc get pods | grep zync-que | grep Running | awk '{ print $1 }') -- bash -c 'curl http://localhost:9394/metrics | grep que_jobs_scheduled_total' | grep 'UpdateJob'
que_jobs_scheduled_total{job="UpdateJob"} 1
que_jobs_scheduled_total{job="UpdateJob",type="ready"} 0
que_jobs_scheduled_total{job="UpdateJob",type="scheduled"} 0
que_jobs_scheduled_total{job="UpdateJob",type="finished"} 0
que_jobs_scheduled_total{job="UpdateJob",type="failed"} 1
que_jobs_scheduled_total{job="UpdateJob",type="expired"} 0 type=expired update que_jobs set expired_at=now() where id=76; oc exec -it $(oc get pods | grep zync-que | grep Running | awk '{ print $1 }') -- bash -c 'curl http://localhost:9394/metrics | grep que_jobs_scheduled_total' | grep 'UpdateJob'
que_jobs_scheduled_total{job="UpdateJob"} 1
que_jobs_scheduled_total{job="UpdateJob",type="ready"} 0
que_jobs_scheduled_total{job="UpdateJob",type="scheduled"} 0
que_jobs_scheduled_total{job="UpdateJob",type="finished"} 0
que_jobs_scheduled_total{job="UpdateJob",type="failed"} 0
que_jobs_scheduled_total{job="UpdateJob",type="expired"} 1 type=finished update que_jobs set expired_at=null, error_count=0, finished_at=now() where id=76; oc exec -it $(oc get pods | grep zync-que | grep Running | awk '{ print $1 }') -- bash -c 'curl http://localhost:9394/metrics | grep que_jobs_scheduled_total' | grep 'UpdateJob'
que_jobs_scheduled_total{job="UpdateJob"} 1
que_jobs_scheduled_total{job="UpdateJob",type="ready"} 0
que_jobs_scheduled_total{job="UpdateJob",type="scheduled"} 0
que_jobs_scheduled_total{job="UpdateJob",type="finished"} 1
que_jobs_scheduled_total{job="UpdateJob",type="failed"} 0
que_jobs_scheduled_total{job="UpdateJob",type="expired"} 0 |
macejmic
approved these changes
Jun 26, 2020
raelga
approved these changes
Jun 27, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for solving this that fast!
hallelujah
approved these changes
Jun 28, 2020
Martouta
approved these changes
Jun 29, 2020
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.
Redefines the types of Prometheus metrics on Que jobs (
que_jobs_scheduled_total
) as the following:Considering current implementation in Zync,
scheduled
andfinished
are expected to be always zero. The former because Zync does not make any job to "wait until" except when handling retries of failed jobs. The latter because Zync only keeps in the database the executed jobs that fail; whenever succeeded, they are deleted.que_jobs_scheduled_total{type="scheduled"}
does not correspond to Que's definition of "scheduled" (as showed in the Que's web console). Que defines "scheduled" as virtually a synonym of "enqueued". Every jobs scheduled to be executed, now or some time in the future, will be listed as "scheduled" by Que. In fact, even "expired" jobs may be listed as "scheduled" by Que. Whereas for the metric, we do a clear distinction between "ready" (now), "scheduled" (to some time in the future) and "expired", with unambiguous meaning to each one of these terms.Moreover,
ready
is also expected to be zero most of time. If it's not zero, it's because Zync if nor processing the jobs or not processing them fast enough.Closes THREESCALE-5460