Skip to content

Commit 7b8239a

Browse files
committed
fix(flask): 2.3 deprecated the 'signals_available' and 2.4 will remove it
Signed-off-by: Ferenc Géczi <[email protected]>
1 parent 5748f0a commit 7b8239a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

instana/instrumentation/flask/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55

66
try:
77
import flask
8-
from flask.signals import signals_available
98

109
# `signals_available` indicates whether the Flask process is running with or without blinker support:
1110
# https://pypi.org/project/blinker/
1211
#
1312
# Blinker support is preferred but we do the best we can when it's not available.
1413
#
14+
flask_version = tuple(map(int, flask.__version__.split('.')))
15+
if flask_version < (2, 3, 0):
16+
from flask.signals import signals_available
17+
else:
18+
# Beginning from 2.3.0 as stated in the notes
19+
# https://flask.palletsprojects.com/en/2.3.x/changes/#version-2-3-0
20+
# "Signals are always available. blinker>=1.6.2 is a required dependency.
21+
# The signals_available attribute is deprecated. #5056"
22+
signals_available = True
1523

1624
from . import common
1725

0 commit comments

Comments
 (0)