feat: each error in Sentry names the commit it came from
The API image keeps the commit it was built from (RELEASE, from VCS_REF); the API, the worker and the browser report it as the Sentry release unless the stack sets IMAGE_TAG. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -117,6 +117,13 @@ def _traces_rate():
|
||||
return 0.0
|
||||
|
||||
|
||||
def release():
|
||||
"""The deploy this process runs: IMAGE_TAG when the stack sets one, else the
|
||||
commit the image was built from (RELEASE, from deploy/Dockerfile.api)."""
|
||||
value = os.environ.get('IMAGE_TAG') or os.environ.get('RELEASE') or ''
|
||||
return None if value in ('', 'unknown', 'latest') else value
|
||||
|
||||
|
||||
def init(component):
|
||||
"""Start Sentry for this process; False (and no imports) without a DSN."""
|
||||
dsn = os.environ.get('SENTRY_DSN_API', '').strip()
|
||||
@@ -130,7 +137,7 @@ def init(component):
|
||||
sentry_sdk.init(
|
||||
dsn=dsn,
|
||||
environment=environment,
|
||||
release=os.environ.get('IMAGE_TAG') or None,
|
||||
release=release(),
|
||||
send_default_pii=False,
|
||||
traces_sample_rate=_traces_rate(),
|
||||
before_send=scrub,
|
||||
|
||||
Reference in New Issue
Block a user