-
Notifications
You must be signed in to change notification settings - Fork 20
Add usage analytics tracking #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
base_url=base_url, | ||
timeout=httpx_timeout_s, | ||
headers={"client-version": get_client_version()}, | ||
module_name="tabpfn_client", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure there is no way of getting the module name programmatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least not robustly, in my opinion.
My rationale: tabpfn-extensions
or wrappers built by users can create arbitrarily deep call stack. So I thought it'd be easier to let the wrapper, e.g. tabpfn-extensions
, set the module name explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I was hoping there is a better way to get the module name than iterating the call stack.
return | ||
|
||
if use_server: | ||
ServiceClient.set_module_name(module_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not expecting this to change during service run. It should be ONLY in the constructor of ServiceClient and then stored as a private member.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServiceClient is a singleton class, hence we don't have an constructor as per say.
I'm also wondering if there's a better design for classes like ServiceClient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be. Singletons are to be handled with cautions, because as for global variables, they can be changed in multiple places and thus introduce side-effects. Also they are harder to test, because dependency injection does not work.
I'd need to think more about this here.
But one way would be to create a client instance. And then this instance needs to be passed when calls are made.
) | ||
|
||
_access_token = None | ||
dataset_uid_cache_manager = DatasetUIDCacheManager() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be private btw.
httpx_timeout_s = ( | ||
4 * 5 * 60 + 15 # temporary workaround for slow computation on server side | ||
) | ||
httpx_client = httpx.Client( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests missing.
Change Description
Add minimal usage analytics tracking:
tabpfn_client
extracts basic usage info based on the caller's environment, and sends this info in request headers.Try to be precise. You can additionally add comments to your PR, this might help the reviewer a lot.
If you used new dependencies: Did you add them to
requirements.txt
?Who did you ping on Mattermost to review your PR? Please ping that person again whenever you are ready for another review.
Breaking changes
If you made any breaking changes, please update the version number.
Breaking changes are totally fine, we just need to make sure to keep the users informed and the server in sync.
Does this PR break the API? If so, what is the corresponding server commit?
Does this PR break the user interface? If so, why?
Please do not mark comments/conversations as resolved unless you are the assigned reviewer. This helps maintain clarity during the review process.