Skip to content

Commit 5be24aa

Browse files
[AXON-1545] refactor rovodev analytics
1 parent 8b26c16 commit 5be24aa

14 files changed

+851
-690
lines changed

src/analytics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { IssueSuggestionSettings } from './config/configuration';
1414
import { BitbucketIssuesTreeViewId, PullRequestTreeViewId } from './constants';
1515
import { Container } from './container';
1616
import { QuickFlowAnalyticsEvent } from './onboarding/quickFlow/types';
17-
import { RovoDevCommonParams, RovoDevPerfEvent } from './rovo-dev/analytics/rovodevAnalyticsTypes';
17+
import { RovoDevCommonParams, RovodevPerformanceTag } from './rovo-dev/analytics/events';
1818
import { NotificationSurface, NotificationType } from './views/notifications/notificationManager';
1919
import { NotificationSource } from './views/notifications/notificationSources';
2020

@@ -222,7 +222,7 @@ interface JiraIssueTypeParams {
222222
}
223223

224224
export function performanceEvent(
225-
tag: RovoDevPerfEvent,
225+
tag: RovodevPerformanceTag,
226226
measure: number,
227227
params: RovoDevCommonParams,
228228
): Promise<TrackEvent>;

src/rovo-dev/analytics/events.ts

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
// All Rovo Dev analytics events and types
2+
// TODO: generate these automatically based on external spec, ideally with descriptions as docs
3+
4+
export type RovoDevEnv = 'IDE' | 'Boysenberry';
5+
6+
export const RovodevPerformanceTags = {
7+
timeToFirstByte: 'api.rovodev.chat.response.timeToFirstByte',
8+
timeToFirstMessage: 'api.rovodev.chat.response.timeToFirstMessage',
9+
timeToTechPlan: 'api.rovodev.chat.response.timeToTechPlan',
10+
timeToLastMessage: 'api.rovodev.chat.response.timeToLastMessage',
11+
} as const;
12+
13+
export type RovodevPerformanceTag = (typeof RovodevPerformanceTags)[keyof typeof RovodevPerformanceTags];
14+
15+
export type RovoDevCommonParams = {
16+
rovoDevEnv: RovoDevEnv;
17+
appInstanceId: string;
18+
rovoDevSessionId: string;
19+
rovoDevPromptId: string;
20+
};
21+
22+
export namespace Track {
23+
export type NewSessionAction = {
24+
action: 'rovoDevNewSessionAction';
25+
subject: 'atlascode';
26+
attributes: {
27+
rovoDevEnv: RovoDevEnv;
28+
appInstanceId: string;
29+
sessionId: string;
30+
isManuallyCreated: boolean;
31+
};
32+
};
33+
34+
export type PromptSent = {
35+
action: 'rovoDevPromptSent';
36+
subject: 'atlascode';
37+
attributes: {
38+
rovoDevEnv: RovoDevEnv;
39+
appInstanceId: string;
40+
sessionId: string;
41+
promptId: string;
42+
deepPlanEnabled: boolean;
43+
};
44+
};
45+
46+
export type TechnicalPlanningShown = {
47+
action: 'rovoDevTechnicalPlanningShown';
48+
subject: 'atlascode';
49+
attributes: {
50+
rovoDevEnv: RovoDevEnv;
51+
appInstanceId: string;
52+
sessionId: string;
53+
promptId: string;
54+
stepsCount: number;
55+
filesCount: number;
56+
questionsCount: number;
57+
};
58+
};
59+
60+
export type FilesSummaryShown = {
61+
action: 'rovoDevFilesSummaryShown';
62+
subject: 'atlascode';
63+
attributes: {
64+
rovoDevEnv: RovoDevEnv;
65+
appInstanceId: string;
66+
sessionId: string;
67+
promptId: string;
68+
filesCount: number;
69+
};
70+
};
71+
72+
export type FileChangedAction = {
73+
action: 'rovoDevFileChangedAction';
74+
subject: 'atlascode';
75+
attributes: {
76+
rovoDevEnv: RovoDevEnv;
77+
appInstanceId: string;
78+
sessionId: string;
79+
promptId: string;
80+
action: 'undo' | 'keep';
81+
filesCount: number;
82+
};
83+
};
84+
85+
export type StopAction = {
86+
action: 'rovoDevStopAction';
87+
subject: 'atlascode';
88+
attributes: {
89+
rovoDevEnv: RovoDevEnv;
90+
appInstanceId: string;
91+
sessionId: string;
92+
promptId: string;
93+
failed?: boolean;
94+
};
95+
};
96+
97+
export type GitPushAction = {
98+
action: 'rovoDevGitPushAction';
99+
subject: 'atlascode';
100+
attributes: {
101+
rovoDevEnv: RovoDevEnv;
102+
appInstanceId: string;
103+
sessionId: string;
104+
promptId: string;
105+
prCreated: boolean;
106+
};
107+
};
108+
109+
export type DetailsExpanded = {
110+
action: 'rovoDevDetailsExpanded';
111+
subject: 'atlascode';
112+
attributes: {
113+
rovoDevEnv: RovoDevEnv;
114+
appInstanceId: string;
115+
sessionId: string;
116+
promptId: string;
117+
};
118+
};
119+
120+
export type CreatePrButtonClicked = {
121+
action: 'clicked';
122+
subject: 'rovoDevCreatePrButton';
123+
attributes: {
124+
rovoDevEnv: RovoDevEnv;
125+
appInstanceId: string;
126+
sessionId: string;
127+
promptId: string;
128+
};
129+
};
130+
131+
export type AiResultViewed = {
132+
action: 'viewed';
133+
subject: 'aiResult';
134+
attributes: {
135+
rovoDevEnv: RovoDevEnv;
136+
appInstanceId: string;
137+
sessionId: string;
138+
promptId: string;
139+
dwellMs: number;
140+
xid: string;
141+
singleInstrumentationID: string;
142+
aiFeatureName: string;
143+
proactiveGeneratedAI: number;
144+
userGeneratedAI: number;
145+
isAIFeature: number;
146+
};
147+
};
148+
149+
// TODO: rovodev metadata fields here are different from other events, reconcile later?
150+
export type PerformanceEvent = {
151+
action: 'performanceEvent';
152+
subject: 'atlascode';
153+
attributes: {
154+
tag: RovodevPerformanceTag;
155+
measure: number;
156+
rovoDevEnv: RovoDevEnv;
157+
appInstanceId: string;
158+
rovoDevSessionId: string;
159+
rovoDevPromptId: string;
160+
};
161+
};
162+
}
163+
164+
export type TrackEvent =
165+
| Track.NewSessionAction
166+
| Track.PromptSent
167+
| Track.TechnicalPlanningShown
168+
| Track.FilesSummaryShown
169+
| Track.FileChangedAction
170+
| Track.StopAction
171+
| Track.GitPushAction
172+
| Track.DetailsExpanded
173+
| Track.CreatePrButtonClicked
174+
| Track.AiResultViewed
175+
| Track.PerformanceEvent;

0 commit comments

Comments
 (0)