motiv-labs / janus

An API Gateway written in Go
https://hellofresh.gitbooks.io/janus
MIT License
2.78k stars 318 forks source link

Misleading error messages on minimal setup #385

Closed jzyinq closed 5 years ago

jzyinq commented 5 years ago

Hi there guys, First of all I'd like to say that Janus is doing a pretty good job at our environments so big :+1: for you all ;-)

Nevertheless we have some false positive errors in our logs that are misleading for our ops and probably it's not a big deal to clean them up.

We use Janus with minimal dependencies:

Our environment configuration looks like this:

ENV DATABASE_DSN file:///etc/janus
ENV LOG_LEVEL warn
ENV LOG_FORMAT text
ENV LOG_WRITER stdout
ENV STATS_DSN noop://

Observed behavior:

Despite setting LOG_WRITER to stdout there are entries that are printed on stderr.

STDOUT: Creating endpoints configuration...
STDOUT: Launching Janus...
STDERR: time="2019-01-29T08:21:53Z" level=info msg="Janus starting..." version=3.8.7-305abe8
STDERR: time="2019-01-29T08:21:53Z" level=info msg="Could not load configurations from file - trying environment configurations instead." error="No config file found: Config File \"janus\" Not Found in \"[/ /root /etc/janus]\""
STDOUT: time="2019-01-29T08:21:53Z" level=warning msg="an error occurred when an event was triggered" error="invalid mongodb session given" event_name=startup
STDOUT: time="2019-01-29T08:21:53Z" level=warning msg="an error occurred when an event was triggered" error="could not initialize statsd client: address udp///: unknown port" event_name=startup
STDERR: 2019/01/29 08:21:53 Could not initiale buffered client: address udp///: unknown port. Falling back to a Noop Statsd client

There is also a mongodb related error which implies that we use one even if we dont.

STDOUT: time="2019-01-29T08:21:53Z" level=warning msg="an error occurred when an event was triggered" error="invalid mongodb session given" event_name=startup

Also statsd client seems to ignore STATS_DSN setting with error:

STDERR: 2019/01/29 08:21:53 Could not initiale buffered client: address udp///: unknown port. Falling back to a Noop Statsd client

Expected behavior:

Probably I'm missing something so if you have some tip how I can quiet down those errors I'd be glad to hear it.

Janus version: janus:3.8.7-rc.3 OS and version: Docker image

vgarvardt commented 5 years ago

Thank you for the feedback ad reported issues!

I found an issue with mongo and fix is in WIP (should be linked to the issue by github).

Regarding logs going to wrong pipe - we're trying to initialise the logger as early as possible, but it still happens after successful configuration loading. That means all the logs printed before this phase are printed in the default format and are printed to the default writer that is set to stderr. I'll try to make a workaround for this issue and set at least writer to a proper pipe as early as possible.

Stats backend initialisation falure is also something taht I'll look at.

quba commented 5 years ago

Hi,

is there any update on that? :)

vgarvardt commented 5 years ago

Just merged https://github.com/hellofresh/janus/pull/386 to solve mongo problem, logs destitation problem is still WIP

vgarvardt commented 5 years ago

And https://github.com/hellofresh/janus/pull/393 is merged as well, should fix the writer issue. Please feel free to re-open or report new. Thank you!