-
Notifications
You must be signed in to change notification settings - Fork 451
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 sentry #5735
Add sentry #5735
Conversation
DeepCode's analysis on #30b602 found:
Top issues
👉 View analysis in DeepCode’s Dashboard | Configure the bot |
68e4d4e
to
7b3f016
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.
Would you kindly run pre-commit
hooks to format the stuff using black
?
src/tribler-common/tribler_common/sentry_reporter/tests/test_sentry_reporter.py
Outdated
Show resolved
Hide resolved
src/tribler-common/tribler_common/sentry_reporter/tests/test_sentry_scrubber.py
Show resolved
Hide resolved
src/tribler-common/tribler_common/sentry_reporter/sentry_tools.py
Outdated
Show resolved
Hide resolved
src/tribler-common/tribler_common/sentry_reporter/tests/test_sentry_scrubber.py
Show resolved
Hide resolved
assert scrubber.scrub_entity_recursively({}) == {} | ||
assert scrubber.scrub_entity_recursively([]) == [] | ||
assert scrubber.scrub_entity_recursively('') == '' | ||
assert scrubber.scrub_entity_recursively(42) == 42 |
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.
🐬 👍 🐟
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.
🐳🌸
src/tribler-common/tribler_common/sentry_reporter/sentry_tools.py
Outdated
Show resolved
Hide resolved
sentry_url, | ||
release=None, | ||
# https://docs.sentry.io/platforms/python/configuration/integrations/ | ||
integrations=[ |
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.
As I understand it from Sentry documentation, logging integration is one of the default integrations which are enabled by default, so probably it is unnecessary to specify it explicitly:
https://docs.sentry.io/platforms/python/configuration/integrations/default-integrations/
https://docs.sentry.io/platforms/python/guides/logging/
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.
Yes, you a right, But now it is easy to configure levels of capturing information.
Otherwise, you need to spend some time reading documentation.
src/tribler-common/tribler_common/sentry_reporter/sentry_tools.py
Outdated
Show resolved
Hide resolved
src/tribler-common/tribler_common/sentry_reporter/sentry_reporter.py
Outdated
Show resolved
Hide resolved
src/tribler-common/tribler_common/sentry_reporter/sentry_reporter.py
Outdated
Show resolved
Hide resolved
src/tribler-common/tribler_common/sentry_reporter/tests/test_sentry_tools.py
Outdated
Show resolved
Hide resolved
src/tribler-common/tribler_common/sentry_reporter/sentry_reporter.py
Outdated
Show resolved
Hide resolved
@drew2a Could you update tribler/build/update_version_from_git.py Lines 35 to 37 in d89f5ca
|
@xoriole yes, sure! 👌 |
src/tribler-common/tribler_common/sentry_reporter/sentry_tools.py
Outdated
Show resolved
Hide resolved
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.
Personally, I still perceive 9-line comments and tests for trivial one-liners a waste of both the writer's and the reader's mental energy, exactly the thing Python was designed to avoid.
But we need this PR in 7.6.
p.s.
Be warned that I will remove excessive comments if I ever touch the said code 😈
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.
Thanks! 👍
@ichorid you are welcome :) |
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.
After the merge, please make sure to update the build jobs with the right sentry URL.
https://jenkins-ci.tribler.org/job/Build-Tribler_release/job/Build/
4198302
to
9cc33bb
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Resolves #5727
This PR adds Sentry support to Tribler Client.
The UX keeps unchanged.
The main concept: suppress (but store) all Sentry events until a user clicked on the "send report" button.
There are two new entities:
SentryReporter
(singleton) for managing work with SentrySentryScrubber
for scrubbing sensitive and redundant information.How it works
Basically, Sentry-based reporting works the same way the old Reporter did:
Protecting user identities
A user will now be assigned a unique pseudonym (e.g.Jonh Doe) based on the
hash
of theirpublic_key
.Note. The current implementation specifies user only for errors raised in the Core process, but it can be extended in the future.
Simplified python-friendly explanation
In the case of an error inside the GUI process, the event will be obtained directly in the GUI process.
After the user's click on the "sent report" button, the Sentry event will be sent to the server (
feedbackdialog.py
):Removing sensitive and redundant information
SentryScrubber
is the class responsible for scrubbing.It is calling on every Sentry's attempt to sent an event.
By using regex it scans all the necessary event fields and replaces real information with placeholders.
What is sensitive information:
What is redundant information:
Which fields will be affected by scrubbing:
Tests
This PR introduced the first tests for the
tribler-common
module.All the corresponding Jenkin's jobs have to be updated:
Thanks to @ichorid for contributing to the description.