Skip to content

Commit

Permalink
Adding Sentry Error Monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBoatyMcBoatFace committed Aug 10, 2023
1 parent 9df2818 commit e64f7d8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from app.api.metrics.views import metrics_bp
from app.api.utils import start_scheduled_jobs
from app.logging import logger
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration

load_dotenv()

Expand Down Expand Up @@ -50,10 +52,25 @@ def configure_pyroscope():
logger.info('Pyroscope Configured')


def traces_sampler(sampling_context):
# Customize your sampling logic here if needed
# return a number between 0 and 1 or a boolean
return 1.0


def configure_sentry():
sentry_sdk.init(
dsn=os.getenv("SENTRY_DSN_REPORTS"),
integrations=[FlaskIntegration()],
traces_sample_rate=1.0,
traces_sampler=traces_sampler # Optional if you want dynamic sampling
)


def startup():
configure_pyroscope()
configure_sentry()
logger.info('Sentry Configured')
logger.info('Starting Scheduled Jobs')
start_scheduled_jobs()
logger.info('Scheduled Jobs Started')
1 change: 1 addition & 0 deletions app/api/metrics/a11yscore/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ def impact_a11yscores(impact,score_data):
return score

return None

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pytz==2023.3
PyYAML==6.0
requests==2.31.0
rich==13.4.2
sentry-sdk==1.29.2
six==1.16.0
sniffio==1.3.0
SQLAlchemy==2.0.17
Expand Down

0 comments on commit e64f7d8

Please sign in to comment.