Skip to content

Commit

Permalink
Merge pull request #5735 from drew2a/add_sentry
Browse files Browse the repository at this point in the history
Add sentry
  • Loading branch information
drew2a committed Nov 24, 2020
2 parents 76037b8 + 30b602d commit 2924131
Show file tree
Hide file tree
Showing 19 changed files with 1,210 additions and 35 deletions.
16 changes: 14 additions & 2 deletions build/update_version_from_git.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

import logging
import os
import sys
from os import linesep, path
from subprocess import PIPE, Popen
Expand Down Expand Up @@ -28,13 +29,24 @@ def run_command(cmd):
commit_id = run_command(cmd).strip()[1:].replace("'", "")
logger.info("Commit: %s", commit_id)

sentry_url = os.environ.get('SENTRY_URL', None)
logger.info(f'Sentry url: {sentry_url}')
if not sentry_url:
logger.critical('Sentry url is not defined. To define sentry url use:'
'EXPORT SENTRY_URL=<sentry_url>')
sys.exit(1)

build_date = ctime()
logger.info("Build date: %s", build_date)

logger.info('Writing runtime version info.')
with open(path.join('src', 'tribler-core', 'tribler_core', 'version.py'), 'w') as f:
f.write('version_id = "%s"%sbuild_date = "%s"%scommit_id = "%s"%s' %
(version_id, linesep, build_date, linesep, commit_id, linesep))
f.write(
f'version_id = "{version_id}"{linesep}'
f'build_date = "{build_date}"{linesep}'
f'commit_id = "{commit_id}"{linesep}'
f'sentry_url = "{sentry_url}"{linesep}'
)

with open('.TriblerVersion', 'w') as f:
f.write(version_id)
Expand Down
5 changes: 5 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ Export to PYTHONPATH the following directories:
* tribler-core
* tribler-gui

Shortcut for macOS:
```shell script
export PYTHONPATH=${PYTHONPATH}:`echo {pyipv8,tribler-common,tribler-core,tribler-gui} | tr " " :`
```
Execute:
```
python3 -m pytest tribler-core
python3 -m pytest tribler-common
python3 -m pytest tribler-gui --guitests
```
2 changes: 2 additions & 0 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ aiohttp
aiohttp_apispec
pyyaml
marshmallow
sentry_sdk
Faker
Pillow
netifaces
pyqtgraph
Expand Down
8 changes: 7 additions & 1 deletion src/run_tribler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import sys
from asyncio import ensure_future, get_event_loop

from tribler_common.sentry_reporter.sentry_reporter import SentryReporter
from tribler_common.sentry_reporter.sentry_scrubber import SentryScrubber

import tribler_core
from tribler_core.config.tribler_config import CONFIG_FILENAME
from tribler_core.dependencies import check_for_missing_dependencies
from tribler_core.upgrade.version_manager import fork_state_directory_if_necessary, get_versioned_state_directory
from tribler_core.utilities.osutils import get_root_state_directory
from tribler_core.version import version_id
from tribler_core.version import sentry_url, version_id

import tribler_gui

Expand Down Expand Up @@ -86,6 +89,9 @@ async def start_tribler():


if __name__ == "__main__":
SentryReporter.init(sentry_url=sentry_url, scrubber=SentryScrubber())
SentryReporter.allow_sending_globally(False, 'run_tribler.__main__()')

# Get root state directory (e.g. from environment variable or from system default)
root_state_dir = get_root_state_directory()

Expand Down

0 comments on commit 2924131

Please sign in to comment.