Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope refactoring (merge Hubs and Scopes) #2610

Merged
merged 333 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
333 commits
Select commit Hold shift + click to select a range
b8acdae
Removed old _merge_scopes (lives now in Scope())
antonpirker Jan 23, 2024
3cca8be
Fix
antonpirker Jan 23, 2024
af54208
Added some tests
antonpirker Jan 23, 2024
7366818
Added tests
antonpirker Jan 23, 2024
9ad022b
Apply suggestions from code review
antonpirker Jan 23, 2024
699ef78
Fixing stuff
antonpirker Jan 23, 2024
55a9f4f
Improved Client inheritance
antonpirker Jan 23, 2024
09737e1
Removed useless code
antonpirker Jan 23, 2024
b150a79
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 24, 2024
5bb2f56
Fixed threading integration to use new Scopes
antonpirker Jan 24, 2024
8594832
Fixed import
antonpirker Jan 24, 2024
0c47518
Removed useless context copying
antonpirker Jan 24, 2024
01b663a
Fixed import
antonpirker Jan 24, 2024
86fa839
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 24, 2024
50afa9d
Added more tests
antonpirker Jan 24, 2024
c16be2b
Sorted __all__
antonpirker Jan 24, 2024
9115743
Deletion of thread local vars is not possible in older Python
antonpirker Jan 25, 2024
70b3d99
Fixed deletion of thread local var in Python 3.6+
antonpirker Jan 25, 2024
8eeeed3
Merge branch 'master' into feat/new-scopes
antonpirker Jan 25, 2024
9952097
Merge branch 'feat/new-scopes' into new-scopes-add-api
antonpirker Jan 25, 2024
39ceeea
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 25, 2024
a8f98b2
Merge branch 'master' into new-scopes-add-api
antonpirker Jan 25, 2024
059f051
Fixed docstring
antonpirker Jan 25, 2024
b027411
Fixed docstring
antonpirker Jan 25, 2024
8c4fddc
Fixed imports
antonpirker Jan 25, 2024
4d884e9
Back to normal delete of context var.
antonpirker Jan 25, 2024
1c1b911
Delete from the underlying __dict__. This is ok according to the docs.
antonpirker Jan 25, 2024
abd7c37
deactivated tests to try something
antonpirker Jan 25, 2024
3420b24
enable one test
antonpirker Jan 25, 2024
668a7a4
Enabled more tests
antonpirker Jan 25, 2024
95302bd
Another two tests
antonpirker Jan 25, 2024
c54ca92
one gone again
antonpirker Jan 25, 2024
efffd01
and testing the other one
antonpirker Jan 25, 2024
81eea9a
Check first test
antonpirker Jan 25, 2024
e957fdb
If this is green now, i am back to square one.
antonpirker Jan 25, 2024
f2ee7c4
this is weird
antonpirker Jan 25, 2024
8ed4e34
one more test
antonpirker Jan 25, 2024
e73d85c
forking more test
antonpirker Jan 25, 2024
1c96e1f
more forking
antonpirker Jan 25, 2024
753620a
Cleanup
antonpirker Jan 25, 2024
0172098
Made ScopeType an enum
antonpirker Jan 25, 2024
f82bb36
Improved test asserts
antonpirker Jan 25, 2024
387f433
Fixed typing
antonpirker Jan 25, 2024
59a2aed
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 26, 2024
4d747d6
Moved _copy_on_write to other PR. Makes more sense there because we c…
antonpirker Jan 26, 2024
c4a7cb2
typing
antonpirker Jan 26, 2024
7ee62ba
Some tests for scope forking and copy on write
antonpirker Jan 26, 2024
cb27c4c
linting
antonpirker Jan 26, 2024
327fcd3
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 26, 2024
565fdd8
Reformatting
antonpirker Jan 26, 2024
9ae58ee
reformat
antonpirker Jan 26, 2024
4e9a596
imports
antonpirker Jan 26, 2024
7a22de1
Merge branch 'master' into new-scopes-add-api
antonpirker Jan 26, 2024
0fad961
Added copy on write decorator everywhere
antonpirker Jan 29, 2024
e053623
small copy on write fixes
antonpirker Jan 29, 2024
9a9c8b1
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 29, 2024
fca14a3
Update test matrix
antonpirker Jan 29, 2024
3141eaa
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 29, 2024
046ff44
updated apidocs
antonpirker Jan 29, 2024
041e004
updated apidocs
antonpirker Jan 29, 2024
770e815
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Jan 29, 2024
f2e0c01
Fixed some tests
antonpirker Jan 29, 2024
ace228c
formatting
antonpirker Jan 29, 2024
ff85ada
Fixed test
antonpirker Jan 30, 2024
9f43dc1
Fixed span creation in asyncio
antonpirker Jan 30, 2024
374592c
Always returning a client (breaking backwards compatibility)
antonpirker Jan 31, 2024
ca6fd9d
Fix push scope
antonpirker Jan 31, 2024
e3bc7d2
Made client Noneable again (sentry does something fishy with the clie…
antonpirker Jan 31, 2024
3b5085e
Fix backwards compatibility
antonpirker Feb 1, 2024
584dba8
Fixed some test dependencies
antonpirker Feb 1, 2024
d07bc6b
Also copy the new _type property
antonpirker Feb 1, 2024
0384bb1
debug output
antonpirker Feb 1, 2024
54e9dc0
reset version name
antonpirker Feb 1, 2024
d2dda2d
debug
antonpirker Feb 1, 2024
be7f45d
.
antonpirker Feb 1, 2024
0d339eb
cleanup
antonpirker Feb 1, 2024
aa1ed5c
Removed useless __init__ function
antonpirker Feb 1, 2024
f63dfab
Merge branch 'new-scopes-call-api' of github.com:getsentry/sentry-pyt…
antonpirker Feb 2, 2024
e73980c
Make hub cloning and using hub as context manager work
antonpirker Feb 5, 2024
aae2b9b
Fixed auto session tracking
antonpirker Feb 5, 2024
c5f8a24
cleanup
antonpirker Feb 5, 2024
689ad15
Cleanup
antonpirker Feb 5, 2024
36a1aab
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Feb 5, 2024
d5a3c49
Replaced push_scope with configure_scope
antonpirker Feb 5, 2024
51fe293
Fix push_scope
antonpirker Feb 5, 2024
d9456fb
Deactivate one Pyramid test and document why (also added to migration…
antonpirker Feb 6, 2024
954bc70
Fork process for test to not bleed data between tests
antonpirker Feb 6, 2024
5960e8a
Fork processes for otel tests to not bleed data
antonpirker Feb 6, 2024
04eea25
Fix transport test
antonpirker Feb 6, 2024
40e6ea5
capture exception from current scope
antonpirker Feb 6, 2024
137952f
own process for test
antonpirker Feb 6, 2024
e0e1738
Deactivated some tests that are not valid anymore
antonpirker Feb 6, 2024
ed49a91
Fixed some tests
antonpirker Feb 6, 2024
74fee8d
Fixed some tests
antonpirker Feb 6, 2024
19736b6
Improved tests
antonpirker Feb 6, 2024
4128f8f
Skipping some tests in old pythons
antonpirker Feb 6, 2024
daa27d2
Formatting
antonpirker Feb 6, 2024
d7a2b17
some linting
antonpirker Feb 6, 2024
47c973e
Merge branch 'master' into new-scopes-add-api
antonpirker Feb 6, 2024
d6d51b7
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Feb 6, 2024
d3917e0
formatting
antonpirker Feb 6, 2024
d473f15
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Feb 6, 2024
832c98e
typing
antonpirker Feb 6, 2024
ec45fb4
Cleaned up some imports
antonpirker Feb 6, 2024
c92a02d
Fixed circular import
antonpirker Feb 6, 2024
fd2a775
whitespace
antonpirker Feb 6, 2024
bbed204
Fixed AWS Lambda tests
antonpirker Feb 6, 2024
19af46f
Trying something
antonpirker Feb 6, 2024
bbfda42
did not work.
antonpirker Feb 7, 2024
c19d2de
better test data
antonpirker Feb 7, 2024
de33075
Needed to update assert
antonpirker Feb 7, 2024
f26f96c
oh
antonpirker Feb 7, 2024
7189e5e
Merge branch 'feature/new-scopes' into new-scopes-add-api
antonpirker Feb 7, 2024
cd9f330
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Feb 7, 2024
4576c72
This should work now as is.
antonpirker Feb 7, 2024
05dd8f3
imports
antonpirker Feb 7, 2024
f6cb4ef
Update sentry_sdk/scope.py
antonpirker Feb 12, 2024
89089c3
Update sentry_sdk/tracing_utils.py
antonpirker Feb 12, 2024
72365d4
Renamed NoopClient to NonRecordingClient to be more like otel
antonpirker Feb 12, 2024
ae39a43
Added some comments
antonpirker Feb 12, 2024
f908fe8
Added the right version number
antonpirker Feb 12, 2024
9247623
Added universal lock and use it when changing the global scope
antonpirker Feb 12, 2024
6be5e5f
Added tests for UniversalLock
antonpirker Feb 12, 2024
3b3537f
Made properties of BaseClient actual properties, not class vars
antonpirker Feb 12, 2024
27522d0
Fixed default value
antonpirker Feb 12, 2024
a821b93
Do not call async tests in python 2
antonpirker Feb 12, 2024
fcb3f68
Make it run in old python
antonpirker Feb 12, 2024
161a1ac
Make it work with old python
antonpirker Feb 12, 2024
b7c0db5
Make api consistent
antonpirker Feb 12, 2024
56b266b
Removed useless universal lock, because locking is not the responsibi…
antonpirker Feb 12, 2024
f7f8d42
Apply suggestions from code review
antonpirker Feb 12, 2024
7e76fd1
Explanatory comment
antonpirker Feb 13, 2024
ddfa91c
Merge branch 'new-scopes-call-api' of github.com:getsentry/sentry-pyt…
antonpirker Feb 13, 2024
5fb44ad
Removed test because it tests an outdated concept
antonpirker Feb 13, 2024
987bb5c
Not commenting out tests, but skipping them.
antonpirker Feb 13, 2024
b57cde6
Prevent infinite recursion by using default options.
antonpirker Feb 13, 2024
90d8d20
Merge branch 'new-scopes-add-api' of github.com:getsentry/sentry-pyth…
antonpirker Feb 13, 2024
be14473
Merge branch 'new-scopes-add-api' into new-scopes-call-api
antonpirker Feb 13, 2024
2b8deec
Removed copy_on_write functionality
antonpirker Feb 13, 2024
8590a1f
Updated SentryWSGIMiddleware to use new scope API
antonpirker Feb 13, 2024
d651a98
Show me the tests that are failing
antonpirker Feb 13, 2024
3674cca
Made it possible to use custom isolation scope
antonpirker Feb 13, 2024
61c3e44
Made scope context manager accept a scope
antonpirker Feb 13, 2024
26c0374
naming things is hard
antonpirker Feb 13, 2024
d4c0ef1
Removed isolate()
antonpirker Feb 13, 2024
ac8b14e
Removed test for isolate()
antonpirker Feb 13, 2024
8bbcd26
Fixed capture_event parameters in conftest
antonpirker Feb 13, 2024
9f2a852
Merge branch 'feature/new-scopes' into new-scopes-call-api
antonpirker Feb 13, 2024
78bff37
Removed copy_context to have less code
antonpirker Feb 14, 2024
359627f
better readability
antonpirker Feb 14, 2024
518986c
Cleanup
antonpirker Feb 14, 2024
15f340a
Fixed test
antonpirker Feb 14, 2024
898a4db
apidocs
antonpirker Feb 14, 2024
1a6bc4f
apidocs
antonpirker Feb 14, 2024
82632df
Cleaned up public API
antonpirker Feb 14, 2024
0c14609
Cleanup tests
antonpirker Feb 14, 2024
40b313f
apidocs
antonpirker Feb 14, 2024
f1dc99c
apidocs
antonpirker Feb 14, 2024
4934d8f
Added deprecation messages
antonpirker Feb 14, 2024
5139e2d
Updated some tests
antonpirker Feb 14, 2024
3090278
Fixed test
antonpirker Feb 14, 2024
e7344a4
Merge branch 'sentry-sdk-2.0' into new-scopes-call-api
antonpirker Feb 14, 2024
c46fd50
text fix
antonpirker Feb 14, 2024
15a23bd
Update isolation scope context manager to only to one thing
antonpirker Feb 15, 2024
ccc3b4b
formatting
antonpirker Feb 15, 2024
ac6dd6f
Revert "formatting"
antonpirker Feb 15, 2024
0ef0cd7
formatting again
antonpirker Feb 15, 2024
840b26f
Move some toplevel apis from hub to scope
antonpirker Feb 15, 2024
b2ce761
Moved more top level api to scope
antonpirker Feb 15, 2024
3d6ba08
Fixed clickhouse
antonpirker Feb 15, 2024
d5095aa
Fixed capture_event for scope
antonpirker Feb 15, 2024
0927abb
Moved last top level api away from Hub
antonpirker Feb 15, 2024
003e737
Removed deprecation warnings
antonpirker Feb 15, 2024
c5a4388
Make threading integration behave like it did before
antonpirker Feb 15, 2024
a84ca7d
Removed because threading integration behaves now like before
antonpirker Feb 15, 2024
2515ee4
formatting
antonpirker Feb 15, 2024
df2caf7
now it works (tm)
antonpirker Feb 15, 2024
6104f24
Make scope context managers align with JS (and possibly OTel)
antonpirker Feb 16, 2024
b1e0913
Merge branch 'sentry-sdk-2.0' into new-scopes-call-api
antonpirker Feb 16, 2024
7b8b075
Updated _context_manage_state to not have Hub
antonpirker Feb 16, 2024
1b9e7a6
More tests
antonpirker Feb 16, 2024
d5efe35
Merge branch 'sentry-sdk-2.0' into new-scopes-call-api
antonpirker Feb 16, 2024
a07cf91
Remove deprecation warning
antonpirker Feb 19, 2024
458f5e9
Removed last_event_id()
antonpirker Feb 19, 2024
b96adae
Merge branch 'sentry-sdk-2.0' into new-scopes-call-api
antonpirker Feb 19, 2024
285e2b9
Propagate isolation and current scope to new thread
antonpirker Feb 19, 2024
7d9c51d
Fixed some tests
antonpirker Feb 19, 2024
6df29bc
Fixed linting
antonpirker Feb 19, 2024
8be874b
Update tests/test_scope.py
antonpirker Feb 19, 2024
e556a17
Merge branch 'new-scopes-call-api' of github.com:getsentry/sentry-pyt…
antonpirker Feb 19, 2024
ab0b06b
Also merge 'self' into merged data that is sent to Sentry
antonpirker Feb 20, 2024
a72eec9
Removed unused scope parameter
antonpirker Feb 20, 2024
bbc97cc
Removed maybe unused test forking
antonpirker Feb 20, 2024
1f7cb7e
Skip test instead of deleting it
antonpirker Feb 20, 2024
7b9823e
Be extra safe
antonpirker Feb 20, 2024
8987340
Revert "Removed maybe unused test forking"
antonpirker Feb 20, 2024
4d7d4c3
Transactions and spans live on the current span.
antonpirker Feb 20, 2024
6dfe190
Revert "Transactions and spans live on the current span."
antonpirker Feb 20, 2024
2b7a224
Linting
antonpirker Feb 20, 2024
55a33f2
Fixed celery scope forking
antonpirker Feb 20, 2024
56213c0
Cleanup celery tests
antonpirker Feb 20, 2024
4dbcb46
lint
antonpirker Feb 20, 2024
7e17064
Put the active span on the current scope
antonpirker Feb 21, 2024
dbf3694
Removed deprecated parameter from start_span()
antonpirker Feb 21, 2024
a842bbe
If spans/transactions are started through the hub, also use the curre…
antonpirker Feb 21, 2024
28b7b6e
Skip test of removed feature
antonpirker Feb 21, 2024
f90f87b
Move transactions to current scope
antonpirker Feb 21, 2024
1f2e1b2
Configure scope should return the current scope
antonpirker Feb 21, 2024
41c0f6c
Merge branch 'sentry-sdk-2.0' into new-scopes-call-api
antonpirker Feb 21, 2024
ba8cb07
Merge branch 'sentry-sdk-2.0' into new-scopes-call-api
antonpirker Feb 21, 2024
e4febed
Making sure the tracing information lives on the current scope
antonpirker Feb 21, 2024
5622978
Update hub to get trace information from current scope
antonpirker Feb 21, 2024
62d792d
transaction is on isolation scope, span on corrent scope.
antonpirker Feb 22, 2024
8c229f7
Fixed some test
antonpirker Feb 22, 2024
4501cba
Fixed tests
antonpirker Feb 22, 2024
1c7c79c
Trace information is on isolation scope
antonpirker Feb 22, 2024
3bc0e1b
Fixed test
antonpirker Feb 22, 2024
357ae7e
Fixed test
antonpirker Feb 22, 2024
70140a6
Fixed celery tests
antonpirker Feb 22, 2024
5d812c3
Fixed some tests
antonpirker Feb 22, 2024
aeec6ad
Fixed some tests
antonpirker Feb 22, 2024
a4cde41
Loguru tests
antonpirker Feb 22, 2024
e72b161
Loguru test
antonpirker Feb 22, 2024
54528f5
Fork current scope for each start_span call
antonpirker Feb 23, 2024
f2f93fe
start of explenatory tests
antonpirker Feb 23, 2024
8e4319a
Changes in Hub to make it backwards compatible
antonpirker Feb 23, 2024
45b53fd
forking not necessary
antonpirker Feb 23, 2024
b0edd7a
Fixed some tests
antonpirker Feb 23, 2024
38e87b2
Linting
antonpirker Feb 23, 2024
b9ff715
Updated metrics to use new scopes
antonpirker Feb 23, 2024
61df6e2
updated django
antonpirker Feb 23, 2024
5c402e4
Updated Flask integration
antonpirker Feb 26, 2024
dce7fa9
Updated aiohttp
antonpirker Feb 26, 2024
9e5d3a6
Updated pyramid and quart
antonpirker Feb 26, 2024
add216b
Reordered tests because fastapi depends on starlette
antonpirker Feb 26, 2024
0cd543c
Updated test matrix
antonpirker Feb 26, 2024
b944738
Updated starlette
antonpirker Feb 26, 2024
c432cc0
Updated fastapi
antonpirker Feb 26, 2024
7cf41e7
Updated fastapi
antonpirker Feb 26, 2024
e570738
Updated arq
antonpirker Feb 26, 2024
e6a5457
Updated celery
antonpirker Feb 26, 2024
1cb2a56
Updated celery, huey and rq
antonpirker Feb 26, 2024
9dfa055
Updated sanic
antonpirker Feb 26, 2024
717abe5
Skip test that tests for old behavior
antonpirker Feb 26, 2024
24b8bb1
Formatting
antonpirker Feb 26, 2024
495fe1f
Merge branch 'sentry-sdk-2.0' into new-scopes-call-api
antonpirker Feb 26, 2024
4b09376
small fix
antonpirker Feb 26, 2024
5a7eec9
Cleanup
antonpirker Feb 26, 2024
0c1f0a7
cleanup
antonpirker Feb 26, 2024
5b598c2
Cleanup
antonpirker Feb 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ Distributed Tracing
.. autofunction:: sentry_sdk.api.get_traceparent


Client Management
=================

.. autofunction:: sentry_sdk.api.is_initialized
.. autofunction:: sentry_sdk.api.get_client


Managing Scope (advanced)
=========================

.. autofunction:: sentry_sdk.api.configure_scope
.. autofunction:: sentry_sdk.api.push_scope

.. autofunction:: sentry_sdk.api.new_scope

.. Not documented (On purpose. Not sure if anyone should use those)
.. last_event_id()
.. flush()
6 changes: 6 additions & 0 deletions docs/apidocs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ API Docs
.. autoclass:: sentry_sdk.Client
:members:

.. autoclass:: sentry_sdk.client.BaseClient
:members:

.. autoclass:: sentry_sdk.client.NonRecordingClient
:members:

.. autoclass:: sentry_sdk.client._Client
:members:

Expand Down
29 changes: 16 additions & 13 deletions sentry_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,31 @@
"HttpTransport",
"init",
"integrations",
"trace",
# From sentry_sdk.api
"add_breadcrumb",
"capture_event",
"capture_message",
"capture_exception",
"add_breadcrumb",
"capture_message",
"configure_scope",
"push_scope",
"continue_trace",
"flush",
"last_event_id",
"start_span",
"start_transaction",
"set_tag",
"get_baggage",
"get_client",
"get_current_span",
"get_traceparent",
"is_initialized",
"isolation_scope",
antonpirker marked this conversation as resolved.
Show resolved Hide resolved
"new_scope",
"push_scope",
"set_context",
"set_extra",
"set_user",
"set_level",
"set_measurement",
"get_current_span",
"get_traceparent",
"get_baggage",
"continue_trace",
"trace",
"set_tag",
"set_user",
"start_span",
"start_transaction",
]

# Initialize the debug support after everything is loaded
Expand Down
Loading
Loading