Track mode selector opened in telemetry (#5150)

This commit is contained in:
Matt Rubens 2025-06-26 15:19:58 -04:00 committed by GitHub
parent 5c9b476d5b
commit 1c37b77e9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -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,

View file

@ -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 })