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

ref(gql): Use new scopes API in GQL Integration #2838

Merged
merged 26 commits into from
Mar 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
190923c
Created async and sync decorators
szokeasaurusrex Oct 18, 2023
c8aeadb
Added use of each sentry decorator
szokeasaurusrex Oct 18, 2023
c18a902
Fix circular import
szokeasaurusrex Oct 18, 2023
0fbea43
Merge branch 'sentry-sdk-2.0' into szokeasaurusrex/sentry_patched_dec…
szokeasaurusrex Mar 15, 2024
9f5c279
Revert changes to starlette.py
szokeasaurusrex Mar 15, 2024
45b90ab
Rename method
szokeasaurusrex Mar 15, 2024
69ebafb
Use actual generics, move async implementation to utils
szokeasaurusrex Mar 15, 2024
46cd0e2
Refactor parameters
szokeasaurusrex Mar 15, 2024
7a8196a
Undo changes to _types.py
szokeasaurusrex Mar 15, 2024
d9016db
Use client instead of Hub
szokeasaurusrex Mar 15, 2024
75934d1
Add doc string
szokeasaurusrex Mar 15, 2024
66726d0
Move type comments
szokeasaurusrex Mar 15, 2024
4e48ce3
Merge branch 'sentry-sdk-2.0' into szokeasaurusrex/sentry_patched_dec…
szokeasaurusrex Mar 18, 2024
e8c921c
Fix mypy
szokeasaurusrex Mar 18, 2024
20688fd
Fix circular import
szokeasaurusrex Mar 18, 2024
d93ff92
Added unit tests for decorators
szokeasaurusrex Mar 18, 2024
4b90191
Merge branch 'sentry-sdk-2.0' into szokeasaurusrex/sentry_patched_dec…
szokeasaurusrex Mar 18, 2024
85c1a1f
Revert gql changes
szokeasaurusrex Mar 18, 2024
682eb71
Revert "Revert gql changes"
szokeasaurusrex Mar 18, 2024
49cadb0
Merge branch 'sentry-sdk-2.0' into szokeasaurusrex/gql-new-scope-api
szokeasaurusrex Mar 19, 2024
c4c4605
ref: Shortcut for `should_send_default_pii`
szokeasaurusrex Mar 19, 2024
8205626
revert gql changes
szokeasaurusrex Mar 19, 2024
29ff367
Revert "revert gql changes"
szokeasaurusrex Mar 19, 2024
04be9de
Fully update gql integration to new scopes API
szokeasaurusrex Mar 19, 2024
d2b8458
Merge remote-tracking branch 'origin/sentry-sdk-2.0' into szokeasauru…
szokeasaurusrex Mar 19, 2024
5a7af4c
code review changes
szokeasaurusrex Mar 19, 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
Prev Previous commit
Next Next commit
Move type comments
  • Loading branch information
szokeasaurusrex committed Mar 15, 2024
commit 66726d05fdab6672aed4b1a8ef053261d7939821
4 changes: 2 additions & 2 deletions sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from sentry_sdk.consts import DEFAULT_MAX_VALUE_LENGTH, EndpointType

if TYPE_CHECKING:
from collections.abc import Awaitable

Check warning on line 35 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L35

Added line #L35 was not covered by tests

from types import FrameType, TracebackType
from typing import (
Expand All @@ -51,12 +51,12 @@
TypeVar,
Union,
)
from sentry_sdk.integrations import Integration

Check warning on line 54 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L54

Added line #L54 was not covered by tests

from sentry_sdk._types import Event, ExcInfo

P = ParamSpec("P")
R = TypeVar("R")

Check warning on line 59 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L58-L59

Added lines #L58 - L59 were not covered by tests


epoch = datetime(1970, 1, 1)
Expand Down Expand Up @@ -1635,6 +1635,7 @@
integration, # type: type[Integration]
original_function, # type: Callable[P, R]
):
# type: (...) -> Callable[[Callable[P, R]], Callable[P, R]]
"""
Ensures a given integration is enabled prior to calling a Sentry-patched function.

Expand All @@ -1657,46 +1658,45 @@
```
"""

# type: (...) -> Callable[[Callable[P, R]], Callable[P, R]]
def patcher(sentry_patched_function):

Check warning on line 1661 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1661

Added line #L1661 was not covered by tests
# type: (Callable[P, R]) -> Callable[P, R]
@wraps(original_function)

Check warning on line 1663 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1663

Added line #L1663 was not covered by tests
def runner(*args, **kwargs):
# type: (*object, **object) -> R
if sentry_sdk.get_client().get_integration(integration) is None:
return original_function(*args, **kwargs)

Check warning on line 1667 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1667

Added line #L1667 was not covered by tests

return sentry_patched_function(*args, **kwargs)

Check warning on line 1669 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1669

Added line #L1669 was not covered by tests

return runner

Check warning on line 1671 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1671

Added line #L1671 was not covered by tests

return patcher

Check warning on line 1673 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1673

Added line #L1673 was not covered by tests


def ensure_integration_enabled_async(
integration, # type: type[Integration]
original_function, # type: Callable[P, Awaitable[R]]
):
# type: (...) -> Callable[[Callable[P, Awaitable[R]]], Callable[P, Awaitable[R]]]
"""
Version of `ensure_integration_enabled` for decorating async functions.

Please refer to the `ensure_integration_enabled` documentation for more information.
"""

# type: (...) -> Callable[[Callable[P, Awaitable[R]]], Callable[P, Awaitable[R]]]
def patcher(sentry_patched_function):

Check warning on line 1687 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1687

Added line #L1687 was not covered by tests
# type: (Callable[P, Awaitable[R]]) -> Callable[P, Awaitable[R]]
@wraps(original_function)

Check warning on line 1689 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1689

Added line #L1689 was not covered by tests
async def runner(*args, **kwargs):
# type: (*object, **object) -> R
if sentry_sdk.get_client().get_integration(integration) is None:
return await original_function(*args, **kwargs)

Check warning on line 1693 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1693

Added line #L1693 was not covered by tests

return await sentry_patched_function(*args, **kwargs)

Check warning on line 1695 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1695

Added line #L1695 was not covered by tests

return runner

Check warning on line 1697 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1697

Added line #L1697 was not covered by tests

return patcher

Check warning on line 1699 in sentry_sdk/utils.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/utils.py#L1699

Added line #L1699 was not covered by tests


if PY37:
Expand Down
Loading