Skip to content

Commit 0dd5f1b

Browse files
committed
add new schema for new metrics, the new one is named copilotMetrics, the old one is called metrics
1 parent f573fef commit 0dd5f1b

File tree

2 files changed

+229
-1
lines changed

2 files changed

+229
-1
lines changed

src/model/Copilot_Metrics.ts

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
2+
export class CopilotIdeCodeCompletionsEditorModelLanguage {
3+
name: string;
4+
total_engaged_users: number;
5+
total_code_suggestions: number;
6+
total_code_acceptances: number;
7+
total_code_lines_suggested: number;
8+
total_code_lines_accepted: number;
9+
10+
constructor(data: any) {
11+
this.name = data.name;
12+
this.total_engaged_users = data.total_engaged_users;
13+
this.total_code_suggestions = data.total_code_suggestions;
14+
this.total_code_acceptances = data.total_code_acceptances;
15+
this.total_code_lines_suggested = data.total_code_lines_suggested;
16+
this.total_code_lines_accepted = data.total_code_lines_accepted;
17+
}
18+
}
19+
export class CopilotIdeCodeCompletionsEditorModel {
20+
name: string;
21+
is_custom_model: boolean;
22+
custom_model_training_date?: string | null;
23+
total_engaged_users: number;
24+
languages: CopilotIdeCodeCompletionsEditorModelLanguage[];
25+
26+
constructor(data: any) {
27+
this.name = data.name;
28+
this.is_custom_model = data.is_custom_model;
29+
this.custom_model_training_date = data.custom_model_training_date || null;
30+
this.total_engaged_users = data.total_engaged_users;
31+
this.languages = data.languages
32+
? data.languages.map(
33+
(lang: any) => new CopilotIdeCodeCompletionsEditorModelLanguage(lang)
34+
)
35+
: [];
36+
}
37+
}
38+
export class CopilotIdeCodeCompletionsEditor {
39+
name: string;
40+
total_engaged_users: number;
41+
models: CopilotIdeCodeCompletionsEditorModel[];
42+
43+
constructor(data: any) {
44+
this.name = data.name;
45+
this.total_engaged_users = data.total_engaged_users;
46+
this.models = data.models
47+
? data.models.map((model: any) => new CopilotIdeCodeCompletionsEditorModel(model))
48+
: [];
49+
}
50+
}
51+
52+
export class CopilotIdeCodeCompletionsLanguage {
53+
name: string;
54+
total_engaged_users: number;
55+
56+
constructor(data: any) {
57+
this.name = data.name;
58+
this.total_engaged_users = data.total_engaged_users;
59+
}
60+
}
61+
export class CopilotIdeCodeCompletions {
62+
total_engaged_users: number;
63+
languages: CopilotIdeCodeCompletionsLanguage[];
64+
editors: CopilotIdeCodeCompletionsEditor[];
65+
66+
constructor(data: any) {
67+
this.total_engaged_users = data.total_engaged_users;
68+
this.languages = data.languages
69+
? data.languages.map((lang: any) => new CopilotIdeCodeCompletionsLanguage(lang))
70+
: [];
71+
this.editors = data.editors
72+
? data.editors.map((editor: any) => new CopilotIdeCodeCompletionsEditor(editor))
73+
: [];
74+
}
75+
76+
77+
}
78+
79+
export class CopilotIdeChatEditorModel {
80+
name: string;
81+
is_custom_model: boolean;
82+
custom_model_training_date?: string | null;
83+
total_engaged_users: number;
84+
total_chats: number;
85+
total_chat_insertion_events: number;
86+
total_chat_copy_events: number;
87+
88+
constructor(data: any) {
89+
this.name = data.name;
90+
this.is_custom_model = data.is_custom_model;
91+
this.custom_model_training_date = data.custom_model_training_date || null;
92+
this.total_engaged_users = data.total_engaged_users;
93+
this.total_chats = data.total_chats;
94+
this.total_chat_insertion_events = data.total_chat_insertion_events;
95+
this.total_chat_copy_events = data.total_chat_copy_events;
96+
}
97+
}
98+
99+
100+
101+
export class CopilotIdeChatEditor {
102+
name: string;
103+
total_engaged_users: number;
104+
models: CopilotIdeChatEditorModel[];
105+
106+
constructor(data: any) {
107+
this.name = data.name;
108+
this.total_engaged_users = data.total_engaged_users;
109+
this.models = data.models
110+
? data.models.map((model: any) => new CopilotIdeChatEditorModel(model))
111+
: [];
112+
}
113+
}
114+
115+
export class CopilotIdeChat {
116+
total_engaged_users: number;
117+
editors: CopilotIdeChatEditor[];
118+
119+
constructor(data: any) {
120+
this.total_engaged_users = data.total_engaged_users;
121+
this.editors = data.editors
122+
? data.editors.map((editor: any) => new CopilotIdeChatEditor(editor))
123+
: [];
124+
}
125+
}
126+
127+
export class CopilotDotcomChatModel {
128+
name: string;
129+
is_custom_model: boolean;
130+
custom_model_training_date?: string | null;
131+
total_engaged_users: number;
132+
total_chats: number;
133+
134+
constructor(data: any) {
135+
this.name = data.name;
136+
this.is_custom_model = data.is_custom_model;
137+
this.custom_model_training_date = data.custom_model_training_date || null;
138+
this.total_engaged_users = data.total_engaged_users;
139+
this.total_chats = data.total_chats;
140+
}
141+
}
142+
143+
export class CopilotDotcomPullRequestsRepositoryModel {
144+
name: string;
145+
is_custom_model: boolean;
146+
custom_model_training_date?: string | null;
147+
total_pr_summaries_created: number;
148+
total_engaged_users: number;
149+
150+
constructor(data: any) {
151+
this.name = data.name;
152+
this.is_custom_model = data.is_custom_model;
153+
this.custom_model_training_date = data.custom_model_training_date || null;
154+
this.total_pr_summaries_created = data.total_pr_summaries_created;
155+
this.total_engaged_users = data.total_engaged_users;
156+
}
157+
}
158+
159+
export class CopilotDotcomPullRequestsRepository {
160+
name: string;
161+
total_engaged_users: number;
162+
models: CopilotDotcomPullRequestsRepositoryModel[];
163+
164+
constructor(data: any) {
165+
this.name = data.name;
166+
this.total_engaged_users = data.total_engaged_users;
167+
this.models = data.models
168+
? data.models.map(
169+
(model: any) => new CopilotDotcomPullRequestsRepositoryModel(model)
170+
)
171+
: [];
172+
}
173+
}
174+
175+
export class CopilotDotcomPullRequests {
176+
total_engaged_users: number;
177+
repositories: CopilotDotcomPullRequestsRepository[];
178+
179+
constructor(data: any) {
180+
this.total_engaged_users = data.total_engaged_users;
181+
this.repositories = data.repositories
182+
? data.repositories.map(
183+
(repo: any) => new CopilotDotcomPullRequestsRepository(repo)
184+
)
185+
: [];
186+
}
187+
}
188+
189+
export class CopilotDotcomChat {
190+
total_engaged_users: number;
191+
models: CopilotDotcomChatModel[];
192+
193+
constructor(data: any) {
194+
this.total_engaged_users = data.total_engaged_users;
195+
this.models = data.models
196+
? data.models.map((model: any) => new CopilotDotcomChatModel(model))
197+
: [];
198+
}
199+
}
200+
201+
export class CopilotMetrics {
202+
date: string; // The format is as :YYYY-MM-DD
203+
total_active_users: number;
204+
total_engaged_users: number;
205+
copilot_ide_code_completions?: CopilotIdeCodeCompletions | null;
206+
copilot_ide_chat?: CopilotIdeChat | null;
207+
copilot_dotcom_chat?: CopilotDotcomChat | null;
208+
copilot_dotcom_pull_requests?: CopilotDotcomPullRequests | null;
209+
210+
constructor(data: any) {
211+
this.date = data.date;
212+
this.total_active_users = data.total_active_users;
213+
this.total_engaged_users = data.total_engaged_users;
214+
this.copilot_ide_code_completions = data.copilot_ide_code_completions
215+
? new CopilotIdeCodeCompletions(data.copilot_ide_code_completions)
216+
: null;
217+
this.copilot_ide_chat = data.copilot_ide_chat
218+
? new CopilotIdeChat(data.copilot_ide_chat)
219+
: null;
220+
this.copilot_dotcom_chat = data.copilot_dotcom_chat
221+
? new CopilotDotcomChat(data.copilot_dotcom_chat)
222+
: null;
223+
this.copilot_dotcom_pull_requests = data.copilot_dotcom_pull_requests
224+
? new CopilotDotcomPullRequests(data.copilot_dotcom_pull_requests)
225+
: null;
226+
}
227+
228+
}

src/model/Metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class BreakdownData {
1+
export class BreakdownData {
22
language: string;
33
editor: string;
44
suggestions_count: number;

0 commit comments

Comments
 (0)