Skip to content
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

Add more debug logging #828

Merged
merged 11 commits into from
Aug 29, 2019
Merged

Add more debug logging #828

merged 11 commits into from
Aug 29, 2019

Conversation

arianvp
Copy link
Contributor

@arianvp arianvp commented Aug 14, 2019

This adds debug logs for operations that directly affect a user which are useful to have. when running in info log level, these actions aren't logged.

This is part 1 of a a series of pull requests.
In part 2 i'm planning to add a structured json log format (next to netstr and plan). Which should ease integration of log aggregators like fluent-bit.

I thought it's a good idea to get this part reviewed already as the second part is clearly standalone.

@arianvp arianvp requested a review from tiago-loureiro August 14, 2019 09:00
@arianvp arianvp requested review from tiago-loureiro and fisx August 22, 2019 12:36
Will log as soon as possible in the operation. Whether the operation
actually failed or not should be deduced from other sources.
There is no codepath where the argument to simpleSettings
is not isJust.

Also use qualified imports. bit more pretty
e.g. we're not logging the log level
@arianvp arianvp force-pushed the more-debug-logging branch from f7e424a to 3b98bd7 Compare August 23, 2019 15:11
@@ -42,6 +42,10 @@ createSettings (zusr ::: tid ::: req ::: _) = do
assertLegalHoldEnabled tid

membs <- Data.teamMembers tid
let zothers = map (view userId) membs
Log.debug $ Log.field "targets" (toByteString (show zothers))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Log.debug $ Log.field "targets" (toByteString (show zothers))
Log.debug $ Log.field "targets" (show $ toByteString <$> zothers)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(you're still using show on the Id type, which is fine for debugging, but the ToByteString instance is more concise.)

(speaking of which: why debug? are customers going to want to use this? then it should at least be Info.)

Copy link
Contributor

@tiago-loureiro tiago-loureiro Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do show . toByteString, toByteString is sufficient.
Also, how does the output of this line look like with multiple uuids?

Copy link
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to log all these details on debug level, but we may have to be more sophisticated than that in the future. Here, ideally we would want something like:

data LogFilter = LogFilter Level UseCase
data UseCase = MaxPrivacy | EnterpriseAuditable

@arianvp insists that colog would be a good replacement for tinylog, and I'm tempted... :-)

At least we should check that it's ok for the customers who want this to run with log level Debug for the foreseeable future. If so, we're good. If not, we should elaborate on this PR elsewhere.

@arianvp arianvp requested a review from fisx August 27, 2019 13:02
@@ -18,12 +18,19 @@ import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.ByteString.Lazy.Builder as B
import qualified System.Logger.Class as LC

-- TODO(arianvp): Get rid of boolean blindness
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These TODOs are removed in the next PR btw

@tiago-loureiro tiago-loureiro mentioned this pull request Aug 27, 2019
* Allow to set log format
The old netstrings option is now deprecated, use logFormat instead.
logFormat takes presedence of netstrings if both are set.
If none are set, log format defaults to Plain

* Implement json renderer for tinylog
@arianvp arianvp merged commit b5829a0 into develop Aug 29, 2019
@arianvp arianvp deleted the more-debug-logging branch August 29, 2019 13:28
jschaul pushed a commit that referenced this pull request Sep 2, 2019
* Add json logging and logging  (#828)  (#836)

* Add logs for team operations
* Add logging for legalhold

* Json logging (#836)

* Allow to set log format
The old netstrings option is now deprecated, use logFormat instead.
logFormat takes presedence of netstrings if both are set.
If none are set, log format defaults to Plain
* Implement json renderer for tinylog

* Specialize the error cases on conversation lookup. (#841)

Getting a conversation you left will now give 403 access-denied, not 404 not-found.

* Feature Flags in galley options. (#825)

* Feature flags in galley options file.

* Honour sso feature flag.

* Honour legalhold feature flag (test).

* Honour legalhold feature flag (handler).

* Disable all LH tests if feature is disabled.

* Check options settings for feature flag.

* Avoid catch-all pattern.

Catch-all patterns are not future-proof if constructors for new
falvors of "disabled" are added.
@fisx fisx mentioned this pull request Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants