Skip to content

Commit a927b09

Browse files
authored
Merge pull request #55 from PriorLabs/allow-passing-api-key
Allow passing API key to PostHog
2 parents 3babc6f + 5e58967 commit a927b09

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/tabpfn_common_utils/telemetry/core/service.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class ProductTelemetry:
3535
# PostHog client instance
3636
_posthog_client: Optional[Posthog] = None
3737

38-
def __init__(self, max_queue_size: int = 10, flush_at: int = 10) -> None:
38+
def __init__(
39+
self,
40+
max_queue_size: int = 10,
41+
flush_at: int = 10,
42+
api_key: Optional[str] = None,
43+
) -> None:
3944
"""
4045
Initialize the Telemetry service.
4146
"""
@@ -44,9 +49,12 @@ def __init__(self, max_queue_size: int = 10, flush_at: int = 10) -> None:
4449
self._posthog_client = None
4550
return
4651

52+
if api_key is None:
53+
api_key = self.PROJECT_API_KEY
54+
4755
# Initialize the PostHog client
4856
self._posthog_client = Posthog(
49-
project_api_key=self.PROJECT_API_KEY,
57+
project_api_key=api_key,
5058
host=self.HOST,
5159
disable_geoip=True,
5260
enable_exception_autocapture=False,

0 commit comments

Comments
 (0)