-
Notifications
You must be signed in to change notification settings - Fork 0
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
Consistent logging #133
Consistent logging #133
Conversation
@julianbrost do you still want to return wrapped errors everywhere even though they're already logged, or is it fine the way it is? And as for the HTTP response messages, Alvar has already cleaned them up with #132, so I haven't done anything in that regard here. |
cf9bc95
to
50ef625
Compare
In general, I'd try to keep close to typical Go conventions regarding the returned errors. So that would be wrapping the errors even if we basically dismiss the message later on. Note that wrapping the error also isn't just about the message but also allows the proper use of functions like |
50ef625
to
24a1b9c
Compare
24a1b9c
to
9ca86f1
Compare
Maybe we could use this PR to also get rid of contractions. Currently, there is both "can't" as well as "cannot" in the code, and other contraction forms. A (most probably incomplete) This might not be part of the referenced issue, but fits the PR title very well. |
9ca86f1
to
5c417cf
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.
Within code - excluding comments - contractions there is still one "doesn't" in internal/filter/parser_test.go
on line 144.
Otherwise, next to the two small comments, the diff looks good to me.
f6e5a22
to
65de34e
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.
Sorry, I have missed this typo the other time.
Otherwise, looks good to me.
65de34e
to
0d4e144
Compare
0d4e144
to
6354fb6
Compare
Sorry! I had to adjust the time period entry a bit. |
I'm surprised by the number of times where |
That extra error message was supposed to be used by the listener as an HTTP response message, but since we don't want to expose such specific internal error messages to the clients, there is no need in keeping those extra error messages as they're always logged with the required additional contexts. |
6354fb6
to
ab34460
Compare
ab34460
to
f4058f2
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 don't really see the reason for rewording many of the messages. What rules are you trying to follow here or what are you trying to be consistent with? It's just a lot of places were the meaning of the messages is changed slightly and one has to check if the new message still describes what's happening. (I haven't looked at everything yet as I don't really get the point so far.)
f4058f2
to
271c0ba
Compare
It's used to be some Icinga Web notification rule |
befc658
to
aaa6879
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.
but since we don't want to expose such specific internal error messages to the clients
I'm surprised by the number of times where
return errors.New("[...]")
is replaced by justreturn err
without wrapping it with some extra context information.
If you do replace these basic errors with the full internal errors, they must not be sent to the HTTP client anymore. Instead, the clients should just receive some generic "internal error, see server log".
0436c16
to
0f27c35
Compare
Setting `10s` as a write timeout might not cause any problems when the request is processed successfully, but when we e.g. have to retry any database errors, which is `5m` by default, this will just in an i/o timeout and the listener won't event write any hints about that, but will silently abort the connections.
0f27c35
to
37376db
Compare
resolves #115