Add sentry support
Some checks failed
ci/woodpecker/push/check Pipeline failed

This commit is contained in:
2025-05-18 21:14:57 +02:00
parent 7033a18a64
commit 65c577ab03
5 changed files with 326 additions and 277 deletions

View File

@@ -79,6 +79,11 @@ class _DatabaseConfig(BaseModel):
return cast(str, self.uri_plain)
class _SentryConfig(BaseModel):
# The Sentry DSN.
dsn: str
class _Config(BaseModel):
# Database config
database: _DatabaseConfig
@@ -86,6 +91,9 @@ class _Config(BaseModel):
# Component configuration
component: _ComponentConfig
# Optional Sentry config
sentry: _SentryConfig | None
@cache
def load_config() -> _Config:

View File

@@ -30,6 +30,16 @@ def startup():
engine = app.dependency_overrides.get(get_engine, get_engine)(config)
SQLModel.metadata.create_all(engine)
if config.sentry is not None:
logging.getLogger("root").info("Setting up Sentry")
import sentry_sdk
sentry_sdk.init(
config.sentry.dsn,
send_default_pii=True,
max_request_body_size="always",
traces_sample_rate=0,
)
# App startup is done. Connect to the XMPP server
instance = XmppApiComponent.of(config)
instance.run()