Coverage for src/fastapi_cloud_cli/utils/sentry.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-11-09 00:25 +0000

1import sentry_sdk 1abcdefg

2from sentry_sdk.integrations.typer import TyperIntegration 1abcdefg

3 

4from fastapi_cloud_cli.utils.auth import Identity 1abcdefg

5 

6SENTRY_DSN = "https://230250605ea4b58a0b69c768e9ec1168@o4506985151856640.ingest.us.sentry.io/4508449198899200" 1abcdefg

7 

8 

9def init_sentry() -> None: 1abcdefg

10 """Initialize Sentry error tracking only if user is logged in or has a deploy token.""" 

11 identity = Identity() 1ahijbklmcnopdqrsetuvfwxygzAB

12 

13 if not (identity.is_logged_in() or identity.has_deploy_token()): 1ahijbklmcnopdqrsetuvfwxygzAB

14 return 1ajbmcpdsevfygB

15 

16 sentry_sdk.init( 1hiklnoqrtuwxzA

17 dsn=SENTRY_DSN, 

18 integrations=[TyperIntegration()], 

19 send_default_pii=False, 

20 )