Skip to content

Commit d7cf16c

Browse files
authored
chore: Fix CI failures (#1101)
1 parent 927903e commit d7cf16c

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

sentry_sdk/integrations/django/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,9 @@ def _before_get_response(request):
332332
# Rely on WSGI middleware to start a trace
333333
try:
334334
if integration.transaction_style == "function_name":
335+
fn = resolve(request.path).func
335336
scope.transaction = transaction_from_function(
336-
resolve(request.path).func
337+
getattr(fn, "view_class", fn)
337338
)
338339
elif integration.transaction_style == "url":
339340
scope.transaction = LEGACY_RESOLVER.resolve(request.path_info)

sentry_sdk/integrations/flask.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,17 @@ def __init__(self, transaction_style="endpoint"):
6565
@staticmethod
6666
def setup_once():
6767
# type: () -> None
68+
69+
# This version parsing is absolutely naive but the alternative is to
70+
# import pkg_resources which slows down the SDK a lot.
6871
try:
6972
version = tuple(map(int, FLASK_VERSION.split(".")[:3]))
7073
except (ValueError, TypeError):
71-
raise DidNotEnable("Unparsable Flask version: {}".format(FLASK_VERSION))
72-
73-
if version < (0, 10):
74-
raise DidNotEnable("Flask 0.10 or newer is required.")
74+
# It's probably a release candidate, we assume it's fine.
75+
pass
76+
else:
77+
if version < (0, 10):
78+
raise DidNotEnable("Flask 0.10 or newer is required.")
7579

7680
request_started.connect(_request_started)
7781
got_request_exception.connect(_capture_exception)

tox.ini

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ envlist =
7676

7777
{py2.7,py3.7,py3.8,py3.9}-sqlalchemy-{1.2,1.3}
7878

79-
py3.7-spark
8079

8180
{py3.5,py3.6,py3.7,py3.8,py3.9}-pure_eval
8281

@@ -215,8 +214,6 @@ deps =
215214
sqlalchemy-1.2: sqlalchemy>=1.2,<1.3
216215
sqlalchemy-1.3: sqlalchemy>=1.3,<1.4
217216

218-
spark: pyspark==2.4.4
219-
220217
linters: -r linter-requirements.txt
221218

222219
py3.8: hypothesis
@@ -260,7 +257,6 @@ setenv =
260257
rediscluster: TESTPATH=tests/integrations/rediscluster
261258
asgi: TESTPATH=tests/integrations/asgi
262259
sqlalchemy: TESTPATH=tests/integrations/sqlalchemy
263-
spark: TESTPATH=tests/integrations/spark
264260
pure_eval: TESTPATH=tests/integrations/pure_eval
265261
chalice: TESTPATH=tests/integrations/chalice
266262
boto3: TESTPATH=tests/integrations/boto3

0 commit comments

Comments
 (0)