Skip to content

Commit

Permalink
Merge pull request #9725 from keymanapp/chore/linux/sentrydetails
Browse files Browse the repository at this point in the history
chore(linux): Improve Sentry reports
  • Loading branch information
ermshiperete authored Oct 10, 2023
2 parents 1343829 + 1dd3eae commit 405f2e8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion linux/keyman-config/keyman_config/sentry_handling.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python3
import getpass
import hashlib
import importlib
import logging
import os
Expand Down Expand Up @@ -124,13 +125,24 @@ def _sentry_sdk_initialize(self):
integrations=[sentry_logging],
before_send=self._before_send
)
set_user({'id': hash(getpass.getuser())})
hash = hashlib.md5()
hash.update(getpass.getuser().encode())
set_user({'id': hash.hexdigest()})
with configure_scope() as scope:
scope.set_tag("app", os.path.basename(sys.argv[0]))
scope.set_tag("pkgversion", __pkgversion__)
scope.set_tag("platform", platform.platform())
scope.set_tag("system", platform.system())
scope.set_tag("tier", __tier__)
scope.set_tag("device", platform.node())
try:
os_release = platform.freedesktop_os_release()
scope.set_tag('os', os_release['PRETTY_NAME'])
scope.set_tag('os.name', os_release['NAME'])
if 'VERSION' in os_release:
scope.set_tag('os.version', os_release['VERSION'])
except OSError as e:
logging.debug(f'System does not have os_release file: {e.strerror}')
logging.info("Initialized Sentry error reporting")

def _raven_initialize(self):
Expand Down

0 comments on commit 405f2e8

Please sign in to comment.