Skip to content

Commit

Permalink
Merge pull request #494 from hellohaptik/sentry_fixes
Browse files Browse the repository at this point in the history
Sentry setup configurational changes
  • Loading branch information
naseem-shaik authored Jul 21, 2022
2 parents 9b8d958 + 35732b2 commit b50e862
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions chatbot_ner/setup_sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,28 @@ def setup_sentry():
"""
if SENTRY_ENABLED:
import sentry_sdk
import logging
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.excepthook import ExcepthookIntegration

def before_sentry_send(event, hint):
if event.get('logger', None) == 'elasticapm.transport':
return None
event.setdefault("tags", {})["cas_name"] = CLIENT_APPLICATIONS_SETUP_NAME
return event

sentry_logging = LoggingIntegration(
level=logging.INFO,
event_level=logging.ERROR
)
sentry_exception = ExcepthookIntegration(
always_run=True
)
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[DjangoIntegration(), LoggingIntegration()],
integrations=[DjangoIntegration(), sentry_logging, sentry_exception],
environment=ENVIRONMENT,
sample_rate=0.1,
sample_rate=1.0,
before_send=before_sentry_send
)

0 comments on commit b50e862

Please sign in to comment.