Skip to content

Commit

Permalink
allow distinct id to be set via envar (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeLalor committed Jul 26, 2024
1 parent 51d9862 commit 6298183
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sdk/eidolon_ai_sdk/util/posthog.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import asyncio
import hashlib
import json
import logging
import os
import uuid
import socket
from functools import wraps, cache
from importlib import metadata
from platform import python_version, uname
Expand Down Expand Up @@ -33,10 +34,10 @@ def posthog_enabled():


@cache
def distinct_id():
def distinct_id() -> str:
if not posthog_enabled():
return "disabled"
return str(uuid.getnode())
return os.environ.get('POSTHOG_ID') or hashlib.md5(socket.gethostname().encode()).hexdigest()


@cache
Expand Down

0 comments on commit 6298183

Please sign in to comment.