diff --git a/tabpfn_client/client.py b/tabpfn_client/client.py index f29443e..1c4e297 100644 --- a/tabpfn_client/client.py +++ b/tabpfn_client/client.py @@ -25,6 +25,7 @@ from tabpfn_client.constants import CACHE_DIR from tabpfn_client.browser_auth import BrowserAuthHandler from tabpfn_client.tabpfn_common_utils.utils import Singleton +from tabpfn_client.tabpfn_common_utils.usage_analytics import AnalyticsHttpClient logger = logging.getLogger(__name__) @@ -157,15 +158,20 @@ class ServiceClient(Singleton): httpx_timeout_s = ( 4 * 5 * 60 + 15 # temporary workaround for slow computation on server side ) - httpx_client = httpx.Client( + httpx_client = AnalyticsHttpClient( base_url=base_url, timeout=httpx_timeout_s, headers={"client-version": get_client_version()}, + module_name="tabpfn_client", ) _access_token = None dataset_uid_cache_manager = DatasetUIDCacheManager() + @classmethod + def set_module_name(cls, module_name: str) -> None: + cls.httpx_client.set_module_name(module_name) + @classmethod def get_access_token(cls): return cls._access_token diff --git a/tabpfn_client/config.py b/tabpfn_client/config.py index 70bee25..3b5a040 100644 --- a/tabpfn_client/config.py +++ b/tabpfn_client/config.py @@ -21,7 +21,10 @@ def __new__(cls, *args, **kwargs): use_server = False -def init(use_server=True): +def init( + use_server=True, + module_name="tabpfn_client", +): # initialize config Config.use_server = use_server @@ -30,6 +33,8 @@ def init(use_server=True): return if use_server: + ServiceClient.set_module_name(module_name) + # check connection to server if not UserAuthenticationClient.is_accessible_connection(): raise RuntimeError( diff --git a/tabpfn_client/tabpfn_common_utils b/tabpfn_client/tabpfn_common_utils index 524cee7..c2f352a 160000 --- a/tabpfn_client/tabpfn_common_utils +++ b/tabpfn_client/tabpfn_common_utils @@ -1 +1 @@ -Subproject commit 524cee72cc6f33cf59fc943dc3e4b5428f3a79bc +Subproject commit c2f352aeb393877dec9cdb73c9f4c9fe9f3e466f