Skip to content

Commit cdcd53a

Browse files
committed
chore: add entry point telemetry
1 parent 4887664 commit cdcd53a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/compass-assistant/src/compass-assistant-provider.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { usePreference } from 'compass-preferences-model/provider';
1414
import { createLoggerLocator } from '@mongodb-js/compass-logging/provider';
1515
import type { ConnectionInfo } from '@mongodb-js/connection-info';
1616
import { redactConnectionString } from 'mongodb-connection-string-url';
17+
import { useTelemetry } from '@mongodb-js/compass-telemetry/provider';
1718

1819
export const ASSISTANT_DRAWER_ID = 'compass-assistant-drawer';
1920

@@ -88,6 +89,7 @@ export const AssistantProvider: React.FunctionComponent<
8889
chat: Chat<AssistantMessage>;
8990
}>
9091
> = ({ chat, children }) => {
92+
const track = useTelemetry();
9193
const assistantActionsContext = useRef<AssistantActionsContextType>({
9294
interpretExplainPlan: ({ explainPlan }) => {
9395
openDrawer(ASSISTANT_DRAWER_ID);
@@ -103,6 +105,9 @@ export const AssistantProvider: React.FunctionComponent<
103105
},
104106
{}
105107
);
108+
track('Assistant Entry Point Used', {
109+
source: 'explain plan',
110+
});
106111
},
107112
interpretConnectionError: ({ connectionInfo, error }) => {
108113
openDrawer(ASSISTANT_DRAWER_ID);
@@ -122,6 +127,9 @@ export const AssistantProvider: React.FunctionComponent<
122127
},
123128
{}
124129
);
130+
track('Assistant Entry Point Used', {
131+
source: 'connection error',
132+
});
125133
},
126134
clearChat: () => {
127135
chat.messages = [];

packages/compass-telemetry/src/telemetry-events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,10 +1490,10 @@ type AssistantFeedbackSubmittedEvent = CommonEvent<{
14901490
*
14911491
* @category Gen AI
14921492
*/
1493-
type AssistantEntryPointUsedEvent = ConnectionScopedEvent<{
1493+
type AssistantEntryPointUsedEvent = CommonEvent<{
14941494
name: 'Assistant Entry Point Used';
14951495
payload: {
1496-
source: 'explain plan' | 'performance insights' | 'error message';
1496+
source: 'explain plan' | 'performance insights' | 'connection error';
14971497
};
14981498
}>;
14991499

0 commit comments

Comments
 (0)