diff --git a/ml/anomaly_detector.py b/ml/anomaly_detector.py index d2a14c0..5d4ce62 100644 --- a/ml/anomaly_detector.py +++ b/ml/anomaly_detector.py @@ -14,7 +14,7 @@ class AnomalyDetector: if not self.billing_table: raise ValueError("BILLING_TABLE environment variable not set.") - self.pubsub_topic_name = os.environ.get("PUBSUB_TOPIC", "billing_alerts") + self.pubsub_topic_name = os.environ.get("ANOMALY_TOPIC", "osvauco-billing-anomalies") self.bq_client = bigquery.Client(project=self.project_id) self.publisher = pubsub_v1.PublisherClient() self.topic_path = self.publisher.topic_path(self.project_id, self.pubsub_topic_name) @@ -77,7 +77,7 @@ class AnomalyDetector: "today_cost": anomaly["today_cost"], "avg_7d": anomaly["avg_7d"], "ratio": anomaly["ratio"], - "timestamp": datetime.datetime.now().isoformat() + "timestamp_utc": datetime.datetime.utcnow().isoformat() } message_bytes = json.dumps(message_data).encode("utf-8") self.publisher.publish(self.topic_path, data=message_bytes)