Skip to content

Commit

Permalink
Update Sentry SDK to support Falcon 3
Browse files Browse the repository at this point in the history
Signed-off-by: Bradley Reynolds <bradley.reynolds@darbia.dev>
  • Loading branch information
shenanigansd authored Mar 13, 2023
1 parent 671f8d5 commit 9acc6f5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 49 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ dynamic = ["version"]

requires-python = ">=3.11"
dependencies = [
# Sentry's Falcon integration relies on api_helpers (falconry/falcon#1902).
"falcon>=3.0.1",
"jsonschema>=4.0",
"protobuf>=3.19",
]

[project.optional-dependencies]
gunicorn = ["gunicorn>=20.1"] # Lowest which supports wsgi_app in config.
sentry = ["sentry-sdk[falcon]>=1.5.4"]
sentry = ["sentry-sdk[falcon]>=1.16.0"] # Minimum of 1.16.0 required for Falcon 3.0 support (getsentry/sentry-python#1733)

[project.urls]
source = "https://github.com/python-discord/snekbox"
Expand Down
6 changes: 3 additions & 3 deletions requirements/coverage.pip
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with python 3.11
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements/coverage.pip requirements/coverage.in
#
coverage[toml]==6.5.0
coverage[toml]==7.2.1
# via -r requirements/coverage.in
16 changes: 7 additions & 9 deletions requirements/lint.pip
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
#
# This file is autogenerated by pip-compile with python 3.11
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements/lint.pip requirements/lint.in
#
cfgv==3.3.1
# via pre-commit
distlib==0.3.6
# via virtualenv
filelock==3.8.0
filelock==3.9.0
# via virtualenv
identify==2.5.8
identify==2.5.20
# via pre-commit
nodeenv==1.7.0
# via pre-commit
platformdirs==2.5.2
platformdirs==3.1.1
# via virtualenv
pre-commit==2.20.0
pre-commit==3.1.1
# via -r requirements/lint.in
pyyaml==6.0
# via pre-commit
toml==0.10.2
# via pre-commit
virtualenv==20.16.6
virtualenv==20.21.0
# via pre-commit

# The following packages are considered to be unsafe in a requirements file:
Expand Down
22 changes: 8 additions & 14 deletions requirements/pip-tools.pip
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
#
# This file is autogenerated by pip-compile with python 3.11
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements/pip-tools.pip requirements/pip-tools.in
#
build==0.9.0
build==0.10.0
# via pip-tools
click==8.1.3
# via pip-tools
colorama==0.4.6
# via
# build
# click
packaging==21.3
packaging==23.0
# via build
pep517==0.13.0
# via build
pip-tools==6.9.0
pip-tools==6.12.3
# via -r requirements/pip-tools.in
pyparsing==3.0.9
# via packaging
wheel==0.37.1
pyproject-hooks==1.0.0
# via build
wheel==0.38.4
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
20 changes: 10 additions & 10 deletions requirements/requirements.pip
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#
# This file is autogenerated by pip-compile with python 3.11
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=gunicorn --extra=sentry --output-file=requirements/requirements.pip pyproject.toml
#
attrs==22.1.0
attrs==22.2.0
# via jsonschema
certifi==2022.9.24
certifi==2022.12.7
# via sentry-sdk
falcon==3.1.0
falcon==3.1.1
# via
# sentry-sdk
# snekbox (pyproject.toml)
gunicorn==20.1.0
# via snekbox (pyproject.toml)
jsonschema==4.16.0
jsonschema==4.17.3
# via snekbox (pyproject.toml)
protobuf==4.21.9
protobuf==4.22.1
# via snekbox (pyproject.toml)
pyrsistent==0.19.1
pyrsistent==0.19.3
# via jsonschema
sentry-sdk[falcon]==1.10.1
sentry-sdk[falcon]==1.16.0
# via snekbox (pyproject.toml)
urllib3==1.26.12
urllib3==1.26.15
# via sentry-sdk

# The following packages are considered to be unsafe in a requirements file:
Expand Down
16 changes: 5 additions & 11 deletions snekbox/utils/logging.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import logging
import os
import sys
import warnings

from falcon.util.deprecation import DeprecatedWarning

__all__ = ("FORMAT", "init_logger", "init_sentry")

Expand All @@ -24,14 +21,11 @@ def init_logger(debug: bool) -> None:

def init_sentry(version: str) -> None:
"""Initialise the Sentry SDK if it's installed."""
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message=r".*\bapi_helpers\b", category=DeprecatedWarning)

try:
import sentry_sdk
from sentry_sdk.integrations.falcon import FalconIntegration
except ImportError:
return
try:
import sentry_sdk
from sentry_sdk.integrations.falcon import FalconIntegration
except ImportError:
return

sentry_sdk.init(
dsn=os.environ.get("SNEKBOX_SENTRY_DSN", ""),
Expand Down

0 comments on commit 9acc6f5

Please sign in to comment.