-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feature request: add "log" endpoint #65
Comments
For the usage pattern discussed in the linked issue, we'd want a way to tell runitor "when you're about to send a /fail signal, please send /log instead". |
Healthchecks added a "log" ping type to cater to use cases where a periodic command is likely to exit with failure status but expected to eventually succeed in future instantiations. healthchecks/healthchecks#525 (comment) Add `-log-only-non-zero` to send a log ping instead of a failure when the command exits with a non-zero status. If runitor fails to execute the command (e.g. not found, no permission, system ran out of pids, ...) a failure ping is still sent. Addresses #65
@blackscreen My manual testing:
@cuu508 I'd appreciate a quick code review. |
The screenshot looks promising. Is there a build for linux I could download? I am not that familiar with go and building it from scratch. Sorry. |
Alright. I made a beta release. Binaries for various operating systems and architectures are at https://github.com/bdd/runitor/releases/tag/v0.11.0-beta.1 |
Thanks. I tested it and it works like a charm. |
Thanks for looking into it so promptly @bdd! The code change looks good to me. I experimented with the beta build too, and it did everything as I was expecting.
A subtle thing that I didn't think of but makes total sense!
or
Neither interpretation is wrong, so not really a problem. But perhaps |
I spent an order of magnitude more time thinking what this flag should be than writing the code :) I included "only" in flag's name thinking it'd relay the "log instead of concluding as failure" behavior. Given that it wasn't immediately obvious to you, it's fair to assume I wasn't very successful in naming this. The fact that logging as in sending the output of the command as part of status ping is the default for HC+runitor users, a different type of ping which is also called "log" makes this more challenging. I plan to cut v0.11.0 release Friday afternoon (Pacific Time). So unless you come up with a different flag name, I'll adopt your recommendation and call it |
I think A couple other ideas, no strong opinion, naming is hard, –
|
That (report-nonzero-as) would be my choice, but I am fine with either one of the mentioned ideas. Naming is really hard, I know that. I am just glad it got implemented so fast. :) |
Context: Healthchecks added a "log" ping type to cater to use cases where a periodic command is likely to exit with failure status but expected to eventually succeed in future instantiations. healthchecks/healthchecks#525 (comment) Problems: - "log" ping type is not supported. - Let the user decide ping type to be sent for success, nonzero exit, or execution failure (e.g. command not found, no permission, system ran out pids, ...) Changes: - Introduce three new flags: + -on-success: ping type type to send when command exits successfully. defaults to "success". + -on-nonzero-exit: ping type to send when command exits with nonzero code. defaults to "exit-code". + -on-exec-fail: ping type to send when runitor cannot execute the command. defaults to "fail" + valid values for these flags are: "exit-code", "success", "fail", "log". - Addresses lack of "log" ping type support and use case in #65.
Context: Healthchecks added a "log" ping type to cater to use cases where a periodic command is likely to exit with failure status but expected to eventually succeed in future instantiations. healthchecks/healthchecks#525 (comment) Problems: - "log" ping type is not supported. - Let the user decide ping type to be sent for success, nonzero exit, or execution failure (e.g. command not found, no permission, system ran out pids, ...) Changes: - Introduce three new flags: + -on-success: ping type type to send when command exits successfully. defaults to "success". + -on-nonzero-exit: ping type to send when command exits with nonzero code. defaults to "exit-code". + -on-exec-fail: ping type to send when runitor cannot execute the command. defaults to "fail" + valid values for these flags are: "exit-code", "success", "fail", "log". - Addresses lack of "log" ping type support and use case in #65.
I added the ability to customize the ping type for success, non-zero exit from command, and execution failure cases. Usage text of the three new flags:
Example use for the subject use-case of this issue:
With great flexibility comes great opportunities to do cursed things. So something like this is also possible:
This change slightly modifies runitor's default reporting behavior. I believe in a good way.
There is a good chance I missed or broke something. So please test the beta.2 release. |
I tried beta 2 (only the "on-nonzero-exit"-flag) and it works great. I think you found the best solution with the new flags. The cursed things could be good for testing. Great job! |
Context: Healthchecks added a "log" ping type to cater to use cases where a periodic command is likely to exit with failure status but expected to eventually succeed in future instantiations. healthchecks/healthchecks#525 (comment) Problems: - "log" ping type is not supported. - Let the user decide ping type to be sent for success, nonzero exit, or execution failure (e.g. command not found, no permission, system ran out pids, ...) Changes: - Introduce three new flags: + -on-success: ping type type to send when command exits successfully. defaults to "success". + -on-nonzero-exit: ping type to send when command exits with nonzero code. defaults to "exit-code". + -on-exec-fail: ping type to send when runitor cannot execute the command. defaults to "fail" + valid values for these flags are: "exit-code", "success", "fail", "log". - Addresses lack of "log" ping type support and use case in #65.
I tested the new flags in various combinations, and in combinations with the other flags, and all looked good. I like the flag names you picked, not the shortest, but clear and descriptive. |
I released v1.0.0 🎉 including this change. |
Context: Healthchecks added a "log" ping type to cater to use cases where a periodic command is likely to exit with failure status but expected to eventually succeed in future instantiations. healthchecks/healthchecks#525 (comment) Problems: - "log" ping type is not supported. - Let the user decide ping type to be sent for success, nonzero exit, or execution failure (e.g. command not found, no permission, system ran out pids, ...) Changes: - Introduce three new flags: + -on-success: ping type type to send when command exits successfully. defaults to "success". + -on-nonzero-exit: ping type to send when command exits with nonzero code. defaults to "exit-code". + -on-exec-fail: ping type to send when runitor cannot execute the command. defaults to "fail" + valid values for these flags are: "exit-code", "success", "fail", "log". - Addresses lack of "log" ping type support and use case in bdd#65.
Hello,
I just found out over at the Healthchecks repo, that there is a way of not getting mails every time a job fails.
If we use the "log" endpoint, then we can be flexible about the times a job can fail, before the mails are sent. See this post for the explanation how it would work: healthchecks/healthchecks#525 (comment).
Maybe you can add an option (example: "no-error-ping=true" => sends to "log" endpoint) to send "log" when the job fails, instead of the normal exit code.
To have that feature would be awesome. Thanks for looking into it and for runitor! :)
The text was updated successfully, but these errors were encountered: