fix(telemetry): remove PostHog HAU tracking, keep DAU only
This commit is contained in:
+20
-13
@@ -5,6 +5,25 @@ import packageJson from "../../package.json" with { type: "json" }
|
||||
import { PLUGIN_NAME, PUBLISHED_PACKAGE_NAME } from "./plugin-identity"
|
||||
import { getPostHogActivityCaptureState } from "./posthog-activity-state"
|
||||
|
||||
/** @internal test-only seam: keep null in production to use the real implementation. */
|
||||
let activityStateProviderOverride: typeof getPostHogActivityCaptureState | null = null
|
||||
|
||||
function resolveActivityState(): ReturnType<typeof getPostHogActivityCaptureState> {
|
||||
return (activityStateProviderOverride ?? getPostHogActivityCaptureState)()
|
||||
}
|
||||
|
||||
/** @internal test-only */
|
||||
export function __setActivityStateProviderForTesting(
|
||||
provider: typeof getPostHogActivityCaptureState,
|
||||
): void {
|
||||
activityStateProviderOverride = provider
|
||||
}
|
||||
|
||||
/** @internal test-only */
|
||||
export function __resetActivityStateProviderForTesting(): void {
|
||||
activityStateProviderOverride = null
|
||||
}
|
||||
|
||||
const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com"
|
||||
const DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74"
|
||||
|
||||
@@ -128,7 +147,7 @@ function createPostHogClient(
|
||||
})
|
||||
},
|
||||
trackActive: (distinctId, reason) => {
|
||||
const activityState = getPostHogActivityCaptureState()
|
||||
const activityState = resolveActivityState()
|
||||
|
||||
if (activityState.captureDaily) {
|
||||
configuredClient.capture({
|
||||
@@ -141,18 +160,6 @@ function createPostHogClient(
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (activityState.captureHourly) {
|
||||
configuredClient.capture({
|
||||
distinctId,
|
||||
event: "omo_hourly_active",
|
||||
properties: {
|
||||
...sharedProperties,
|
||||
hour_utc: activityState.hourUTC,
|
||||
reason,
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
shutdown: async () => configuredClient.shutdown(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user