MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / initializeServerTelemetry

Function initializeServerTelemetry

apps/kimi-code/src/cli/telemetry.ts:85–113  ·  view source on GitHub ↗
(
  options: InitializeServerTelemetryOptions,
)

Source from the content-addressed store, hash-verified

83 * fire the startup event) share the same underlying client + sink.
84 */
85export function initializeServerTelemetry(
86 options: InitializeServerTelemetryOptions,
87): TelemetryClient {
88 const bootstrap = createCliTelemetryBootstrap();
89 const configPath = resolveConfigPath({ homeDir: bootstrap.homeDir });
90 const config = readServerTelemetryConfig(configPath);
91 const auth = new KimiAuthFacade({
92 homeDir: bootstrap.homeDir,
93 configPath,
94 identity: createKimiCodeHostIdentity(options.version),
95 });
96
97 initializeTelemetry({
98 homeDir: bootstrap.homeDir,
99 deviceId: bootstrap.deviceId,
100 enabled: config.telemetry !== false,
101 appName: CLI_USER_AGENT_PRODUCT,
102 version: options.version,
103 uiMode: WEB_UI_MODE,
104 model: config.defaultModel,
105 getAccessToken: async () => (await auth.getCachedAccessToken(KIMI_CODE_PROVIDER_NAME)) ?? null,
106 });
107
108 return {
109 track,
110 withContext: withTelemetryContext,
111 setContext: setTelemetryContext,
112 };
113}
114
115function readServerTelemetryConfig(
116 configPath: string,

Callers 2

runServerInProcessFunction · 0.90
telemetry.test.tsFile · 0.85

Calls 6

getCachedAccessTokenMethod · 0.95
resolveConfigPathFunction · 0.85
initializeTelemetryFunction · 0.85

Tested by

no test coverage detected