-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve tracking of development instances (resolves #1518) #1519
Conversation
I quite like this |
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 think it'd be best just to generate a random user ID to be able to capture this before the team is actually created, otherwise we'll lose most of the "development server launched" events as it's likely this code will not run again for a user running a development installation.
We could maybe use MAC address as distinct ID as something more-or-less static (either only before a user account is created or always in case of DEBUG instances)? |
I like that idea, maybe to avoid any privacy concerns, just a hash of the MAC address instead |
Done. Opted for exclusively using MAC address hashed with MD5 when running with DEBUG on, as that should allow us to identify development instances with 99% consistency (the 1% being MAC address changes in the meantime or possibly errors). |
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.
Looks good to me!
I wondered if we have a sense of how many users have debug = 1 in production (given that PostHog is an internal tool for most people). With the various deployment methods, does it default into debug = 1 unless users change it? Just wondered if we may be using a lot of info here. |
It shouldn't default, so such cases should be rather rare. |
Perfect, thanks for confirming! |
Changes
This will disable
posthoganalytics
whenDEBUG
is truthy, after sending only one event: "development instance launched". The user distinct ID user here is the one of the first user of the first team (presumably the person setting up the instance). The downside is that first there has to be a user, so completely fresh instances with no user yet aren't reported due to lack of distinct ID. Maybe there's a solution to this.