Skip to content

Commit

Permalink
Fix versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
spous-ovl committed Aug 14, 2024
1 parent 02cfed4 commit 82e7fa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion asgi_correlation_id/extensions/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def set_transaction_id(correlation_id: str) -> None:
which makes it easier to correlate logs to specific events.
"""
import sentry_sdk
from packaging import version

if sentry_sdk.VERSION >= '2.12.0':
if version.parse(sentry_sdk.VERSION) >= version.parse('2.12.0'):
scope = sentry_sdk.get_isolation_scope()
scope.set_tag('transaction_id', correlation_id)
else:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_extension_sentry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from unittest.mock import Mock
from packaging import version

import sentry_sdk

Expand All @@ -11,7 +12,7 @@ def test_sentry_sdk_installed(mocker):
"""
Check that the scope.set_tag method is called when Sentry is installed.
"""
if sentry_sdk.VERSION >= '2.12.0':
if version.parse(sentry_sdk.VERSION) >= version.parse('2.12.0'):
set_tag_mock = Mock()
scope_mock = Mock()
scope_mock.set_tag = set_tag_mock
Expand Down

0 comments on commit 82e7fa0

Please sign in to comment.