Skip to content

Commit

Permalink
ref(crons): message_type is always available (#60926)
Browse files Browse the repository at this point in the history
After getsentry/relay#2723 this field is
guaranteed to exist in the CheckinMessage. We no longer need to add this
in and have it marked as NotRequired.
  • Loading branch information
evanpurkhiser authored Nov 30, 2023
1 parent 3237d9d commit 008058c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
7 changes: 0 additions & 7 deletions src/sentry/monitors/consumers/monitor_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,6 @@ def _process_message(
partition: int,
wrapper: CheckinMessage | ClockPulseMessage,
) -> None:

# XXX: Relay does not attach a message type, to properly discriminate the
# message_type we add it by default here. This can be removed once the
# message_type is guaranteed
if "message_type" not in wrapper:
wrapper["message_type"] = "check_in"

try:
try_monitor_tasks_trigger(ts, partition)
except Exception:
Expand Down
4 changes: 1 addition & 3 deletions src/sentry/monitors/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@


class CheckinMessage(TypedDict):
# TODO(epurkhiser): We should make this required and ensure the message
# produced by relay includes this message type
message_type: NotRequired[Literal["check_in"]]
message_type: Literal["check_in"]
payload: str
start_time: float
project_id: str
Expand Down
1 change: 1 addition & 0 deletions tests/sentry/monitors/test_monitor_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def send_checkin(
payload.update(overrides)

wrapper = {
"message_type": "check_in",
"start_time": ts.timestamp(),
"project_id": self.project.id,
"payload": json.dumps(payload),
Expand Down

0 comments on commit 008058c

Please sign in to comment.