fix(posthog): disable feature flags, remove plugin_loaded event for billing optimization
- Remove plugin_loaded telemetry from index.ts (was 46.5% of all events, ~2.83M/month) - Add enableLocalEvaluation: false to prevent feature flag polling/decide calls - Add strictLocalEvaluation: true to prevent server fallback requests - Add disableRemoteConfig: true to prevent remote config network requests - Remove 'plugin_loaded' from PostHogActivityReason type - Update tests: remove stale mocks, add SDK options verification test - enableExceptionAutocapture: false already present (kept) Estimated billing reduction: ~$960+/month from feature flag requests, plus ~2.83M fewer events/month from plugin_loaded removal.
This commit is contained in:
@@ -29,7 +29,7 @@ const DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk7
|
||||
|
||||
type PostHogCaptureEvent = Parameters<PostHog["capture"]>[0]
|
||||
type PostHogSource = "cli" | "plugin"
|
||||
type PostHogActivityReason = "run_started" | "plugin_loaded"
|
||||
type PostHogActivityReason = "run_started"
|
||||
|
||||
type PostHogClient = {
|
||||
trackActive: (distinctId: string, reason: PostHogActivityReason) => void
|
||||
@@ -151,6 +151,9 @@ export function getPostHogDistinctId(): string {
|
||||
export function createCliPostHog(): PostHogClient {
|
||||
return createPostHogClient("cli", {
|
||||
enableExceptionAutocapture: false,
|
||||
enableLocalEvaluation: false,
|
||||
strictLocalEvaluation: true,
|
||||
disableRemoteConfig: true,
|
||||
flushAt: 1,
|
||||
flushInterval: 0,
|
||||
})
|
||||
@@ -159,6 +162,9 @@ export function createCliPostHog(): PostHogClient {
|
||||
export function createPluginPostHog(): PostHogClient {
|
||||
return createPostHogClient("plugin", {
|
||||
enableExceptionAutocapture: false,
|
||||
enableLocalEvaluation: false,
|
||||
strictLocalEvaluation: true,
|
||||
disableRemoteConfig: true,
|
||||
flushAt: 1,
|
||||
flushInterval: 0,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user