-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Added metrics to Scheduler and track in Process state #984
Conversation
9173934
to
d6e2587
Compare
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.
I'm happy to accept this. Briefly, it needs:
- threadsafety
- have the value show up when the Process serializes the Schedulers so that it can be queried
- I think the value should be reset when the the Scheduler is restarted (otherwise it might get weird when forking, especially with Puma's worker_fork
@bensheldon Thank you for taking your time to look into this! Regarding the serialization - as far as I can see process uses name when serializing, so I've added the metrics to the name here in 78d8aba. Not sure if that is the best place though, but not sure where else to put it, without messing up the enclosing parentheses. What do you think? Also considered adding something like:
to Process.current_state. |
@AndersGM Good things to flag! What do you think about making a method like Ok, and then I have a totally random thought that I want to share, but isn't telling you to do instead: What if we tracked |
@bensheldon That would be better, but maybe not Sound interesting. I actually do something similar in one of my apps that then sends the metrics to prometheus. However, the issue is that the executions can be destroyed through the UI (and cleanup?). Consequently, the resulting counter could actually decrement, without being reset. That is the reason I implemented it this way, to avoid that. Did you think of another way or have I misunderstood something? :-) |
@AndersGM I made a few tweaks and pushed this back up. It's looking great! I just merged in #977 which will update the Process record in the database every 30 seconds. One thing I noticed that I'd like your feedback on. Currently this PR only records a job failure if it bubbles up to the thread-handler. This will cover only a small number of execution failures. We want to cover all the circumstances where a job's execution does not succeed, right? (e.g. if an execution fails and is retried, we'd still count that). That seem right? If you agree, I can make that tweak. |
@bensheldon indeed - thank you! I wasn't aware of that - let me know if I can be of any help! |
#532