feat(telemetry): enable posthog geoip enrichment

This commit is contained in:
Andrey Avtomonov 2026-05-22 17:13:19 +02:00
parent 945ab263ac
commit 6ead25aa85
3 changed files with 3 additions and 6 deletions

View file

@ -25,7 +25,8 @@ Use any of these mechanisms to disable telemetry:
High-level signals only: which commands run, how long they take, whether they
succeed or fail, and basic environment metadata (CLI version, Node version, OS
platform). For project-level analysis, **ktx** sends a salted hash of the
project directory — never the raw path.
project directory — never the raw path. PostHog also derives an approximate
location (country and region) from the IP address used to send events.
## What we never collect

View file

@ -15,7 +15,6 @@ type PostHogClient = {
event: string;
properties: Record<string, unknown>;
groups?: Record<string, string>;
disableGeoip?: boolean;
}): void;
groupIdentify(event: { groupType: string; groupKey: string; distinctId?: string }): void;
shutdown(): Promise<void> | void;
@ -47,7 +46,7 @@ async function getPostHogClient(projectApiKey: string, host: string): Promise<Po
}
clientPromise ??= import('posthog-node')
.then(({ PostHog }) => new PostHog(projectApiKey, { host, flushAt: 1, flushInterval: 0, disableGeoip: true }))
.then(({ PostHog }) => new PostHog(projectApiKey, { host, flushAt: 1, flushInterval: 0 }))
.catch(() => null);
return await clientPromise;
@ -146,7 +145,6 @@ export async function trackTelemetryEvent(input: {
event: input.event.name,
properties: input.event.properties,
groups: input.projectId ? { project: input.projectId } : undefined,
disableGeoip: true,
});
} catch {
return;

View file

@ -94,14 +94,12 @@ def track_telemetry_event(
flush_interval=0,
sync_mode=True,
timeout=1,
disable_geoip=True,
)
client.capture(
event=event["event"],
distinct_id=identity.install_id,
properties=event["properties"],
groups=groups,
disable_geoip=True,
)
client.shutdown()
except Exception: