Skip to content

Commit 3069056

Browse files
authored
chore: remove telemetry (#861)
1 parent 88c9185 commit 3069056

File tree

11 files changed

+30
-342
lines changed

11 files changed

+30
-342
lines changed

refact-agent/gui/src/app/middleware.ts

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import {
2020
import { setThemeMode, updateConfig } from "../features/Config/configSlice";
2121
import { resetAttachedImagesSlice } from "../features/AttachedImages";
2222
import { nextTip } from "../features/TipOfTheDay";
23-
import { telemetryApi } from "../services/refact/telemetry";
24-
import { CONFIG_PATH_URL, FULL_PATH_URL } from "../services/refact/consts";
23+
2524
import {
2625
ideToolCallResponse,
2726
ideForceReloadProjectTreeFiles,
@@ -349,73 +348,6 @@ startListening({
349348
},
350349
});
351350

352-
// Telemetry
353-
startListening({
354-
matcher: isAnyOf(
355-
pathApi.endpoints.getFullPath.matchFulfilled,
356-
pathApi.endpoints.getFullPath.matchRejected,
357-
pathApi.endpoints.customizationPath.matchFulfilled,
358-
pathApi.endpoints.customizationPath.matchRejected,
359-
pathApi.endpoints.privacyPath.matchFulfilled,
360-
pathApi.endpoints.privacyPath.matchRejected,
361-
pathApi.endpoints.integrationsPath.matchFulfilled,
362-
pathApi.endpoints.integrationsPath.matchRejected,
363-
),
364-
effect: (action, listenerApi) => {
365-
if (pathApi.endpoints.getFullPath.matchFulfilled(action)) {
366-
const thunk = telemetryApi.endpoints.sendTelemetryNetEvent.initiate({
367-
url: FULL_PATH_URL,
368-
scope: "getFullPath",
369-
success: true,
370-
error_message: "",
371-
});
372-
void listenerApi.dispatch(thunk);
373-
}
374-
375-
if (
376-
pathApi.endpoints.getFullPath.matchRejected(action) &&
377-
!action.meta.condition
378-
) {
379-
const thunk = telemetryApi.endpoints.sendTelemetryNetEvent.initiate({
380-
url: FULL_PATH_URL,
381-
scope: "getFullPath",
382-
success: false,
383-
error_message: action.error.message ?? JSON.stringify(action.error),
384-
});
385-
void listenerApi.dispatch(thunk);
386-
}
387-
388-
if (
389-
pathApi.endpoints.customizationPath.matchFulfilled(action) ||
390-
pathApi.endpoints.privacyPath.matchFulfilled(action) ||
391-
pathApi.endpoints.integrationsPath.matchFulfilled(action)
392-
) {
393-
const thunk = telemetryApi.endpoints.sendTelemetryNetEvent.initiate({
394-
url: CONFIG_PATH_URL,
395-
scope: action.meta.arg.endpointName,
396-
success: true,
397-
error_message: "",
398-
});
399-
void listenerApi.dispatch(thunk);
400-
}
401-
402-
if (
403-
(pathApi.endpoints.customizationPath.matchRejected(action) ||
404-
pathApi.endpoints.privacyPath.matchRejected(action) ||
405-
pathApi.endpoints.integrationsPath.matchRejected(action)) &&
406-
!action.meta.condition
407-
) {
408-
const thunk = telemetryApi.endpoints.sendTelemetryNetEvent.initiate({
409-
url: CONFIG_PATH_URL,
410-
scope: action.meta.arg.endpointName,
411-
success: false,
412-
error_message: action.error.message ?? JSON.stringify(action.error),
413-
});
414-
void listenerApi.dispatch(thunk);
415-
}
416-
},
417-
});
418-
419351
// TODO: this should let flexus know that the user accepted the tool
420352
// Tool Call results from ide.
421353
startListening({

refact-agent/gui/src/app/store.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
pingApi,
1919
integrationsApi,
2020
dockerApi,
21-
telemetryApi,
2221
providersApi,
2322
modelsApi,
2423
teamsApi,
@@ -87,7 +86,6 @@ const rootReducer = combineSlices(
8786
[pingApi.reducerPath]: pingApi.reducer,
8887
[linksApi.reducerPath]: linksApi.reducer,
8988
[checkpointsApi.reducerPath]: checkpointsApi.reducer,
90-
[telemetryApi.reducerPath]: telemetryApi.reducer,
9189
[teamsApi.reducerPath]: teamsApi.reducer,
9290
[providersApi.reducerPath]: providersApi.reducer,
9391
[modelsApi.reducerPath]: modelsApi.reducer,
@@ -174,7 +172,6 @@ export function setUpStore(preloadedState?: Partial<RootState>) {
174172
integrationsApi.middleware,
175173
dockerApi.middleware,
176174
checkpointsApi.middleware,
177-
telemetryApi.middleware,
178175
providersApi.middleware,
179176
modelsApi.middleware,
180177
teamsApi.middleware,

refact-agent/gui/src/components/ChatContent/AssistantInput.tsx

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import React, { useCallback } from "react";
1+
import React from "react";
22
import { Markdown } from "../Markdown";
33

44
import { Container, Box } from "@radix-ui/themes";
55
import { AssistantMessage, ToolCall } from "../../services/refact";
66
import { ToolContent } from "./ToolsContent";
7-
import { fallbackCopying } from "../../utils/fallbackCopying";
8-
import { telemetryApi } from "../../services/refact/telemetry";
97
import { ReasoningContent } from "./ReasoningContent";
8+
import { useCopyToClipboard } from "../../hooks";
109

1110
type ChatInputProps = {
1211
reasoningContent?: string | null;
@@ -20,43 +19,7 @@ export const AssistantInput: React.FC<ChatInputProps> = ({
2019
toolCalls,
2120
children,
2221
}) => {
23-
const [sendTelemetryEvent] =
24-
telemetryApi.useLazySendTelemetryChatEventQuery();
25-
26-
const handleCopy = useCallback(
27-
(text: string) => {
28-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
29-
if (window.navigator?.clipboard?.writeText) {
30-
void window.navigator.clipboard
31-
.writeText(text)
32-
.catch(() => {
33-
// eslint-disable-next-line no-console
34-
console.log("failed to copy to clipboard");
35-
void sendTelemetryEvent({
36-
scope: `codeBlockCopyToClipboard`,
37-
success: false,
38-
error_message:
39-
"window.navigator?.clipboard?.writeText: failed to copy to clipboard",
40-
});
41-
})
42-
.then(() => {
43-
void sendTelemetryEvent({
44-
scope: `codeBlockCopyToClipboard`,
45-
success: true,
46-
error_message: "",
47-
});
48-
});
49-
} else {
50-
fallbackCopying(text);
51-
void sendTelemetryEvent({
52-
scope: `codeBlockCopyToClipboard`,
53-
success: true,
54-
error_message: "",
55-
});
56-
}
57-
},
58-
[sendTelemetryEvent],
59-
);
22+
const handleCopy = useCopyToClipboard();
6023

6124
return (
6225
<Container position="relative">

refact-agent/gui/src/components/Dropzone/Dropzone.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Cross1Icon, ImageIcon } from "@radix-ui/react-icons";
44
import { DropzoneInputProps, FileRejection, useDropzone } from "react-dropzone";
55
import { useAttachedImages } from "../../hooks/useAttachedImages";
66
import { TruncateLeft } from "../Text";
7-
import { telemetryApi } from "../../services/refact/telemetry";
7+
88
// import { useCapsForToolUse } from "../../hooks";
99
import { useAttachedFiles } from "../ChatForm/useCheckBoxes";
1010

@@ -81,8 +81,6 @@ export const DropzoneProvider: React.FC<
8181
export const DropzoneConsumer = FileUploadContext.Consumer;
8282

8383
export const AttachImagesButton = () => {
84-
const [sendTelemetryEvent] =
85-
telemetryApi.useLazySendTelemetryChatEventQuery();
8684
const attachFileOnClick = useCallback(
8785
(
8886
event: { preventDefault: () => void; stopPropagation: () => void },
@@ -91,13 +89,8 @@ export const AttachImagesButton = () => {
9189
event.preventDefault();
9290
event.stopPropagation();
9391
open();
94-
void sendTelemetryEvent({
95-
scope: `addImage/button`, // add drag&drop and clipboard
96-
success: true,
97-
error_message: "",
98-
});
9992
},
100-
[sendTelemetryEvent],
93+
[],
10194
);
10295
return (
10396
<DropzoneConsumer>

refact-agent/gui/src/components/Toolbar/Toolbar.tsx

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
useEventsBusForIDE,
3535
} from "../../hooks";
3636
import { useWindowDimensions } from "../../hooks/useWindowDimensions";
37-
import { telemetryApi } from "../../services/refact/telemetry";
3837

3938
// import styles from "./Toolbar.module.css";
4039
import { resetThread } from "../../features/ThreadMessages";
@@ -71,8 +70,6 @@ export const Toolbar = ({ activeTab }: ToolbarProps) => {
7170
const [focus, _setFocus] = useState<HTMLElement | null>(null);
7271

7372
const refs = useTourRefs();
74-
const [sendTelemetryEvent] =
75-
telemetryApi.useLazySendTelemetryChatEventQuery();
7673

7774
// const history = useAppSelector(getHistory, {
7875
// devModeChecks: { stabilityCheck: "never" },
@@ -96,61 +93,26 @@ export const Toolbar = ({ activeTab }: ToolbarProps) => {
9693
(to: DropdownNavigationOptions | "chat") => {
9794
if (to === "settings") {
9895
openSettings();
99-
void sendTelemetryEvent({
100-
scope: `openSettings`,
101-
success: true,
102-
error_message: "",
103-
});
10496
} else if (to === "hot keys") {
10597
openHotKeys();
106-
void sendTelemetryEvent({
107-
scope: `openHotkeys`,
108-
success: true,
109-
error_message: "",
110-
});
11198
} else if (to === "fim") {
11299
dispatch(push({ name: "fill in the middle debug page" }));
113-
void sendTelemetryEvent({
114-
scope: `openDebugFim`,
115-
success: true,
116-
error_message: "",
117-
});
118100
} else if (to === "stats") {
119101
dispatch(push({ name: "statistics page" }));
120-
void sendTelemetryEvent({
121-
scope: `openStats`,
122-
success: true,
123-
error_message: "",
124-
});
125102
} else if (to === "restart tour") {
126103
dispatch(popBackTo({ name: "login page" }));
127104
dispatch(push({ name: "welcome" }));
128105
dispatch(restart());
129-
void sendTelemetryEvent({
130-
scope: `restartTour`,
131-
success: true,
132-
error_message: "",
133-
});
134106
} else if (to === "integrations") {
135107
dispatch(push({ name: "integrations page" }));
136-
void sendTelemetryEvent({
137-
scope: `openIntegrations`,
138-
success: true,
139-
error_message: "",
140-
});
141108
} else if (to === "providers") {
142109
dispatch(push({ name: "providers page" }));
143-
void sendTelemetryEvent({
144-
scope: `openProviders`,
145-
success: true,
146-
error_message: "",
147-
});
148110
} else if (to === "chat") {
149111
dispatch(popBackTo({ name: "history" }));
150112
dispatch(push({ name: "chat" }));
151113
}
152114
},
153-
[dispatch, sendTelemetryEvent, openSettings, openHotKeys],
115+
[dispatch, openSettings, openHotKeys],
154116
);
155117

156118
const onCreateNewChat = useCallback(() => {
@@ -160,12 +122,7 @@ export const Toolbar = ({ activeTab }: ToolbarProps) => {
160122
dispatch(resetThread());
161123
// clear out old chat
162124
handleNavigation("chat");
163-
void sendTelemetryEvent({
164-
scope: `openNewChat`,
165-
success: true,
166-
error_message: "",
167-
});
168-
}, [dispatch, sendTelemetryEvent, handleNavigation]);
125+
}, [dispatch, handleNavigation]);
169126

170127
const goToTab = useCallback(
171128
(tab: Tab) => {
@@ -183,13 +140,8 @@ export const Toolbar = ({ activeTab }: ToolbarProps) => {
183140
dispatch(popBackTo({ name: "history" }));
184141
dispatch(push({ name: "chat" }));
185142
}
186-
void sendTelemetryEvent({
187-
scope: `goToTab/${tab.type}`,
188-
success: true,
189-
error_message: "",
190-
});
191143
},
192-
[dispatch, shouldChatTabLinkBeNotClickable, sendTelemetryEvent],
144+
[dispatch, shouldChatTabLinkBeNotClickable],
193145
);
194146

195147
useEffect(() => {

refact-agent/gui/src/features/Login/LoginPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Accordion } from "../../components/Accordion";
1515
import { useLogin, useEmailLogin, useEventsBusForIDE } from "../../hooks";
1616
import { UnderConstruction } from "./UnderConstruction";
1717

18-
const IS_LOGIN_DISABLED = true;
18+
const IS_LOGIN_DISABLED = false;
1919

2020
export const LoginPage: React.FC = () => {
2121
const { loginWithProvider, polling, cancelLogin } = useLogin();

0 commit comments

Comments
 (0)