Change in Hub behavior from 1.x to 2.x
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.7.1
Steps to Reproduce
Run the following Python script, with Sentry SDK 2.7.1 installed. Then, rerun the same program with Sentry SDK 1.45.0 installed.
import sentry_sdk
my_hub_1 = sentry_sdk.Hub.current
my_hub_2 = sentry_sdk.Hub(sentry_sdk.Hub.current)
with my_hub_1.push_scope() as scope:
scope.set_tag("foo", "bar")
with my_hub_2.push_scope() as scope2:
scope2.set_tag("foo2", "bar2")
print(f"Hub 2 tags {my_hub_2.scope._tags}")
print(f"Hub 1 tags {my_hub_1.scope._tags}")
Expected Result
The output from using Sentry SDK 2.7.1 is the same as the output when we use SDK version 1.45.0.
Actual Result
The output with Sentry SDK 1.45.0 is:
Hub 2 tags {'foo2': 'bar2'}
Hub 1 tags {'foo': 'bar'}
But the output with Sentry SDK 2.7.1 is different:
Hub 2 tags {'foo': 'bar', 'foo2': 'bar2'}
Hub 1 tags {'foo': 'bar'}
The different output from Sentry SDK 2.7.1 indicates that 2.x Hub APIs are not fully backwards compatible with 1.x, as they should be.
From offline discussion, it seems that we expected to have some non-fully backwards compatible changes from 1.x to 2.x, so we will not fix this bug. However, we should mention in the migration guide that the Hub API is not fully backwards compatible