Преглед изворни кода

Track mode selector opened in telemetry (#5150)

Matt Rubens пре 9 месеци
родитељ
комит
1c37b77e9d
2 измењених фајлова са 8 додато и 0 уклоњено
  1. 2 0
      packages/types/src/telemetry.ts
  2. 6 0
      webview-ui/src/components/chat/ModeSelector.tsx

+ 2 - 0
packages/types/src/telemetry.ts

@@ -25,6 +25,7 @@ export enum TelemetryEventName {
 	TASK_CONVERSATION_MESSAGE = "Conversation Message",
 	LLM_COMPLETION = "LLM Completion",
 	MODE_SWITCH = "Mode Switched",
+	MODE_SELECTOR_OPENED = "Mode Selector Opened",
 	TOOL_USED = "Tool Used",
 
 	CHECKPOINT_CREATED = "Checkpoint Created",
@@ -126,6 +127,7 @@ export const rooCodeTelemetryEventSchema = z.discriminatedUnion("type", [
 			TelemetryEventName.TASK_COMPLETED,
 			TelemetryEventName.TASK_CONVERSATION_MESSAGE,
 			TelemetryEventName.MODE_SWITCH,
+			TelemetryEventName.MODE_SELECTOR_OPENED,
 			TelemetryEventName.TOOL_USED,
 			TelemetryEventName.CHECKPOINT_CREATED,
 			TelemetryEventName.CHECKPOINT_RESTORED,

+ 6 - 0
webview-ui/src/components/chat/ModeSelector.tsx

@@ -9,6 +9,8 @@ import { useExtensionState } from "@/context/ExtensionStateContext"
 import { useAppTranslation } from "@/i18n/TranslationContext"
 import { Mode, getAllModes } from "@roo/modes"
 import { ModeConfig, CustomModePrompts } from "@roo-code/types"
+import { telemetryClient } from "@/utils/TelemetryClient"
+import { TelemetryEventName } from "@roo-code/types"
 
 interface ModeSelectorProps {
 	value: Mode
@@ -37,6 +39,10 @@ export const ModeSelector = ({
 	const { t } = useAppTranslation()
 
 	const trackModeSelectorOpened = () => {
+		// Track telemetry every time the mode selector is opened
+		telemetryClient.capture(TelemetryEventName.MODE_SELECTOR_OPENED)
+
+		// Track first-time usage for UI purposes
 		if (!hasOpenedModeSelector) {
 			setHasOpenedModeSelector(true)
 			vscode.postMessage({ type: "hasOpenedModeSelector", bool: true })