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.

feat(growth): register the ai enrichment labeler in EU (#109196)

Matt Brooker9295706953b7
diff --git a/posthog/dags/locations/growth.py b/posthog/dags/locations/growth.py
index 839f6d8237ff..30ab3ec506d6 100644
--- a/posthog/dags/locations/growth.py
+++ b/posthog/dags/locations/growth.py
@@ -17,6 +17,7 @@ jobs = [
github_sdk_versions.cache_github_sdk_versions_job,
team_production_event_activation.detect_first_team_production_event_job,
product_push_campaigns.product_push_campaigns_job,
+ ai_enrichment.ai_enrichment_job,
# Manual-run only: growth names the organizations, product, and window per run.
custom_product_push_campaigns.custom_product_push_campaigns_job,
]
@@ -25,16 +26,12 @@ schedules = [
github_sdk_versions.cache_github_sdk_versions_schedule,
team_production_event_activation.detect_first_team_production_event_schedule,
product_push_campaigns.product_push_campaigns_schedule,
+ ai_enrichment.ai_enrichment_schedule,
]
# Identity matching processes internal PostHog data that only exists on Cloud US (team 2),
# so the job is not registered on Cloud EU.
if identity_matching.is_identity_matching_registered():
jobs.append(identity_matching.identity_matching_job)
-# AI enrichment sends organization signup data to an external LLM gateway, so — like
-# identity matching — it is not registered on Cloud EU.
-if ai_enrichment.is_ai_enrichment_registered():
- jobs.append(ai_enrichment.ai_enrichment_job)
- schedules.append(ai_enrichment.ai_enrichment_schedule)
defs = dagster.Definitions(
jobs=jobs,
diff --git a/products/growth/dags/ai_enrichment.py b/products/growth/dags/ai_enrichment.py
index d10a491cd98c..4494aa7f47cc 100644
--- a/products/growth/dags/ai_enrichment.py
+++ b/products/growth/dags/ai_enrichment.py
@@ -32,15 +32,11 @@ writes (under whatever version is live when its turn comes up) — a real run re
`candidates > 0, created == 0` and false-alerts. `--expected-version` closes the remaining gap
between resolving here and the command resolving again for itself: if the two disagree, the
command aborts loudly as a command failure instead of a confusing silent one.
-
-Environment: sends organization signup data to an external LLM gateway, so — like
-`identity_matching.py` — it is not registered on Cloud EU.
"""
from dataclasses import dataclass
from datetime import datetime
-from django.conf import settings
from django.core.management import call_command
from django.db.models import CharField, DateTimeField, Exists, F, OuterRef, Q
from django.db.models.fields.json import KeyTextTransform, KeyTransform
@@ -68,10 +64,6 @@ DEFAULT_LABEL_LIMIT = 600
MAX_RUNTIME_SECONDS = 6 * 60 * 60
-def is_ai_enrichment_registered() -> bool:
- return settings.CLOUD_DEPLOYMENT != "EU"
-
-
class AiEnrichmentConfig(dagster.Config):
limit: int = pydantic.Field(
default=DEFAULT_LABEL_LIMIT,
diff --git a/products/growth/dags/tests/test_ai_enrichment.py b/products/growth/dags/tests/test_ai_enrichment.py
index 6c87891d4e40..cd5357f20ab3 100644
--- a/products/growth/dags/tests/test_ai_enrichment.py
+++ b/products/growth/dags/tests/test_ai_enrichment.py
@@ -19,7 +19,7 @@ from products.growth.backend.models import (
OrganizationEnrichmentFetch,
)
from products.growth.dags import ai_enrichment
-from products.growth.dags.ai_enrichment import ai_enrichment_job, count_pending_candidates, is_ai_enrichment_registered
+from products.growth.dags.ai_enrichment import ai_enrichment_job, count_pending_candidates
_MODULE = "products.growth.dags.ai_enrichment"
@@ -422,17 +422,3 @@ class TestCountProjectedScores(_EnrichmentDagTestCase):
config.save()
assert ai_enrichment.count_projected_scores(config.name, config.version, started_at) == 0
-
-
- [
- ("unset", None, True),
- ("local", "LOCAL", True),
- ("dev", "DEV", True),
- ("us", "US", True),
- ("eu", "EU", False),
- ]
-)
-def test_ai_enrichment_registered_per_environment(_name: str, cloud_deployment: str | None, registered: bool) -> None:
- with patch.object(ai_enrichment.settings, "CLOUD_DEPLOYMENT", cloud_deployment):
- assert is_ai_enrichment_registered() is registered