Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Bugs with Sentry configuration #398

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eligibility_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

# use an app context for access to config settings
with app.app_context():
sentry.configure(config)
# configure root logger first, to prevent duplicate log entries from Flask's logger
logging.basicConfig(level=config.log_level, format=format_string)
# configure Flask's logger
app.logger.setLevel(config.log_level)
default_handler.formatter = logging.Formatter(format_string)
sentry.configure(config)
app.logger.info(f"Starting Eligibility Server {__version__}")


Expand Down
9 changes: 2 additions & 7 deletions eligibility_server/sentry.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import logging
import os
import subprocess

import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.scrubber import EventScrubber, DEFAULT_DENYLIST

from eligibility_server import __version__
from eligibility_server.settings import Configuration

logger = logging.getLogger(__name__)
Expand All @@ -14,13 +14,8 @@
SENTRY_ENVIRONMENT = os.environ.get("SENTRY_ENVIRONMENT", "local")


# https://stackoverflow.com/a/21901260/358804
def get_git_revision_hash():
return subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip()


def get_release() -> str:
return get_git_revision_hash()
return __version__


def get_denylist():
Expand Down
Loading