Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7437574
D2572.id9200.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D2572.id9200.diff
View Options
diff --git a/swh/core/api/tests/test_gunicorn.py b/swh/core/api/tests/test_gunicorn.py
--- a/swh/core/api/tests/test_gunicorn.py
+++ b/swh/core/api/tests/test_gunicorn.py
@@ -30,6 +30,7 @@
integrations=[flask_integration],
debug=False,
release=None,
+ environment=None,
)
@@ -39,6 +40,7 @@
new=lambda: flask_integration):
with patch('sentry_sdk.init') as sentry_sdk_init:
with patch.dict(os.environ, {'SWH_SENTRY_DSN': 'test_dsn',
+ 'SWH_SENTRY_ENVIRONMENT': 'tests',
'SWH_MAIN_PACKAGE': 'swh.core'}):
gunicorn_config.post_fork(None, None)
@@ -49,6 +51,7 @@
integrations=[flask_integration],
debug=False,
release='swh.core@' + version,
+ environment='tests',
)
@@ -66,6 +69,7 @@
integrations=[flask_integration],
debug=True,
release=None,
+ environment=None,
)
@@ -79,6 +83,7 @@
integrations=[],
debug=False,
release=None,
+ environment=None,
)
@@ -98,4 +103,5 @@
debug=False,
bar='baz',
release=None,
+ environment=None,
)
diff --git a/swh/core/sentry.py b/swh/core/sentry.py
--- a/swh/core/sentry.py
+++ b/swh/core/sentry.py
@@ -22,12 +22,14 @@
if debug is None:
debug = bool(os.environ.get('SWH_SENTRY_DEBUG'))
sentry_dsn = sentry_dsn or os.environ.get('SWH_SENTRY_DSN')
+ environment = os.environ.get('SWH_SENTRY_ENVIRONMENT')
if sentry_dsn:
import sentry_sdk
sentry_sdk.init(
release=get_sentry_release(),
+ environment=environment,
dsn=sentry_dsn,
integrations=integrations,
debug=debug,
diff --git a/swh/core/tests/test_cli.py b/swh/core/tests/test_cli.py
--- a/swh/core/tests/test_cli.py
+++ b/swh/core/tests/test_cli.py
@@ -114,6 +114,7 @@
debug=False,
integrations=[],
release=None,
+ environment=None,
)
@@ -134,6 +135,7 @@
debug=True,
integrations=[],
release=None,
+ environment=None,
)
@@ -158,6 +160,7 @@
debug=True,
integrations=[],
release=None,
+ environment=None,
)
@@ -172,6 +175,7 @@
env = {
'SWH_SENTRY_DSN': 'test_dsn',
'SWH_MAIN_PACKAGE': 'swh.core',
+ 'SWH_SENTRY_ENVIRONMENT': 'tests',
}
result = runner.invoke(
swhmain, ['test'], env=env, auto_envvar_prefix='SWH')
@@ -185,6 +189,7 @@
debug=False,
integrations=[],
release='swh.core@' + version,
+ environment='tests',
)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 14, 1:03 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223143
Attached To
D2572: Add environment variable $SWH_SENTRY_ENVIRONMENT
Event Timeline
Log In to Comment