Exception logging
Description of the proposal
I made this MR: !17819 (merged) that adds
exceptions_json.log
that persists all exceptions that are requested by developer via
usage of Gitlab::Sentry:
.
This was added to solve a problem of manual exception logging done in number of places of the codebase:
-
app/services/clusters/applications/base_helm_service.rb:27
, -
lib/gitlab/bitbucket_import/importer.rb:47
, -
lib/gitlab/bitbucket_server_import/importer.rb:167
, - etc.
The proposal would be to disallow all manual exception logging, and require to only use
Gitlab::Sentry.track_exception*
variants. This would send exception to Sentry (if configured),
and log to json file (always).
Having a structured logging actually allows the persistence of exception be useful as:
- we always clean backtrace,
- we always include correlation id,
- we can include some user details,
- later we could include information about execution context, like currently running
sidekiq
job.
I still wonder about the ability to have a RuboCop
to prevent that, but I have no idea yet.
Maybe discovering what is being executed in rescue
block, idk.
-
Mention the proposal in the next backend weekly call and the #backend channel to encourage contribution -
Proceed with the proposal once 50% of the maintainers have weighed in, and 80% of the votes are 👍 -
Once approved, mention it again in the next backend weekly call and the #backend channel
Edited by Kamil Trzciński