Skip to content

Commit e504b9d

Browse files
authored
Trevhud/telem defaults (RooCodeInc#3449)
* fresh install mode * add nocapture * add ui host * changeset
1 parent 312777d commit e504b9d

File tree

20 files changed

+130
-54
lines changed

20 files changed

+130
-54
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
introduce front end tracking for those who have opted in to telemetry

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,28 @@
1616
"IS_DEV": "true",
1717
"DEV_WORKSPACE_FOLDER": "${workspaceFolder}"
1818
}
19+
},
20+
{
21+
"name": "Run Extension (Fresh Install Mode)",
22+
"type": "extensionHost",
23+
"request": "launch",
24+
"runtimeExecutable": "${execPath}",
25+
"args": [
26+
"--profile-temp",
27+
"--sync",
28+
"off",
29+
"--disable-extensions",
30+
"--extensionDevelopmentPath=${workspaceFolder}",
31+
"${workspaceFolder}"
32+
],
33+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
34+
"preLaunchTask": "clean-sandbox",
35+
"internalConsoleOptions": "openOnSessionStart",
36+
"postDebugTask": "stop",
37+
"env": {
38+
"IS_DEV": "true",
39+
"DEV_WORKSPACE_FOLDER": "${workspaceFolder}"
40+
}
1941
}
2042
]
2143
}

.vscode/tasks.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@
185185
"label": "stop",
186186
"command": "echo ${input:terminate}",
187187
"type": "shell"
188+
},
189+
{
190+
"label": "clean-sandbox",
191+
"type": "shell",
192+
"dependsOn": ["watch"],
193+
"command": "rm -rf .vscode-dev"
188194
}
189195
],
190196
"inputs": [

docs/more-info/telemetry.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ For complete transparency, you can inspect our [telemetry implementation](https:
2626

2727
### How to Opt Out
2828

29-
Telemetry in Cline is entirely optional and requires your explicit consent:
29+
Telemetry in Cline is entirely optional:
3030

31-
- When you update or install our VS Code extension, you'll see a simple prompt: "Help Improve Cline" with Allow or Deny options
31+
- When you update or install our VS Code extension, you'll see a message about our anonymous telemetry
3232
- You can change your preference anytime in settings
3333

3434
Cline also respects VS Code's global telemetry settings. If you've disabled telemetry at the VS Code level, Cline's telemetry will automatically be disabled as well.

src/core/controller/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export class Controller {
249249
// If user already opted in to telemetry, enable telemetry service
250250
this.getStateToPostToWebview().then((state) => {
251251
const { telemetrySetting } = state
252-
const isOptedIn = telemetrySetting === "enabled"
252+
const isOptedIn = telemetrySetting !== "disabled"
253253
telemetryService.updateTelemetryState(isOptedIn)
254254
})
255255
break
@@ -673,7 +673,7 @@ export class Controller {
673673

674674
async updateTelemetrySetting(telemetrySetting: TelemetrySetting) {
675675
await updateGlobalState(this.context, "telemetrySetting", telemetrySetting)
676-
const isOptedIn = telemetrySetting === "enabled"
676+
const isOptedIn = telemetrySetting !== "disabled"
677677
telemetryService.updateTelemetryState(isOptedIn)
678678
}
679679

src/services/posthog/PostHogClientProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class PostHogClientProvider {
99
this.client = new PostHog(posthogConfig.apiKey, {
1010
host: posthogConfig.host,
1111
enableExceptionAutocapture: false,
12+
defaultOptIn: false,
1213
})
1314
}
1415

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Public PostHog key (safe for open source)
22
export const posthogConfig = {
33
apiKey: "phc_qfOAGxZw2TL5O8p9KYd9ak3bPBFzfjC8fy5L6jNWY7K",
4-
host: "https://us.i.posthog.com",
4+
host: "https://data.cline.bot",
5+
uiHost: "https://us.posthog.com",
56
}

webview-ui/src/CustomPostHogProvider.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ import { useExtensionState } from "./context/ExtensionStateContext"
66

77
export function CustomPostHogProvider({ children }: { children: ReactNode }) {
88
const { telemetrySetting } = useExtensionState()
9-
const isTelemetryEnabled = telemetrySetting === "enabled"
9+
const isTelemetryEnabled = telemetrySetting !== "disabled"
1010

1111
useEffect(() => {
12+
posthog.init(posthogConfig.apiKey, {
13+
api_host: posthogConfig.host,
14+
ui_host: posthogConfig.uiHost,
15+
opt_out_capturing_by_default: true,
16+
disable_session_recording: true,
17+
capture_pageview: false,
18+
capture_dead_clicks: true,
19+
})
20+
1221
if (isTelemetryEnabled) {
13-
posthog.init(posthogConfig.apiKey, {
14-
api_host: posthogConfig.host,
15-
autocapture: false,
16-
disable_session_recording: true,
17-
})
22+
posthog.opt_in_capturing()
1823
} else {
1924
posthog.opt_out_capturing()
2025
}

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export const ChatRowContent = ({
378378
marginBottom: "-1.5px",
379379
}}></span>
380380
),
381-
<span style={{ color: normalColor, fontWeight: "bold", wordBreak: "break-word" }}>
381+
<span className="ph-no-capture" style={{ color: normalColor, fontWeight: "bold", wordBreak: "break-word" }}>
382382
Cline wants to {mcpServerUse.type === "use_mcp_tool" ? "use a tool" : "access a resource"} on the{" "}
383383
<code style={{ wordBreak: "break-all" }}>
384384
{getMcpServerDisplayName(mcpServerUse.serverName, mcpMarketplaceCatalog)}
@@ -493,7 +493,7 @@ export const ChatRowContent = ({
493493
}
494494
const toolIcon = (name: string, color?: string, rotation?: number, title?: string) => (
495495
<span
496-
className={`codicon codicon-${name}`}
496+
className={`codicon codicon-${name} ph-no-capture`}
497497
style={{
498498
color: color ? colorMap[color as keyof typeof colorMap] || color : "var(--vscode-foreground)",
499499
marginBottom: "-1.5px",
@@ -577,6 +577,7 @@ export const ChatRowContent = ({
577577
}}>
578578
{tool.path?.startsWith(".") && <span>.</span>}
579579
<span
580+
className="ph-no-capture"
580581
style={{
581582
whiteSpace: "nowrap",
582583
overflow: "hidden",
@@ -999,12 +1000,13 @@ export const ChatRowContent = ({
9991000
}}
10001001
/>
10011002
</span>
1002-
{message.text}
1003+
<span className="ph-no-capture">{message.text}</span>
10031004
</div>
10041005
) : (
10051006
<div style={{ display: "flex", alignItems: "center" }}>
10061007
<span style={{ fontWeight: "bold", marginRight: "4px" }}>Thinking:</span>
10071008
<span
1009+
className="ph-no-capture"
10081010
style={{
10091011
whiteSpace: "nowrap",
10101012
overflow: "hidden",

webview-ui/src/components/chat/ContextMenu.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
9393
if (option.value) {
9494
return (
9595
<div style={{ display: "flex", flexDirection: "column", gap: 0 }}>
96-
<span style={{ lineHeight: "1.2" }}>{option.label}</span>
96+
<span className="ph-no-capture" style={{ lineHeight: "1.2" }}>
97+
{option.label}
98+
</span>
9799
<span
100+
className="ph-no-capture"
98101
style={{
99102
fontSize: "0.85em",
100103
opacity: 0.7,
@@ -118,6 +121,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
118121
<span>/</span>
119122
{option.value?.startsWith("/.") && <span>.</span>}
120123
<span
124+
className="ph-no-capture"
121125
style={{
122126
whiteSpace: "nowrap",
123127
overflow: "hidden",

0 commit comments

Comments
 (0)