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(logs): expose temporal wiring via facade (#64515)

Jon McCallumd865342ad44d
diff --git a/posthog/management/commands/start_temporal_worker.py b/posthog/management/commands/start_temporal_worker.py
index 12e3100e3749..9b0b3f574861 100644
--- a/posthog/management/commands/start_temporal_worker.py
+++ b/posthog/management/commands/start_temporal_worker.py
@@ -195,7 +195,7 @@ from products.exports.backend.temporal.subscriptions import (
ACTIVITIES as SUBSCRIPTION_ACTIVITIES,
WORKFLOWS as SUBSCRIPTION_WORKFLOWS,
)
-from products.logs.backend.temporal import (
+from products.logs.backend.facade.temporal import (
ACTIVITIES as LOGS_ALERTING_ACTIVITIES,
WORKFLOWS as LOGS_ALERTING_WORKFLOWS,
)
diff --git a/posthog/temporal/common/worker.py b/posthog/temporal/common/worker.py
index 6a403dc7823f..07265ab6ca59 100644
--- a/posthog/temporal/common/worker.py
+++ b/posthog/temporal/common/worker.py
@@ -65,7 +65,7 @@ from products.experiments.backend.temporal.recalculation_metrics import (
EXPERIMENT_METRICS_RECALCULATION_LATENCY_HISTOGRAM_METRICS,
ExperimentsRecalculationMetricsInterceptor,
)
-from products.logs.backend.temporal.metrics import (
+from products.logs.backend.facade.temporal import (
LOGS_ALERTING_COUNT_HISTOGRAM_BUCKETS,
LOGS_ALERTING_COUNT_HISTOGRAM_METRICS,
LOGS_ALERTING_LATENCY_HISTOGRAM_BUCKETS,
diff --git a/posthog/temporal/logs_alerting/schedule.py b/posthog/temporal/logs_alerting/schedule.py
index b0613cd9de34..77e241ca4871 100644
--- a/posthog/temporal/logs_alerting/schedule.py
+++ b/posthog/temporal/logs_alerting/schedule.py
@@ -15,8 +15,7 @@ from temporalio.client import (
from posthog.temporal.common.schedule import a_create_schedule, a_schedule_exists, a_update_schedule
-from products.logs.backend.temporal.activities import CheckAlertsInput
-from products.logs.backend.temporal.constants import SCHEDULE_CRON, SCHEDULE_ID, WORKFLOW_NAME
+from products.logs.backend.facade.temporal import SCHEDULE_CRON, SCHEDULE_ID, WORKFLOW_NAME, CheckAlertsInput
async def create_logs_alert_check_schedule(client: Client) -> None:
diff --git a/products/logs/backend/facade/temporal.py b/products/logs/backend/facade/temporal.py
new file mode 100644
index 000000000000..ed387b448d7f
--- /dev/null
+++ b/products/logs/backend/facade/temporal.py
@@ -0,0 +1,34 @@
+"""Facade re-exports for the logs alerting Temporal wiring.
+
+Core registers this product's workflow + activities with the Temporal worker
+(``posthog/management/commands/start_temporal_worker.py``), wires its metrics
+interceptor (``posthog/temporal/common/worker.py``), and registers its schedule
+(``posthog/temporal/logs_alerting/schedule.py``). That wiring crosses the boundary as
+objects and constants, not data, so re-export exactly what core touches and keep the
+temporalio-heavy imports here, off the ``facade/api.py`` path.
+"""
+
+from products.logs.backend.temporal import ACTIVITIES, WORKFLOWS
+from products.logs.backend.temporal.activities import CheckAlertsInput
+from products.logs.backend.temporal.constants import SCHEDULE_CRON, SCHEDULE_ID, WORKFLOW_NAME
+from products.logs.backend.temporal.metrics import (
+ LOGS_ALERTING_COUNT_HISTOGRAM_BUCKETS,
+ LOGS_ALERTING_COUNT_HISTOGRAM_METRICS,
+ LOGS_ALERTING_LATENCY_HISTOGRAM_BUCKETS,
+ LOGS_ALERTING_LATENCY_HISTOGRAM_METRICS,
+ LogsAlertingMetricsInterceptor,
+)
+
+__all__ = [
+ "ACTIVITIES",
+ "WORKFLOWS",
+ "CheckAlertsInput",
+ "SCHEDULE_CRON",
+ "SCHEDULE_ID",
+ "WORKFLOW_NAME",
+ "LOGS_ALERTING_COUNT_HISTOGRAM_BUCKETS",
+ "LOGS_ALERTING_COUNT_HISTOGRAM_METRICS",
+ "LOGS_ALERTING_LATENCY_HISTOGRAM_BUCKETS",
+ "LOGS_ALERTING_LATENCY_HISTOGRAM_METRICS",
+ "LogsAlertingMetricsInterceptor",
+]