Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
*.swp

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -104,4 +105,4 @@ certs/
.DS_Store
tmp/
# redis
dump.rdb
dump.rdb
13 changes: 13 additions & 0 deletions bin/bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def main():
handler = mod.Handler()
help_msg = getattr(handler, 'help', '')
parser = sub_parsers.add_parser(sub_cmd, help=help_msg)
# add sentry config
parser.add_argument(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

通过环境变量 SENTRY_URL 来设置就可以了

'--sentry_config',
type=str,
default='',
help='sentry config')
handler.add_arguments(parser)
parser.set_defaults(handler=handler)

Expand All @@ -56,6 +62,13 @@ def run(top_parser:ArgumentParser, input_args:Optional[List[str]]=None) -> None:
args = top_parser.parse_args(input_args)
loop = asyncio.get_event_loop()

sentry_config = args.sentry_config
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

通过环境变量 SENTRY_URL 来设置就可以了

if sentry_config:
sentry_sdk.init(
dsn=sentry_config,
integrations=[AioHttpIntegration()]
)

handler = getattr(args, 'handler', None)
if handler is None:
top_parser.print_help()
Expand Down