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

Method attachSink

packages/telemetry/src/client.ts:41–58  ·  view source on GitHub ↗
(sink: EventSink)

Source from the content-addressed store, hash-verified

39 }
40
41 attachSink(sink: EventSink): void {
42 if (this.sink !== null && this.sink !== sink) {
43 this.sink.stopPeriodicFlush();
44 this.sink.flushSync();
45 }
46 this.sink = sink;
47 for (const event of this.queue) {
48 const record = toTelemetryEvent(event);
49 if (record.device_id === null && event.contextOverrides?.deviceId !== true) {
50 record.device_id = this.deviceId;
51 }
52 if (record.session_id === null && event.contextOverrides?.sessionId !== true) {
53 record.session_id = this.sessionId;
54 }
55 sink.accept(record);
56 }
57 this.queue = [];
58 }
59
60 disable(): void {
61 this.disabled = true;

Callers 4

telemetry.test.tsFile · 0.45
attachSinkMethod · 0.45
attachSinkFunction · 0.45
initializeTelemetryFunction · 0.45

Calls 4

toTelemetryEventFunction · 0.85
stopPeriodicFlushMethod · 0.80
acceptMethod · 0.80
flushSyncMethod · 0.65

Tested by

no test coverage detected