mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
refactor: rename TelemetryProxy.tryCapture to capture
This commit is contained in:
@@ -113,10 +113,10 @@ All events are defined in `TelemetryEventName` enum (`packages/types/src/telemet
|
||||
|
||||
| Event | Properties | Capture Method |
|
||||
| ---------------------- | ----------------------------------- | ----------------------------------------------------------- |
|
||||
| `Task Created` | `taskId` | `TelemetryProxy.tryCapture(TelemetryEventName.TASK_CREATED)` |
|
||||
| `Task Reopened` | `taskId` | `TelemetryProxy.tryCapture(TelemetryEventName.TASK_RESTARTED)` |
|
||||
| `Task Completed` | `taskId` | `TelemetryProxy.tryCapture(TelemetryEventName.TASK_COMPLETED)` |
|
||||
| `Conversation Message` | `taskId`, `source` (user/assistant) | `TelemetryProxy.tryCapture(TelemetryEventName.TASK_CONVERSATION_MESSAGE)` |
|
||||
| `Task Created` | `taskId` | `TelemetryProxy.capture(TelemetryEventName.TASK_CREATED)` |
|
||||
| `Task Reopened` | `taskId` | `TelemetryProxy.capture(TelemetryEventName.TASK_RESTARTED)` |
|
||||
| `Task Completed` | `taskId` | `TelemetryProxy.capture(TelemetryEventName.TASK_COMPLETED)` |
|
||||
| `Conversation Message` | `taskId`, `source` (user/assistant) | `TelemetryProxy.capture(TelemetryEventName.TASK_CONVERSATION_MESSAGE)` |
|
||||
|
||||
### 3.2 LLM & AI
|
||||
|
||||
@@ -309,7 +309,7 @@ Both have type guards (`isApiProviderError()`, `isConsecutiveMistakeError()`) an
|
||||
1. **Use `kilo-telemetry` via CLI proxy** — all PostHog communication goes through the CLI's `POST /telemetry/capture` endpoint. The extension does not include `posthog-node` or `posthog-js` directly.
|
||||
2. **Singleton pattern** — single `TelemetryProxy` instance that sends to CLI + logs to console, no pluggable clients
|
||||
3. **Properties provider pattern** — `KiloProvider` implements `TelemetryPropertiesProvider` to inject VS Code context into every event
|
||||
4. **Typed events** — all event names in an enum, callers use `TelemetryProxy.tryCapture(TelemetryEventName.XXX, props)`
|
||||
4. **Typed events** — all event names in an enum, callers use `TelemetryProxy.capture(TelemetryEventName.XXX, props)`
|
||||
5. **Event filtering** — `TelemetryProxy` can include/exclude specific events before forwarding to CLI
|
||||
6. **Property filtering** — privacy controls applied before forwarding to CLI
|
||||
7. **Dual opt-in** — respect both IDE-level and extension-level telemetry settings
|
||||
|
||||
@@ -395,7 +395,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
|
||||
await this.handleResetAllSettings()
|
||||
break
|
||||
case "telemetry":
|
||||
TelemetryProxy.tryCapture(message.event, message.properties)
|
||||
TelemetryProxy.capture(message.event, message.properties)
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
@@ -133,7 +133,7 @@ export class AutocompleteServiceManager {
|
||||
enableSmartInlineTaskKeybinding: false,
|
||||
})
|
||||
|
||||
TelemetryProxy.tryCapture(TelemetryEventName.GHOST_SERVICE_DISABLED)
|
||||
TelemetryProxy.capture(TelemetryEventName.GHOST_SERVICE_DISABLED)
|
||||
|
||||
await this.load()
|
||||
}
|
||||
@@ -231,7 +231,7 @@ export class AutocompleteServiceManager {
|
||||
}
|
||||
|
||||
this.taskId = crypto.randomUUID()
|
||||
TelemetryProxy.tryCapture(TelemetryEventName.INLINE_ASSIST_AUTO_TASK, {
|
||||
TelemetryProxy.capture(TelemetryEventName.INLINE_ASSIST_AUTO_TASK, {
|
||||
taskId: this.taskId,
|
||||
})
|
||||
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ export class AutocompleteTelemetry {
|
||||
...properties,
|
||||
autocompleteType: this.autocompleteType,
|
||||
}
|
||||
TelemetryProxy.tryCapture(event, props)
|
||||
TelemetryProxy.capture(event, props)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ export class TelemetryProxy {
|
||||
return (TelemetryProxy.singleton ??= new TelemetryProxy())
|
||||
}
|
||||
|
||||
static tryCapture(event: TelemetryEventName, properties?: Record<string, unknown>) {
|
||||
static capture(event: TelemetryEventName, properties?: Record<string, unknown>) {
|
||||
TelemetryProxy.getInstance().capture(event, properties)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user