Skip to content

Commit

Permalink
ref: fix typing for event_id (it is str)
Browse files Browse the repository at this point in the history
split out from my Job is TypedDict branch
  • Loading branch information
asottile-sentry committed Jun 13, 2024
1 parent 5e966b1 commit 0f6431f
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/sentry/api/endpoints/group_ai_autofix.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class GroupAutofixEndpoint(GroupEndpoint):
}

def _get_serialized_event(
self, event_id: int, group: Group, user: AbstractBaseUser | AnonymousUser
self, event_id: str, group: Group, user: AbstractBaseUser | AnonymousUser
) -> dict[str, Any] | None:
event = eventstore.backend.get_event_by_id(group.project.id, event_id, group_id=group.id)

Expand Down
8 changes: 4 additions & 4 deletions src/sentry/eventstore/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ def get_unfetched_events(

def get_event_by_id(
self,
project_id,
event_id,
group_id=None,
project_id: int,
event_id: str,
group_id: int | None = None,
skip_transaction_groupevent=False,
tenant_ids=None,
occurrence_id=None,
occurrence_id: str | None = None,
):
"""
Gets a single event of any event type given a project_id and event_id.
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/eventstore/reprocessing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def expire_hash(
self,
project_id: int,
group_id: int,
event_id: int,
event_id: str,
date_val: datetime,
old_primary_hash: str,
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/eventstore/reprocessing/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def expire_hash(
self,
project_id: int,
group_id: int,
event_id: int,
event_id: str,
date_val: datetime,
old_primary_hash: str,
) -> None:
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/eventstore/snuba/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ def __get_events(

def get_event_by_id(
self,
project_id,
event_id,
group_id=None,
project_id: int,
event_id: str,
group_id: int | None = None,
skip_transaction_groupevent=False,
tenant_ids=None,
occurrence_id: str | None = None,
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/issues/related/trace_connected.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def trace_connected_analysis(
if event_id:
# If we are passing an specific event_id, we need to get the project_id
assert project_id is not None
event = eventstore.backend.get_event_by_id(project_id, event_id, group_id=group.id)
event = eventstore.backend.get_event_by_id(int(project_id), event_id, group_id=group.id)
# If we are requesting an specific event, we want to be notified with an error
assert event is not None
# This ensures that the event is actually part of the group and we are notified
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/reprocessing2.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def _send_delete_old_primary_hash_messages(
def buffered_delete_old_primary_hash(
project_id: int,
group_id: int,
event_id: int | None = None,
event_id: str | None = None,
datetime: datetime | None = None,
old_primary_hash: str | None = None,
current_primary_hash: str | None = None,
Expand Down
3 changes: 2 additions & 1 deletion src/sentry/tasks/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ def post_process_group(
cache_key,
group_id=None,
occurrence_id: str | None = None,
project_id: int | None = None,
*,
project_id: int,
**kwargs,
):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/relay_integration/test_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def post_event_with_sdk(settings, relay_server, wait_for_ingest_consumer):

def inner(*args, **kwargs):
event_id = sentry_sdk.capture_event(*args, **kwargs)
assert event_id is not None
sentry_sdk.flush()

with sentry_sdk.scope.use_scope(current_scope):
Expand Down

0 comments on commit 0f6431f

Please sign in to comment.