-
Notifications
You must be signed in to change notification settings - Fork 194
Description
In my company, we use envconsul
in Docker entrypoint, as follows:
envconsul /path/to/some/binary
We use AWS's spot instances, which means our cronjob might get interrupted (as in, envconsul
will receive a SIGTERM
) at any time. Our SRE team knows about this, and did communicate with our development team about it, but it's hard to keep that in mind.
So when an interruption happens, we get very few logs. Some of them are from containerd
, saying that Task xxxx has exited with exit code 12
, and before that, we get a log from envconsul
, that says: Cleaning up...
, and that's it:
Lines 186 to 189 in d39537a
case *cfg.KillSignal: | |
fmt.Fprintf(cli.errStream, "Cleaning up...\n") | |
runner.Stop() | |
return ExitCodeInterrupt |
Now when using unix tools, there seems to be a handy convention that consists in printing the name of the tool that encounters an error, that way, if you have an error in a pipeline, there is some indication about what tool is having an issue:
$ echo 'hi'|grep a b
grep: b: No such file or directory
I have 2 suggestions:
- Improve the logging so that every log is prefixed with
envconsul:
or add a flag allowing to do so. - Improve that particular log so that it includes the Signal that was received:
Received SIGTERM. Cleaning up...