hashicorp / hashicorp/envconsul

Improve the logging

Open
#336 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.1k
Forks
194
PR merge metrics
No merged PRs in 30d

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: https://github.com/hashicorp/envconsul/blob/d39537a0d62cb471c8e9c3ce9384548291980797/cli.go#L186-L189

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:

1. Improve the logging so that every log is prefixed with `envconsul: ` or add a flag allowing to do so.
2. Improve that particular log so that it includes the Signal that was received: `Received SIGTERM. Cleaning up...`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.