mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-19 08:28:06 +02:00
feat: emit sampled mcp telemetry
This commit is contained in:
parent
9956ce398f
commit
c6f3634fb3
6 changed files with 126 additions and 2 deletions
|
|
@ -26,6 +26,17 @@ type TelemetryEventFields<Name extends TelemetryEventName> = Omit<
|
|||
>;
|
||||
|
||||
const emittedProjectSnapshots = new Set<string>();
|
||||
const MCP_SAMPLE_RATE = 0.1 as const;
|
||||
let mcpSampled: boolean | undefined;
|
||||
|
||||
export function shouldEmitMcpTelemetry(): boolean {
|
||||
mcpSampled ??= Math.random() < MCP_SAMPLE_RATE;
|
||||
return mcpSampled;
|
||||
}
|
||||
|
||||
export function mcpTelemetrySampleRate(): 0.1 {
|
||||
return MCP_SAMPLE_RATE;
|
||||
}
|
||||
|
||||
async function emitInstallFirstRunIfNeeded(input: {
|
||||
identity: Awaited<ReturnType<typeof loadTelemetryIdentity>>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue