File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,12 @@ ANOMSTACK_CLICKHOUSE_DATABASE=default
154154# dashbooard port
155155ANOMSTACK_DASHBOARD_PORT = 5001
156156
157- # PostHog API key for analytics
157+ # PostHog API key for metrics ingestion (querying PostHog's API for data)
158158POSTHOG_API_KEY =
159159
160+ # PostHog frontend API key for analytics tracking (website analytics)
161+ POSTHOG_FRONTEND_API_KEY =
162+
160163# example to enable some jobs via env vars
161164# ANOMSTACK__PYTHON_INGEST_SIMPLE__INGEST_DEFAULT_SCHEDULE_STATUS=RUNNING
162165# ANOMSTACK__PYTHON_INGEST_SIMPLE__TRAIN_DEFAULT_SCHEDULE_STATUS=RUNNING
Original file line number Diff line number Diff line change @@ -45,19 +45,19 @@ def load_env_with_custom_path():
4545
4646log = logging .getLogger ("anomstack_dashboard" )
4747
48- # Get PostHog API key from environment
49- posthog_api_key = os .getenv ("POSTHOG_API_KEY" )
48+ # Get PostHog frontend API key for analytics tracking (separate from POSTHOG_API_KEY used for metrics ingestion)
49+ posthog_api_key = os .getenv ("POSTHOG_FRONTEND_API_KEY" )
50+ posthog_script = None
5051if posthog_api_key :
5152 from dashboard .constants import POSTHOG_SCRIPT
52-
53- POSTHOG_SCRIPT = POSTHOG_SCRIPT .replace ("window.POSTHOG_API_KEY || ''" , f"'{ posthog_api_key } '" )
53+ posthog_script = POSTHOG_SCRIPT .replace ("window.POSTHOG_API_KEY || ''" , f"'{ posthog_api_key } '" )
5454
5555# Define the app
5656app , rt = fast_app (
5757 hdrs = (
5858 Theme .blue .headers (),
5959 Script (src = "https://cdn.plot.ly/plotly-2.32.0.min.js" ),
60- Script (POSTHOG_SCRIPT ) if posthog_api_key else None ,
60+ Script (posthog_script ) if posthog_script else None ,
6161 Link (
6262 rel = "icon" ,
6363 type = "image/svg+xml" ,
Original file line number Diff line number Diff line change @@ -100,7 +100,10 @@ ANOMSTACK__EIRGRID__CHANGE_DEFAULT_SCHEDULE_STATUS=RUNNING
100100ANOMSTACK__EIRGRID__DELETE_DEFAULT_SCHEDULE_STATUS = RUNNING
101101ANOMSTACK__EIRGRID__LLMALERT_DEFAULT_SCHEDULE_STATUS = STOPPED
102102
103- # Enable PostHog
103+ # PostHog frontend analytics tracking
104+ POSTHOG_FRONTEND_API_KEY = phc_TudOaC1O5X0Ycl3GtIR0A2cjREW6B6Zp3xDd6c8qxUM
105+
106+ # Enable PostHog metrics ingestion
104107ANOMSTACK__POSTHOG__INGEST_DEFAULT_SCHEDULE_STATUS = RUNNING
105108ANOMSTACK__POSTHOG__TRAIN_DEFAULT_SCHEDULE_STATUS = RUNNING
106109ANOMSTACK__POSTHOG__SCORE_DEFAULT_SCHEDULE_STATUS = RUNNING
You can’t perform that action at this time.
0 commit comments