Commit b8befc5
committed
fix(flask): stop reading deprecated flask.__version__
Flask 3.1 deprecated the module-level __version__ attribute and emits a
DeprecationWarning on access; 3.2 will remove it. The Flask
instrumentor was hitting that warning at import time via
_IS_FLASK_31_PLUS = hasattr(flask, "__version__") and
package_version.parse(flask.__version__) >= package_version.parse("3.1.0")
even though it already computes the installed Flask version via
importlib.metadata.version("flask") a few lines below. Use that
flask_version for the 3.1+ check and drop the deprecated attribute
access entirely.
Fixes #4402
Signed-off-by: Ali <alliasgher123@gmail.com>1 parent a912524 commit b8befc5
2 files changed
Lines changed: 13 additions & 4 deletions
File tree
- instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | 304 | | |
309 | 305 | | |
310 | 306 | | |
| |||
314 | 310 | | |
315 | 311 | | |
316 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
317 | 316 | | |
318 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
319 | 323 | | |
320 | 324 | | |
321 | 325 | | |
| |||
0 commit comments