1
0
mirror of https://github.com/quay/quay.git synced 2025-11-16 11:42:27 +03:00

fix: resolve Sentry/OpenTelemetry integration conflicts (PROJQUAY-9198) (#4232)

* fix: resolve Sentry/OpenTelemetry integration conflicts

Configure Sentry to use minimal integrations when OTEL_TRACING is enabled
to prevent instrumentation conflicts that broke exception capture


---------

Co-authored-by: shudeshp <shudeshp@redhat.com>
This commit is contained in:
Shubhra Deshpande
2025-09-04 16:19:27 -04:00
committed by GitHub
parent c843bf2104
commit d0f45f545a
7 changed files with 174 additions and 42 deletions

View File

@@ -59,13 +59,17 @@ class TestExceptionLogSentry:
sentry = Sentry(mock_app)
# Verify Sentry SDK was initialized
mock_sentry_sdk.init.assert_called_once_with(
dsn="https://test@sentry.io/123",
environment="test",
traces_sample_rate=0.5,
profiles_sample_rate=0.3,
)
call_args = mock_sentry_sdk.init.call_args
assert call_args is not None
kwargs = call_args.kwargs
assert kwargs["dsn"] == "https://test@sentry.io/123"
assert kwargs["environment"] == "test"
assert kwargs["traces_sample_rate"] == 0.5
assert kwargs["profiles_sample_rate"] == 0.3
# Verify the SDK was called exactly once
assert mock_sentry_sdk.init.call_count == 1
# Verify the initialized Sentry SDK object is returned
assert sentry.state is mock_initialized_sentry
@@ -102,13 +106,19 @@ class TestExceptionLogSentry:
sentry = Sentry(mock_app)
# Verify default values are used
mock_sentry_sdk.init.assert_called_once_with(
dsn="https://test@sentry.io/123",
environment="production", # default
traces_sample_rate=0.1, # default
profiles_sample_rate=0.1, # default
)
# Verify default values are used - the SDK automatically adds additional parameters
call_args = mock_sentry_sdk.init.call_args
assert call_args is not None
# Check the required parameters we explicitly set
kwargs = call_args.kwargs
assert kwargs["dsn"] == "https://test@sentry.io/123"
assert kwargs["environment"] == "production" # default
assert kwargs["traces_sample_rate"] == 0.1 # default
assert kwargs["profiles_sample_rate"] == 0.1 # default
# Verify the SDK was called exactly once
assert mock_sentry_sdk.init.call_count == 1
# Verify the initialized Sentry SDK object is returned
assert sentry.state is mock_initialized_sentry
@@ -161,13 +171,19 @@ class TestExceptionLogSentry:
sentry = Sentry(mock_app)
# Verify Sentry SDK was initialized without any integrations
mock_sentry_sdk.init.assert_called_once_with(
dsn="https://test@sentry.io/123",
environment="test",
traces_sample_rate=0.1,
profiles_sample_rate=0.1,
)
# Verify Sentry SDK was initialized - the SDK automatically adds additional parameters
call_args = mock_sentry_sdk.init.call_args
assert call_args is not None
# Check the required parameters we explicitly set
kwargs = call_args.kwargs
assert kwargs["dsn"] == "https://test@sentry.io/123"
assert kwargs["environment"] == "test"
assert kwargs["traces_sample_rate"] == 0.1
assert kwargs["profiles_sample_rate"] == 0.1
# Verify the SDK was called exactly once
assert mock_sentry_sdk.init.call_count == 1
# Verify the initialized Sentry SDK object is returned
assert sentry.state is mock_initialized_sentry