Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(cohorts): add missing query tags to _get_existing_ch_member_uuids (#57747)

Lucas Floresdc301edf2d1c
diff --git a/posthog/models/cohort/cohort.py b/posthog/models/cohort/cohort.py
index eada5cf7fb1d..39886dcb5af0 100644
--- a/posthog/models/cohort/cohort.py
+++ b/posthog/models/cohort/cohort.py
@@ -850,6 +850,7 @@ class Cohort(FileSystemSyncMixin, RootTeamMixin, models.Model):
"""Return the subset of person_uuids that already exist in the CH static cohort table."""
if not person_uuids:
return set()
+ tag_queries(product=ProductKey.COHORTS, feature=Feature.COHORT)
# nosemgrep: clickhouse-fstring-param-audit - table name from constant, values parameterized
rows = sync_execute(
f"SELECT person_id FROM {table} WHERE team_id = %(team_id)s AND cohort_id = %(cohort_id)s AND person_id IN %(person_uuids)s GROUP BY person_id",