diff --git a/.gitignore b/.gitignore index d7082bf..ea717fa 100644 --- a/.gitignore +++ b/.gitignore @@ -116,3 +116,4 @@ webpack-stats.json # Other .DS_Store +/key.pem diff --git a/fbr/settings.py b/fbr/settings.py index 1575112..5c26cbc 100644 --- a/fbr/settings.py +++ b/fbr/settings.py @@ -47,10 +47,15 @@ ) # Only init sentry if the SENTRY_DSN is provided +# TODO: add SENTRY_TRACES_SAMPLE_RATE to secrets default value of 0.0 # Sentry set up: SENTRY_DSN = os.environ.get("SENTRY_DSN", None) if SENTRY_DSN: - sentry_sdk.init(dsn=SENTRY_DSN, integrations=[DjangoIntegration()]) + sentry_sdk.init( + dsn=SENTRY_DSN, + integrations=[DjangoIntegration()], + traces_sample_rate=env("SENTRY_TRACES_SAMPLE_RATE", default=1.0), + ) logging.getLogger(__name__).info("SENTRY_DSN set. Sentry is enabled.") else: logging.getLogger(__name__).info("SENTRY_DSN not set. Sentry is disabled.") @@ -286,18 +291,6 @@ }, } -if SENTRY_DSN: - logging.getLogger(__name__).info("added sentry to logging config") - LOGGING["loggers"]["sentry_sdk"] = { - "level": "ERROR", - "handlers": ["asim"], - "propagate": False, - } -else: - logging.getLogger(__name__).info( - "sentry not enabled. skipping sentry logging config" - ) - # Django Log Formatter ASIM settings # See https://github.com/uktrade/django-log-formatter-asim#settings DLFA_TRACE_HEADERS = ("X-B3-TraceId", "X-B3-SpanId")