Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,37 +68,16 @@ def _append_project_event_counts(self, ctx: OrganizationReportContext) -> None:
total = data["total"]
timestamp = int(parse_snuba_datetime(data["time"]).timestamp())
if data["category"] == DataCategory.TRANSACTION:
# Transaction outcome
if (
data["outcome"] == Outcome.RATE_LIMITED
or data["outcome"] == Outcome.FILTERED
):
project_ctx.dropped_transaction_count += total
else:
project_ctx.accepted_transaction_count += total
project_ctx.transaction_count_by_day[timestamp] = total
project_ctx.accepted_transaction_count += total
project_ctx.transaction_count_by_day[timestamp] = total
elif data["category"] == DataCategory.REPLAY:
# Replay outcome
if (
data["outcome"] == Outcome.RATE_LIMITED
or data["outcome"] == Outcome.FILTERED
):
project_ctx.dropped_replay_count += total
else:
project_ctx.accepted_replay_count += total
project_ctx.replay_count_by_day[timestamp] = total
project_ctx.accepted_replay_count += total
project_ctx.replay_count_by_day[timestamp] = total
else:
# Error outcome
if (
data["outcome"] == Outcome.RATE_LIMITED
or data["outcome"] == Outcome.FILTERED
):
project_ctx.dropped_error_count += total
else:
project_ctx.accepted_error_count += total
project_ctx.error_count_by_day[timestamp] = (
project_ctx.error_count_by_day.get(timestamp, 0) + total
)
project_ctx.accepted_error_count += total
project_ctx.error_count_by_day[timestamp] = (
project_ctx.error_count_by_day.get(timestamp, 0) + total
)

@metrics.wraps("weekly_report.create_context.project_event_counts_previous_week")
def _append_project_event_counts_previous_week(self, ctx: OrganizationReportContext) -> None:
Expand Down
16 changes: 4 additions & 12 deletions src/sentry/tasks/summaries/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ def is_empty(self):

class ProjectContext:
accepted_error_count = 0
dropped_error_count = 0
accepted_transaction_count = 0
dropped_transaction_count = 0
accepted_replay_count = 0
dropped_replay_count = 0

prev_week_accepted_error_count = 0
prev_week_accepted_transaction_count = 0
Expand Down Expand Up @@ -106,9 +103,9 @@ def __repr__(self) -> str:
return "\n".join(
[
f"{self.key_errors_by_group}, ",
f"Errors: [Accepted {self.accepted_error_count}, Dropped {self.dropped_error_count}]",
f"Transactions: [Accepted {self.accepted_transaction_count} Dropped {self.dropped_transaction_count}]",
f"Replays: [Accepted {self.accepted_replay_count} Dropped {self.dropped_replay_count}]",
f"Errors: [Accepted {self.accepted_error_count}]",
f"Transactions: [Accepted {self.accepted_transaction_count}]",
f"Replays: [Accepted {self.accepted_replay_count}]",
]
)

Expand All @@ -118,11 +115,8 @@ def check_if_project_is_empty(self):
and not self.key_transactions
and not self.key_performance_issues
and not self.accepted_error_count
and not self.dropped_error_count
and not self.accepted_transaction_count
and not self.dropped_transaction_count
and not self.accepted_replay_count
and not self.dropped_replay_count
)


Expand Down Expand Up @@ -704,9 +698,7 @@ def project_event_counts_for_organization(start, end, ctx, referrer: str) -> lis
Condition(Column("timestamp"), Op.GTE, start),
Condition(Column("timestamp"), Op.LT, end + timedelta(days=1)),
Condition(Column("org_id"), Op.EQ, ctx.organization.id),
Condition(
Column("outcome"), Op.IN, [Outcome.ACCEPTED, Outcome.FILTERED, Outcome.RATE_LIMITED]
),
Condition(Column("outcome"), Op.EQ, Outcome.ACCEPTED),
Condition(
Column("category"),
Op.IN,
Expand Down
Loading