Skip to content
Snippets Groups Projects

Added sentry SDK

Merged Neda Moeini requested to merge feature/add-sentry-sdk into develop
All threads resolved!
Files
4
+ 13
0
"""The main entrypoint for :term:`GSO`, and the different ways in which it can be run."""
"""The main entrypoint for :term:`GSO`, and the different ways in which it can be run."""
 
import os
 
 
import sentry_sdk
import typer
import typer
from orchestrator import OrchestratorCore, app_settings
from orchestrator import OrchestratorCore, app_settings
from orchestrator.cli.main import app as cli_app
from orchestrator.cli.main import app as cli_app
@@ -12,6 +15,7 @@ from gso.api import router as api_router
@@ -12,6 +15,7 @@ from gso.api import router as api_router
from gso.auth.oidc import oidc_instance
from gso.auth.oidc import oidc_instance
from gso.auth.opa import graphql_opa_instance, opa_instance
from gso.auth.opa import graphql_opa_instance, opa_instance
from gso.graphql_api.types import GSO_SCALAR_OVERRIDES
from gso.graphql_api.types import GSO_SCALAR_OVERRIDES
 
from gso.settings import load_oss_params
SCALAR_OVERRIDES.update(GSO_SCALAR_OVERRIDES)
SCALAR_OVERRIDES.update(GSO_SCALAR_OVERRIDES)
@@ -39,3 +43,12 @@ def init_cli_app() -> typer.Typer:
@@ -39,3 +43,12 @@ def init_cli_app() -> typer.Typer:
cli_app.add_typer(imports.app, name="import-cli")
cli_app.add_typer(imports.app, name="import-cli")
cli_app.add_typer(netbox.app, name="netbox-cli")
cli_app.add_typer(netbox.app, name="netbox-cli")
return cli_app()
return cli_app()
 
 
 
def init_sentry() -> None:
 
"""Only initialize Sentry if not in testing mode."""
 
if os.getenv("TESTING", "false").lower() == "false" and (sentry_config := load_oss_params().SENTRY):
 
sentry_sdk.init(dsn=sentry_config.DSN, environment=sentry_config.environment, traces_sample_rate=1.0)
 
 
 
init_sentry()
Loading