Skip to content
Merged
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
4 changes: 2 additions & 2 deletions posthog/tasks/usage_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from posthog.schema import AIEventType

from posthog import version_requirement
from posthog.batch_exports.models import BatchExportRun
from posthog.batch_exports.models import BatchExportDestination, BatchExportRun
from posthog.clickhouse.client import sync_execute
from posthog.clickhouse.client.connection import Workload
from posthog.clickhouse.query_tagging import tags_context
Expand Down Expand Up @@ -940,9 +940,9 @@ def get_teams_with_rows_exported_in_period(begin: datetime, end: datetime) -> li
finished_at__gte=begin,
finished_at__lte=end,
status=BatchExportRun.Status.COMPLETED,
batch_export__model=BatchExport.Model.EVENTS,
batch_export__deleted=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why this filter is present? Just thinking we could be missing runs executed before a batch export being deleted. Or do you think we don't need to worry about this?

Copy link
Contributor Author

@tomasfarias tomasfarias Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why this filter is present?

No idea, I asked in slack about this and seemed like removing it was the way to go.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking we could be missing runs executed before a batch export being deleted. Or do you think we don't need to worry about this?

How could this happen? Also, why would removing a filter cause us to miss runs? If anything we should be capturing more runs than with the filter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry, I was referring to the batch_export__deleted=False filter. Not sure what the typical time period is here but just thinking a customer could run a large backfill then delete their batch export

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no clue about that one, I haven't considered it. I guess we need to chat a bit about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, might be a bit of an edge case but won't let it block this PR

)
.exclude(batch_export__destination__type=BatchExportDestination.Destination.HTTP)
.values(team_id=F("batch_export__team_id"))
.annotate(total=Sum("records_completed"))
)
Expand Down
Loading