mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
refactor: remove typed capture helpers from TelemetryProxy
This commit is contained in:
@@ -111,12 +111,12 @@ All events are defined in `TelemetryEventName` enum (`packages/types/src/telemet
|
||||
|
||||
### 3.1 Task Lifecycle
|
||||
|
||||
| Event | Properties | Capture Method |
|
||||
| ---------------------- | ----------------------------------- | ------------------------------ |
|
||||
| `Task Created` | `taskId` | `captureTaskCreated()` |
|
||||
| `Task Reopened` | `taskId` | `captureTaskRestarted()` |
|
||||
| `Task Completed` | `taskId` | `captureTaskCompleted()` |
|
||||
| `Conversation Message` | `taskId`, `source` (user/assistant) | `captureConversationMessage()` |
|
||||
| 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)` |
|
||||
|
||||
### 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, with typed capture methods on the service
|
||||
4. **Typed events** — all event names in an enum, callers use `TelemetryProxy.tryCapture(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
|
||||
|
||||
@@ -135,66 +135,6 @@ export class TelemetryProxy {
|
||||
this.capture(TelemetryEventName.SCHEMA_VALIDATION_ERROR, properties)
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Typed capture helpers
|
||||
// ============================================
|
||||
|
||||
captureTaskCreated(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.TASK_CREATED, properties)
|
||||
}
|
||||
|
||||
captureTaskReopened(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.TASK_RESTARTED, properties)
|
||||
}
|
||||
|
||||
captureTaskCompleted(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.TASK_COMPLETED, properties)
|
||||
}
|
||||
|
||||
captureConversationMessage(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.TASK_CONVERSATION_MESSAGE, properties)
|
||||
}
|
||||
|
||||
captureLlmCompletion(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.LLM_COMPLETION, properties)
|
||||
}
|
||||
|
||||
captureToolUsed(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.TOOL_USED, properties)
|
||||
}
|
||||
|
||||
captureModeSwitched(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.MODE_SWITCH, properties)
|
||||
}
|
||||
|
||||
captureCheckpointCreated(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.CHECKPOINT_CREATED, properties)
|
||||
}
|
||||
|
||||
captureCheckpointRestored(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.CHECKPOINT_RESTORED, properties)
|
||||
}
|
||||
|
||||
captureCheckpointDiffed(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.CHECKPOINT_DIFFED, properties)
|
||||
}
|
||||
|
||||
captureTabShown(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.TAB_SHOWN, properties)
|
||||
}
|
||||
|
||||
captureTitleButtonClicked(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.TITLE_BUTTON_CLICKED, properties)
|
||||
}
|
||||
|
||||
capturePromptEnhanced(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.PROMPT_ENHANCED, properties)
|
||||
}
|
||||
|
||||
captureCodeActionUsed(properties: Record<string, unknown>) {
|
||||
this.capture(TelemetryEventName.CODE_ACTION_USED, properties)
|
||||
}
|
||||
|
||||
/**
|
||||
* No-op — the CLI server handles PostHog shutdown.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user