mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
refactor: add TelemetryProxy.tryCapture() convenience method
This commit is contained in:
@@ -399,11 +399,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
|
||||
await this.handleResetAllSettings()
|
||||
break
|
||||
case "telemetry":
|
||||
try {
|
||||
TelemetryProxy.getInstance().capture(message.event, message.properties)
|
||||
} catch {
|
||||
// TelemetryProxy not initialized — safe to ignore
|
||||
}
|
||||
TelemetryProxy.tryCapture(message.event, message.properties)
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
@@ -133,7 +133,7 @@ export class AutocompleteServiceManager {
|
||||
enableSmartInlineTaskKeybinding: false,
|
||||
})
|
||||
|
||||
TelemetryProxy.tryGetInstance()?.capture(TelemetryEventName.GHOST_SERVICE_DISABLED)
|
||||
TelemetryProxy.tryCapture(TelemetryEventName.GHOST_SERVICE_DISABLED)
|
||||
|
||||
await this.load()
|
||||
}
|
||||
@@ -231,7 +231,7 @@ export class AutocompleteServiceManager {
|
||||
}
|
||||
|
||||
this.taskId = crypto.randomUUID()
|
||||
TelemetryProxy.tryGetInstance()?.capture(TelemetryEventName.INLINE_ASSIST_AUTO_TASK, {
|
||||
TelemetryProxy.tryCapture(TelemetryEventName.INLINE_ASSIST_AUTO_TASK, {
|
||||
taskId: this.taskId,
|
||||
})
|
||||
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ export class AutocompleteTelemetry {
|
||||
...properties,
|
||||
autocompleteType: this.autocompleteType,
|
||||
}
|
||||
TelemetryProxy.tryGetInstance()?.capture(event, props)
|
||||
TelemetryProxy.tryCapture(event, props)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,14 @@ export class TelemetryProxy {
|
||||
return TelemetryProxy.instance
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire-and-forget capture that silently no-ops when the proxy has not been
|
||||
* initialised yet.
|
||||
*/
|
||||
static tryCapture(event: TelemetryEventName, properties?: Record<string, unknown>) {
|
||||
TelemetryProxy.tryGetInstance()?.capture(event, properties)
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the CLI server connection. Must be called before capture() will send events.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user