: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(cohorts): fix logger import (#60302)
Matheus Batistabe00f4fbb060
diff --git a/posthog/temporal/messaging/realtime_cohort_calculation_workflow_coordinator.py b/posthog/temporal/messaging/realtime_cohort_calculation_workflow_coordinator.pyindex f427c02c60ec..873aa526293d 100644--- a/posthog/temporal/messaging/realtime_cohort_calculation_workflow_coordinator.py+++ b/posthog/temporal/messaging/realtime_cohort_calculation_workflow_coordinator.py@@ -380,7 +380,7 @@ class RealtimeCohortCalculationCoordinatorWorkflow(PostHogWorkflow):coordinator_start_time = temporalio.workflow.time()percentile_bucket = get_percentile_bucket_label(inputs.duration_percentile_min, inputs.duration_percentile_max)- workflow_logger = temporalio.workflow.logger+ workflow_logger = LOGGER.bind()workflow_logger.info("Starting realtime cohort calculation coordinator", parallelism=inputs.parallelism)workflow_logger.info("Cohort selection config", team_ids=inputs.team_ids, global_percentage=inputs.global_percentagediff --git a/posthog/temporal/messaging/test/test_realtime_cohort_calculation_workflow.py b/posthog/temporal/messaging/test/test_realtime_cohort_calculation_workflow.pyindex 83f95df55899..40ed3b4f12cc 100644--- a/posthog/temporal/messaging/test/test_realtime_cohort_calculation_workflow.py+++ b/posthog/temporal/messaging/test/test_realtime_cohort_calculation_workflow.py@@ -1290,11 +1290,13 @@ class TestCoordinatorWorkflowInsufficientData:workflow_logger = Mock()with (- patch("temporalio.workflow.logger", workflow_logger),+ patch("posthog.temporal.messaging.realtime_cohort_calculation_workflow_coordinator.LOGGER") as mock_logger,patch("temporalio.workflow.execute_activity", new_callable=AsyncMock) as mock_execute_activity,patch("temporalio.workflow.time", return_value=1234567890.0), # Mock workflow timepatch("temporalio.workflow.info") as mock_info, # Mock workflow info):+ mock_logger.bind.return_value = workflow_logger+# Mock workflow infomock_info.return_value.workflow_id = "test-workflow-id"@@ -1335,11 +1337,13 @@ class TestCoordinatorWorkflowInsufficientData:workflow_logger = Mock()with (- patch("temporalio.workflow.logger", workflow_logger),+ patch("posthog.temporal.messaging.realtime_cohort_calculation_workflow_coordinator.LOGGER") as mock_logger,patch("temporalio.workflow.execute_activity", new_callable=AsyncMock) as mock_execute_activity,patch("temporalio.workflow.time", return_value=1234567890.0), # Mock workflow timepatch("temporalio.workflow.info") as mock_info, # Mock workflow info):+ mock_logger.bind.return_value = workflow_logger+# Mock workflow infomock_info.return_value.workflow_id = "test-workflow-id"@@ -1380,11 +1384,13 @@ class TestCoordinatorWorkflowInsufficientData:workflow_logger = Mock()with (- patch("temporalio.workflow.logger", workflow_logger),+ patch("posthog.temporal.messaging.realtime_cohort_calculation_workflow_coordinator.LOGGER") as mock_logger,patch("temporalio.workflow.execute_activity", new_callable=AsyncMock) as mock_execute_activity,patch("temporalio.workflow.time", return_value=1234567890.0), # Mock workflow timepatch("temporalio.workflow.info") as mock_info, # Mock workflow info):+ mock_logger.bind.return_value = workflow_logger+# Mock workflow infomock_info.return_value.workflow_id = "test-workflow-id"@@ -1429,11 +1435,13 @@ class TestCoordinatorWorkflowInsufficientData:mock_selection_result.cohort_ids = []with (- patch("temporalio.workflow.logger", workflow_logger),+ patch("posthog.temporal.messaging.realtime_cohort_calculation_workflow_coordinator.LOGGER") as mock_logger,patch("temporalio.workflow.execute_activity", new_callable=AsyncMock) as mock_execute_activity,patch("temporalio.workflow.time", return_value=1234567890.0), # Mock workflow timepatch("temporalio.workflow.info") as mock_info, # Mock workflow info):+ mock_logger.bind.return_value = workflow_logger+# Mock workflow infomock_info.return_value.workflow_id = "test-workflow-id"