-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
chore: disable plugin server posthog capture if not set #29275
base: master
Are you sure you want to change the base?
Conversation
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.
PR Summary
This PR modifies the plugin server to conditionally capture PostHog analytics based on environment variables rather than using hardcoded values.
- Changed PostHog client initialization in
utils/posthog.ts
to only create a client whenPOSTHOG_API_KEY
is provided - Added null checks before using the PostHog client in
captureTeamEvent
andcaptureException
functions - Added new environment variables
POSTHOG_API_KEY
andPOSTHOG_HOST_URL
to thePluginsServerConfig
interface - Removed previous random sampling logic (10% of exceptions) that was used in production
- Set default values in config.ts: empty string for API key and 'http://localhost:8010' for host URL
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
One thing that might be nicer here, from the dev/hobby perspective, is to hit the DB and fetch team-1's token if none is set (maybe putting that behaviour behind an env var) - wdyt? something like |
@oliverb123 thought something like this might work when creating the config:
Problem is that the lookup will cause things to be async which has a whole array of changes. Given people were never getting plugin server events locally before (they were sent to production) I think it's ok to not capture them but default and let people add their keys locally if they want to test something |
Problem
The plugin server captures events from dev
Changes