├── CopilotSample.json
├── LICENSE
├── README.md
└── dummydata
├── Copilotdataapi.json
└── copilotusersapi.json
/CopilotSample.json:
--------------------------------------------------------------------------------
1 | {
2 | "annotations": {
3 | "list": [
4 | {
5 | "builtIn": 1,
6 | "datasource": {
7 | "type": "grafana",
8 | "uid": "-- Grafana --"
9 | },
10 | "enable": true,
11 | "hide": true,
12 | "iconColor": "rgba(0, 211, 255, 1)",
13 | "name": "Annotations & Alerts",
14 | "type": "dashboard"
15 | }
16 | ]
17 | },
18 | "editable": true,
19 | "fiscalYearStartMonth": 0,
20 | "graphTooltip": 0,
21 | "id": 12,
22 | "links": [],
23 | "panels": [
24 | {
25 | "datasource": {
26 | "type": "yesoreyeram-infinity-datasource",
27 | "uid": "edkjwc7dq7qiod"
28 | },
29 | "fieldConfig": {
30 | "defaults": {
31 | "color": {
32 | "mode": "continuous-GrYlRd"
33 | },
34 | "mappings": [],
35 | "thresholds": {
36 | "mode": "absolute",
37 | "steps": [
38 | {
39 | "color": "green",
40 | "value": null
41 | },
42 | {
43 | "color": "red",
44 | "value": 80
45 | }
46 | ]
47 | }
48 | },
49 | "overrides": []
50 | },
51 | "gridPos": {
52 | "h": 9,
53 | "w": 5,
54 | "x": 0,
55 | "y": 0
56 | },
57 | "id": 1,
58 | "options": {
59 | "displayMode": "basic",
60 | "maxVizHeight": 300,
61 | "minVizHeight": 16,
62 | "minVizWidth": 8,
63 | "namePlacement": "auto",
64 | "orientation": "horizontal",
65 | "reduceOptions": {
66 | "calcs": [
67 | "lastNotNull"
68 | ],
69 | "fields": "",
70 | "values": false
71 | },
72 | "showUnfilled": true,
73 | "sizing": "auto",
74 | "valueMode": "color"
75 | },
76 | "pluginVersion": "11.1.0-69950",
77 | "targets": [
78 | {
79 | "columns": [
80 | {
81 | "selector": "seat_breakdown.active_this_cycle",
82 | "text": "Assigned licenses",
83 | "type": "number"
84 | },
85 | {
86 | "selector": "seat_breakdown.added_this_cycle",
87 | "text": "Added users this month",
88 | "type": "number"
89 | },
90 | {
91 | "selector": "seat_breakdown.inactive_this_cycle",
92 | "text": "Inactive users",
93 | "type": "number"
94 | },
95 | {
96 | "selector": "seat_breakdown.total",
97 | "text": "Total License count",
98 | "type": "number"
99 | }
100 | ],
101 | "data": "",
102 | "datasource": {
103 | "type": "yesoreyeram-infinity-datasource",
104 | "uid": "edkjwc7dq7qiod"
105 | },
106 | "filters": [],
107 | "format": "table",
108 | "global_query_id": "",
109 | "refId": "A",
110 | "root_selector": "",
111 | "source": "url",
112 | "type": "json",
113 | "url": "https://api.github.com/orgs/your-org/copilot/billing",
114 | "url_options": {
115 | "data": "",
116 | "headers": [],
117 | "method": "GET"
118 | }
119 | }
120 | ],
121 | "title": "Copilot usage",
122 | "type": "bargauge"
123 | },
124 | {
125 | "datasource": {
126 | "type": "yesoreyeram-infinity-datasource",
127 | "uid": "edkjwc7dq7qiod"
128 | },
129 | "fieldConfig": {
130 | "defaults": {
131 | "color": {
132 | "mode": "thresholds"
133 | },
134 | "mappings": [],
135 | "thresholds": {
136 | "mode": "absolute",
137 | "steps": [
138 | {
139 | "color": "red",
140 | "value": null
141 | },
142 | {
143 | "color": "orange",
144 | "value": 18
145 | },
146 | {
147 | "color": "green",
148 | "value": 25
149 | }
150 | ]
151 | },
152 | "unit": "percent"
153 | },
154 | "overrides": []
155 | },
156 | "gridPos": {
157 | "h": 9,
158 | "w": 3,
159 | "x": 5,
160 | "y": 0
161 | },
162 | "id": 7,
163 | "options": {
164 | "colorMode": "value",
165 | "graphMode": "area",
166 | "justifyMode": "auto",
167 | "orientation": "auto",
168 | "reduceOptions": {
169 | "calcs": [],
170 | "fields": "",
171 | "values": true
172 | },
173 | "showPercentChange": false,
174 | "textMode": "auto",
175 | "wideLayout": true
176 | },
177 | "pluginVersion": "11.1.0-69950",
178 | "targets": [
179 | {
180 | "columns": [
181 | {
182 | "selector": "day",
183 | "text": "Date",
184 | "type": "timestamp"
185 | },
186 | {
187 | "selector": "total_lines_suggested",
188 | "text": "Suggestions",
189 | "type": "number"
190 | },
191 | {
192 | "selector": "total_lines_accepted",
193 | "text": "Accepted",
194 | "type": "string"
195 | }
196 | ],
197 | "data": "",
198 | "datasource": {
199 | "type": "yesoreyeram-infinity-datasource",
200 | "uid": "edkjwc7dq7qiod"
201 | },
202 | "filters": [],
203 | "format": "table",
204 | "global_query_id": "",
205 | "refId": "A",
206 | "root_selector": "",
207 | "source": "url",
208 | "type": "json",
209 | "url": "https://api.github.com/enterprises/your-enterprise/copilot/usage",
210 | "url_options": {
211 | "data": "",
212 | "method": "GET"
213 | }
214 | }
215 | ],
216 | "title": "Average Acceptance Rate",
217 | "transformations": [
218 | {
219 | "id": "calculateField",
220 | "options": {
221 | "alias": "abs(Date)",
222 | "mode": "unary",
223 | "reduce": {
224 | "reducer": "sum"
225 | },
226 | "replaceFields": false,
227 | "unary": {
228 | "fieldName": "Date",
229 | "operator": "abs"
230 | }
231 | }
232 | },
233 | {
234 | "id": "calculateField",
235 | "options": {
236 | "alias": "Acceptance Rate ",
237 | "binary": {
238 | "left": "Accepted",
239 | "operator": "/",
240 | "right": "Suggestions"
241 | },
242 | "index": {
243 | "asPercentile": false
244 | },
245 | "mode": "binary",
246 | "reduce": {
247 | "reducer": "sum"
248 | },
249 | "replaceFields": false
250 | }
251 | },
252 | {
253 | "id": "calculateField",
254 | "options": {
255 | "alias": "Acceptance Rate percentage",
256 | "binary": {
257 | "left": "Acceptance Rate ",
258 | "operator": "*",
259 | "right": "100"
260 | },
261 | "mode": "binary",
262 | "reduce": {
263 | "reducer": "sum"
264 | },
265 | "replaceFields": true
266 | }
267 | },
268 | {
269 | "id": "reduce",
270 | "options": {
271 | "labelsToFields": true,
272 | "reducers": [
273 | "mean"
274 | ]
275 | }
276 | }
277 | ],
278 | "type": "stat"
279 | },
280 | {
281 | "datasource": {
282 | "type": "yesoreyeram-infinity-datasource",
283 | "uid": "edkjwc7dq7qiod"
284 | },
285 | "fieldConfig": {
286 | "defaults": {
287 | "color": {
288 | "mode": "thresholds"
289 | },
290 | "mappings": [],
291 | "thresholds": {
292 | "mode": "absolute",
293 | "steps": [
294 | {
295 | "color": "red",
296 | "value": null
297 | },
298 | {
299 | "color": "orange",
300 | "value": 20
301 | },
302 | {
303 | "color": "green",
304 | "value": 30
305 | }
306 | ]
307 | },
308 | "unit": "percent"
309 | },
310 | "overrides": []
311 | },
312 | "gridPos": {
313 | "h": 9,
314 | "w": 3,
315 | "x": 8,
316 | "y": 0
317 | },
318 | "id": 6,
319 | "options": {
320 | "colorMode": "value",
321 | "graphMode": "area",
322 | "justifyMode": "auto",
323 | "orientation": "auto",
324 | "reduceOptions": {
325 | "calcs": [
326 | "lastNotNull"
327 | ],
328 | "fields": "",
329 | "values": false
330 | },
331 | "showPercentChange": false,
332 | "textMode": "auto",
333 | "wideLayout": true
334 | },
335 | "pluginVersion": "11.1.0-69950",
336 | "targets": [
337 | {
338 | "columns": [
339 | {
340 | "selector": "seat_breakdown.active_this_cycle",
341 | "text": "Active Users",
342 | "type": "number"
343 | },
344 | {
345 | "selector": "seat_breakdown.added_this_cycle",
346 | "text": "Added users this month",
347 | "type": "number"
348 | },
349 | {
350 | "selector": "seat_breakdown.inactive_this_cycle",
351 | "text": "Inactive users",
352 | "type": "number"
353 | },
354 | {
355 | "selector": "seat_breakdown.total",
356 | "text": "Total License count",
357 | "type": "number"
358 | }
359 | ],
360 | "data": "",
361 | "datasource": {
362 | "type": "yesoreyeram-infinity-datasource",
363 | "uid": "edkjwc7dq7qiod"
364 | },
365 | "filters": [],
366 | "format": "table",
367 | "global_query_id": "",
368 | "refId": "A",
369 | "root_selector": "",
370 | "source": "url",
371 | "type": "json",
372 | "url": "https://api.github.com/orgs/your-org/copilot/billing",
373 | "url_options": {
374 | "data": "",
375 | "headers": [],
376 | "method": "GET"
377 | }
378 | }
379 | ],
380 | "title": "Copilot adoption rate for past 28 days",
381 | "transformations": [
382 | {
383 | "id": "calculateField",
384 | "options": {
385 | "alias": "Adoption Rate",
386 | "binary": {
387 | "left": "Active Users",
388 | "operator": "/",
389 | "right": "Total License count"
390 | },
391 | "mode": "binary",
392 | "reduce": {
393 | "reducer": "sum"
394 | },
395 | "replaceFields": false
396 | }
397 | },
398 | {
399 | "id": "calculateField",
400 | "options": {
401 | "binary": {
402 | "left": "Adoption Rate",
403 | "operator": "*",
404 | "right": "100"
405 | },
406 | "mode": "binary",
407 | "reduce": {
408 | "reducer": "sum"
409 | },
410 | "replaceFields": true
411 | }
412 | }
413 | ],
414 | "type": "stat"
415 | },
416 | {
417 | "datasource": {
418 | "type": "yesoreyeram-infinity-datasource",
419 | "uid": "edkjwc7dq7qiod"
420 | },
421 | "fieldConfig": {
422 | "defaults": {
423 | "color": {
424 | "mode": "thresholds"
425 | },
426 | "mappings": [],
427 | "thresholds": {
428 | "mode": "percentage",
429 | "steps": [
430 | {
431 | "color": "green",
432 | "value": null
433 | },
434 | {
435 | "color": "orange",
436 | "value": 70
437 | },
438 | {
439 | "color": "red",
440 | "value": 85
441 | }
442 | ]
443 | }
444 | },
445 | "overrides": []
446 | },
447 | "gridPos": {
448 | "h": 9,
449 | "w": 4,
450 | "x": 11,
451 | "y": 0
452 | },
453 | "id": 9,
454 | "options": {
455 | "colorMode": "value",
456 | "graphMode": "area",
457 | "justifyMode": "auto",
458 | "orientation": "auto",
459 | "reduceOptions": {
460 | "calcs": [],
461 | "fields": "",
462 | "values": true
463 | },
464 | "showPercentChange": false,
465 | "textMode": "auto",
466 | "wideLayout": true
467 | },
468 | "pluginVersion": "11.1.0-69950",
469 | "targets": [
470 | {
471 | "columns": [
472 | {
473 | "selector": "day",
474 | "text": "Date",
475 | "type": "timestamp"
476 | },
477 | {
478 | "selector": "total_active_users",
479 | "text": "Active Users per day",
480 | "type": "number"
481 | }
482 | ],
483 | "data": "",
484 | "datasource": {
485 | "type": "yesoreyeram-infinity-datasource",
486 | "uid": "edkjwc7dq7qiod"
487 | },
488 | "filters": [],
489 | "format": "table",
490 | "global_query_id": "",
491 | "refId": "A",
492 | "root_selector": "",
493 | "source": "url",
494 | "type": "json",
495 | "url": "https://api.github.com/enterprises/your-enterprise/copilot/usage",
496 | "url_options": {
497 | "data": "",
498 | "method": "GET"
499 | }
500 | }
501 | ],
502 | "title": "Average Active users past 28 days",
503 | "transformations": [
504 | {
505 | "id": "calculateField",
506 | "options": {
507 | "alias": "abs(Date)",
508 | "mode": "unary",
509 | "reduce": {
510 | "reducer": "sum"
511 | },
512 | "replaceFields": false,
513 | "unary": {
514 | "fieldName": "Date",
515 | "operator": "abs"
516 | }
517 | }
518 | },
519 | {
520 | "id": "calculateField",
521 | "options": {
522 | "alias": "Acceptance Rate ",
523 | "binary": {
524 | "left": "Accepted",
525 | "operator": "/",
526 | "right": "Suggestions"
527 | },
528 | "index": {
529 | "asPercentile": false
530 | },
531 | "mode": "binary",
532 | "reduce": {
533 | "reducer": "sum"
534 | },
535 | "replaceFields": false
536 | }
537 | },
538 | {
539 | "id": "calculateField",
540 | "options": {
541 | "alias": "Acceptance Rate percentage",
542 | "binary": {
543 | "left": "Acceptance Rate ",
544 | "operator": "*",
545 | "right": "100"
546 | },
547 | "mode": "binary",
548 | "reduce": {
549 | "reducer": "sum"
550 | },
551 | "replaceFields": true
552 | }
553 | },
554 | {
555 | "id": "reduce",
556 | "options": {
557 | "reducers": [
558 | "mean"
559 | ]
560 | }
561 | }
562 | ],
563 | "type": "stat"
564 | },
565 | {
566 | "datasource": {
567 | "type": "yesoreyeram-infinity-datasource",
568 | "uid": "edkjwc7dq7qiod"
569 | },
570 | "fieldConfig": {
571 | "defaults": {
572 | "color": {
573 | "mode": "thresholds"
574 | },
575 | "mappings": [],
576 | "thresholds": {
577 | "mode": "percentage",
578 | "steps": [
579 | {
580 | "color": "green",
581 | "value": null
582 | },
583 | {
584 | "color": "orange",
585 | "value": 70
586 | },
587 | {
588 | "color": "red",
589 | "value": 85
590 | }
591 | ]
592 | }
593 | },
594 | "overrides": []
595 | },
596 | "gridPos": {
597 | "h": 9,
598 | "w": 4,
599 | "x": 15,
600 | "y": 0
601 | },
602 | "id": 10,
603 | "options": {
604 | "colorMode": "value",
605 | "graphMode": "area",
606 | "justifyMode": "auto",
607 | "orientation": "auto",
608 | "reduceOptions": {
609 | "calcs": [],
610 | "fields": "",
611 | "values": true
612 | },
613 | "showPercentChange": false,
614 | "textMode": "auto",
615 | "wideLayout": true
616 | },
617 | "pluginVersion": "11.1.0-69950",
618 | "targets": [
619 | {
620 | "columns": [
621 | {
622 | "selector": "day",
623 | "text": "Date",
624 | "type": "timestamp"
625 | },
626 | {
627 | "selector": "total_active_chat_users",
628 | "text": "Active Chat Users per day",
629 | "type": "number"
630 | }
631 | ],
632 | "data": "",
633 | "datasource": {
634 | "type": "yesoreyeram-infinity-datasource",
635 | "uid": "edkjwc7dq7qiod"
636 | },
637 | "filters": [],
638 | "format": "table",
639 | "global_query_id": "",
640 | "refId": "A",
641 | "root_selector": "",
642 | "source": "url",
643 | "type": "json",
644 | "url": "https://api.github.com/enterprises/your-enterprise/copilot/usage",
645 | "url_options": {
646 | "data": "",
647 | "method": "GET"
648 | }
649 | }
650 | ],
651 | "title": "Average Chat users past 28 days",
652 | "transformations": [
653 | {
654 | "id": "calculateField",
655 | "options": {
656 | "alias": "abs(Date)",
657 | "mode": "unary",
658 | "reduce": {
659 | "reducer": "sum"
660 | },
661 | "replaceFields": false,
662 | "unary": {
663 | "fieldName": "Date",
664 | "operator": "abs"
665 | }
666 | }
667 | },
668 | {
669 | "id": "reduce",
670 | "options": {
671 | "reducers": [
672 | "mean"
673 | ]
674 | }
675 | }
676 | ],
677 | "type": "stat"
678 | },
679 | {
680 | "datasource": {
681 | "type": "yesoreyeram-infinity-datasource",
682 | "uid": "edkjwc7dq7qiod"
683 | },
684 | "fieldConfig": {
685 | "defaults": {
686 | "color": {
687 | "mode": "palette-classic"
688 | },
689 | "custom": {
690 | "axisBorderShow": false,
691 | "axisCenteredZero": false,
692 | "axisColorMode": "text",
693 | "axisLabel": "",
694 | "axisPlacement": "auto",
695 | "barAlignment": 0,
696 | "drawStyle": "line",
697 | "fillOpacity": 0,
698 | "gradientMode": "none",
699 | "hideFrom": {
700 | "legend": false,
701 | "tooltip": false,
702 | "viz": false
703 | },
704 | "insertNulls": false,
705 | "lineInterpolation": "linear",
706 | "lineWidth": 1,
707 | "pointSize": 5,
708 | "scaleDistribution": {
709 | "type": "linear"
710 | },
711 | "showPoints": "auto",
712 | "spanNulls": false,
713 | "stacking": {
714 | "group": "A",
715 | "mode": "none"
716 | },
717 | "thresholdsStyle": {
718 | "mode": "off"
719 | }
720 | },
721 | "mappings": [],
722 | "thresholds": {
723 | "mode": "absolute",
724 | "steps": [
725 | {
726 | "color": "green",
727 | "value": null
728 | },
729 | {
730 | "color": "red",
731 | "value": 80
732 | }
733 | ]
734 | },
735 | "unit": "percent"
736 | },
737 | "overrides": []
738 | },
739 | "gridPos": {
740 | "h": 11,
741 | "w": 19,
742 | "x": 0,
743 | "y": 9
744 | },
745 | "id": 3,
746 | "options": {
747 | "legend": {
748 | "calcs": [],
749 | "displayMode": "hidden",
750 | "placement": "right",
751 | "showLegend": false
752 | },
753 | "tooltip": {
754 | "mode": "single",
755 | "sort": "none"
756 | }
757 | },
758 | "pluginVersion": "11.1.0-69622",
759 | "targets": [
760 | {
761 | "columns": [
762 | {
763 | "selector": "day",
764 | "text": "Date",
765 | "type": "timestamp"
766 | },
767 | {
768 | "selector": "total_lines_suggested",
769 | "text": "Suggestions",
770 | "type": "number"
771 | },
772 | {
773 | "selector": "total_lines_accepted",
774 | "text": "Accepted",
775 | "type": "string"
776 | }
777 | ],
778 | "data": "",
779 | "datasource": {
780 | "type": "yesoreyeram-infinity-datasource",
781 | "uid": "edkjwc7dq7qiod"
782 | },
783 | "filters": [],
784 | "format": "table",
785 | "global_query_id": "",
786 | "refId": "A",
787 | "root_selector": "",
788 | "source": "url",
789 | "type": "json",
790 | "url": "https://api.github.com/enterprises/your-enterprise/copilot/usage",
791 | "url_options": {
792 | "data": "",
793 | "method": "GET"
794 | }
795 | }
796 | ],
797 | "title": "Acceptance Rate",
798 | "transformations": [
799 | {
800 | "id": "calculateField",
801 | "options": {
802 | "alias": "abs(Date)",
803 | "mode": "unary",
804 | "reduce": {
805 | "reducer": "sum"
806 | },
807 | "replaceFields": false,
808 | "unary": {
809 | "fieldName": "Date",
810 | "operator": "abs"
811 | }
812 | }
813 | },
814 | {
815 | "id": "calculateField",
816 | "options": {
817 | "alias": "Acceptance Rate ",
818 | "binary": {
819 | "left": "Accepted",
820 | "operator": "/",
821 | "right": "Suggestions"
822 | },
823 | "index": {
824 | "asPercentile": false
825 | },
826 | "mode": "binary",
827 | "reduce": {
828 | "reducer": "sum"
829 | },
830 | "replaceFields": false
831 | }
832 | },
833 | {
834 | "id": "calculateField",
835 | "options": {
836 | "alias": "Acceptance Rate percentage",
837 | "binary": {
838 | "left": "Acceptance Rate ",
839 | "operator": "*",
840 | "right": "100"
841 | },
842 | "mode": "binary",
843 | "reduce": {
844 | "reducer": "sum"
845 | },
846 | "replaceFields": true
847 | }
848 | }
849 | ],
850 | "type": "timeseries"
851 | },
852 | {
853 | "datasource": {
854 | "type": "yesoreyeram-infinity-datasource",
855 | "uid": "edkjwc7dq7qiod"
856 | },
857 | "fieldConfig": {
858 | "defaults": {
859 | "color": {
860 | "mode": "palette-classic"
861 | },
862 | "custom": {
863 | "axisBorderShow": false,
864 | "axisCenteredZero": false,
865 | "axisColorMode": "text",
866 | "axisLabel": "",
867 | "axisPlacement": "auto",
868 | "barAlignment": 0,
869 | "drawStyle": "bars",
870 | "fillOpacity": 100,
871 | "gradientMode": "hue",
872 | "hideFrom": {
873 | "legend": false,
874 | "tooltip": false,
875 | "viz": false
876 | },
877 | "insertNulls": false,
878 | "lineInterpolation": "linear",
879 | "lineWidth": 1,
880 | "pointSize": 5,
881 | "scaleDistribution": {
882 | "type": "linear"
883 | },
884 | "showPoints": "auto",
885 | "spanNulls": false,
886 | "stacking": {
887 | "group": "A",
888 | "mode": "none"
889 | },
890 | "thresholdsStyle": {
891 | "mode": "off"
892 | }
893 | },
894 | "mappings": [],
895 | "thresholds": {
896 | "mode": "absolute",
897 | "steps": [
898 | {
899 | "color": "green",
900 | "value": null
901 | },
902 | {
903 | "color": "red",
904 | "value": 80
905 | }
906 | ]
907 | }
908 | },
909 | "overrides": []
910 | },
911 | "gridPos": {
912 | "h": 9,
913 | "w": 19,
914 | "x": 0,
915 | "y": 20
916 | },
917 | "id": 8,
918 | "options": {
919 | "legend": {
920 | "calcs": [],
921 | "displayMode": "hidden",
922 | "placement": "right",
923 | "showLegend": false
924 | },
925 | "tooltip": {
926 | "mode": "single",
927 | "sort": "none"
928 | }
929 | },
930 | "pluginVersion": "11.1.0-69622",
931 | "targets": [
932 | {
933 | "columns": [
934 | {
935 | "selector": "day",
936 | "text": "Date",
937 | "type": "timestamp"
938 | },
939 | {
940 | "selector": "total_active_users",
941 | "text": "Active Users per day",
942 | "type": "number"
943 | }
944 | ],
945 | "data": "",
946 | "datasource": {
947 | "type": "yesoreyeram-infinity-datasource",
948 | "uid": "edkjwc7dq7qiod"
949 | },
950 | "filters": [],
951 | "format": "table",
952 | "global_query_id": "",
953 | "refId": "A",
954 | "root_selector": "",
955 | "source": "url",
956 | "type": "json",
957 | "url": "https://api.github.com/enterprises/your-enterprise/copilot/usage",
958 | "url_options": {
959 | "data": "",
960 | "method": "GET"
961 | }
962 | }
963 | ],
964 | "title": "Active Users over the past 28 days",
965 | "transformations": [
966 | {
967 | "id": "calculateField",
968 | "options": {
969 | "alias": "abs(Date)",
970 | "mode": "unary",
971 | "reduce": {
972 | "reducer": "sum"
973 | },
974 | "replaceFields": false,
975 | "unary": {
976 | "fieldName": "Date",
977 | "operator": "abs"
978 | }
979 | }
980 | },
981 | {
982 | "id": "calculateField",
983 | "options": {
984 | "alias": "Acceptance Rate ",
985 | "binary": {
986 | "left": "Accepted",
987 | "operator": "/",
988 | "right": "Suggestions"
989 | },
990 | "index": {
991 | "asPercentile": false
992 | },
993 | "mode": "binary",
994 | "reduce": {
995 | "reducer": "sum"
996 | },
997 | "replaceFields": false
998 | }
999 | },
1000 | {
1001 | "id": "calculateField",
1002 | "options": {
1003 | "alias": "Acceptance Rate percentage",
1004 | "binary": {
1005 | "left": "Acceptance Rate ",
1006 | "operator": "*",
1007 | "right": "100"
1008 | },
1009 | "mode": "binary",
1010 | "reduce": {
1011 | "reducer": "sum"
1012 | },
1013 | "replaceFields": true
1014 | }
1015 | }
1016 | ],
1017 | "type": "timeseries"
1018 | },
1019 | {
1020 | "datasource": {
1021 | "type": "yesoreyeram-infinity-datasource",
1022 | "uid": "edkjwc7dq7qiod"
1023 | },
1024 | "fieldConfig": {
1025 | "defaults": {
1026 | "color": {
1027 | "mode": "palette-classic"
1028 | },
1029 | "custom": {
1030 | "axisBorderShow": false,
1031 | "axisCenteredZero": false,
1032 | "axisColorMode": "text",
1033 | "axisLabel": "",
1034 | "axisPlacement": "auto",
1035 | "barAlignment": 0,
1036 | "drawStyle": "line",
1037 | "fillOpacity": 0,
1038 | "gradientMode": "none",
1039 | "hideFrom": {
1040 | "legend": false,
1041 | "tooltip": false,
1042 | "viz": false
1043 | },
1044 | "insertNulls": false,
1045 | "lineInterpolation": "linear",
1046 | "lineWidth": 1,
1047 | "pointSize": 5,
1048 | "scaleDistribution": {
1049 | "type": "linear"
1050 | },
1051 | "showPoints": "auto",
1052 | "spanNulls": false,
1053 | "stacking": {
1054 | "group": "A",
1055 | "mode": "none"
1056 | },
1057 | "thresholdsStyle": {
1058 | "mode": "off"
1059 | }
1060 | },
1061 | "mappings": [],
1062 | "thresholds": {
1063 | "mode": "absolute",
1064 | "steps": [
1065 | {
1066 | "color": "green",
1067 | "value": null
1068 | },
1069 | {
1070 | "color": "red",
1071 | "value": 80
1072 | }
1073 | ]
1074 | },
1075 | "unit": "none"
1076 | },
1077 | "overrides": []
1078 | },
1079 | "gridPos": {
1080 | "h": 8,
1081 | "w": 19,
1082 | "x": 0,
1083 | "y": 29
1084 | },
1085 | "id": 4,
1086 | "options": {
1087 | "legend": {
1088 | "calcs": [],
1089 | "displayMode": "list",
1090 | "placement": "right",
1091 | "showLegend": false
1092 | },
1093 | "tooltip": {
1094 | "mode": "single",
1095 | "sort": "none"
1096 | }
1097 | },
1098 | "pluginVersion": "11.1.0-69622",
1099 | "targets": [
1100 | {
1101 | "columns": [
1102 | {
1103 | "selector": "day",
1104 | "text": "Date",
1105 | "type": "timestamp"
1106 | },
1107 | {
1108 | "selector": "total_suggestions_count",
1109 | "text": "Total Suggestions Count",
1110 | "type": "number"
1111 | },
1112 | {
1113 | "selector": "total_acceptances_count",
1114 | "text": "Total Acceptances Count",
1115 | "type": "number"
1116 | }
1117 | ],
1118 | "data": "",
1119 | "datasource": {
1120 | "type": "yesoreyeram-infinity-datasource",
1121 | "uid": "edkjwc7dq7qiod"
1122 | },
1123 | "filters": [],
1124 | "format": "table",
1125 | "global_query_id": "",
1126 | "refId": "A",
1127 | "root_selector": "",
1128 | "source": "url",
1129 | "type": "json",
1130 | "url": "https://api.github.com/enterprises/your-enterprise/copilot/usage",
1131 | "url_options": {
1132 | "data": "",
1133 | "method": "GET"
1134 | }
1135 | }
1136 | ],
1137 | "title": "Count Number of acceptances - completions",
1138 | "type": "timeseries"
1139 | },
1140 | {
1141 | "datasource": {
1142 | "type": "yesoreyeram-infinity-datasource",
1143 | "uid": "edkjwc7dq7qiod"
1144 | },
1145 | "fieldConfig": {
1146 | "defaults": {
1147 | "color": {
1148 | "mode": "palette-classic"
1149 | },
1150 | "custom": {
1151 | "axisBorderShow": false,
1152 | "axisCenteredZero": false,
1153 | "axisColorMode": "text",
1154 | "axisLabel": "",
1155 | "axisPlacement": "auto",
1156 | "barAlignment": 0,
1157 | "drawStyle": "line",
1158 | "fillOpacity": 0,
1159 | "gradientMode": "none",
1160 | "hideFrom": {
1161 | "legend": false,
1162 | "tooltip": false,
1163 | "viz": false
1164 | },
1165 | "insertNulls": false,
1166 | "lineInterpolation": "linear",
1167 | "lineWidth": 1,
1168 | "pointSize": 5,
1169 | "scaleDistribution": {
1170 | "type": "linear"
1171 | },
1172 | "showPoints": "auto",
1173 | "spanNulls": false,
1174 | "stacking": {
1175 | "group": "A",
1176 | "mode": "none"
1177 | },
1178 | "thresholdsStyle": {
1179 | "mode": "off"
1180 | }
1181 | },
1182 | "mappings": [],
1183 | "thresholds": {
1184 | "mode": "absolute",
1185 | "steps": [
1186 | {
1187 | "color": "green"
1188 | },
1189 | {
1190 | "color": "red",
1191 | "value": 80
1192 | }
1193 | ]
1194 | },
1195 | "unit": "none"
1196 | },
1197 | "overrides": []
1198 | },
1199 | "gridPos": {
1200 | "h": 9,
1201 | "w": 19,
1202 | "x": 0,
1203 | "y": 37
1204 | },
1205 | "id": 5,
1206 | "options": {
1207 | "legend": {
1208 | "calcs": [],
1209 | "displayMode": "list",
1210 | "placement": "bottom",
1211 | "showLegend": true
1212 | },
1213 | "tooltip": {
1214 | "mode": "single",
1215 | "sort": "none"
1216 | }
1217 | },
1218 | "pluginVersion": "11.1.0-69622",
1219 | "targets": [
1220 | {
1221 | "columns": [
1222 | {
1223 | "selector": "day",
1224 | "text": "Date",
1225 | "type": "timestamp"
1226 | },
1227 | {
1228 | "selector": "total_lines_suggested",
1229 | "text": "Total lines Suggestions",
1230 | "type": "number"
1231 | },
1232 | {
1233 | "selector": "total_lines_accepted",
1234 | "text": "Total lines Acceptances",
1235 | "type": "number"
1236 | }
1237 | ],
1238 | "data": "",
1239 | "datasource": {
1240 | "type": "yesoreyeram-infinity-datasource",
1241 | "uid": "edkjwc7dq7qiod"
1242 | },
1243 | "filters": [],
1244 | "format": "table",
1245 | "global_query_id": "",
1246 | "refId": "A",
1247 | "root_selector": "",
1248 | "source": "url",
1249 | "type": "json",
1250 | "url": "https://api.github.com/enterprises/your-enterprise/copilot/usage",
1251 | "url_options": {
1252 | "data": "",
1253 | "method": "GET"
1254 | }
1255 | }
1256 | ],
1257 | "title": "Lines of code accepted - completions",
1258 | "type": "timeseries"
1259 | }
1260 | ],
1261 | "refresh": "",
1262 | "schemaVersion": 39,
1263 | "tags": [],
1264 | "templating": {
1265 | "list": []
1266 | },
1267 | "time": {
1268 | "from": "now-6h",
1269 | "to": "now"
1270 | },
1271 | "timeRangeUpdatedDuringEditOrView": false,
1272 | "timepicker": {},
1273 | "timezone": "browser",
1274 | "title": "Copilot Dashboard",
1275 | "uid": "bdk9wxug71ptsd",
1276 | "version": 5,
1277 | "weekStart": ""
1278 | }
1279 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Adrian Lee
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Grafana and Copilot Metrics Dashboard
3 |
4 | This is a personal project where I've developed a sample dashboard in Grafana Cloud to help teams and companies visualise GitHub copilot metrics within Grafana via the [Copilot API](https://docs.github.com/en/rest/copilot/copilot-usage?apiVersion=2022-11-28). Feel free to make suggestions in the Issues tab and get in contact via [Contact Info](#contact-info)
5 |
6 | TLDR; I queried the json response from the Copilot API endpoint and used Grafana to massage the data.
7 |
8 | As the Copilot endpoint data is only relevant for 28 days. You can use [Recorded Queries](https://grafana.com/docs/grafana/latest/administration/recorded-queries/) to store the API response in the Grafana Cloud hosted prometheus(Only available in cloud + Grafana Enterprise self hosted)
9 | #### Sample Screenshot
10 |
11 |
12 |
13 |
14 | ## How to get started with creating your dashboard!
15 |
16 | ### GitHub
17 | Login and create a [Personal access token](https://docs.github.com/en/enterprise-cloud@latest/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) that will match the permission requirements for the [GitHub Copilot API](https://docs.github.com/en/rest/copilot/copilot-usage?apiVersion=2022-11-28#get-a-summary-of-copilot-usage-for-enterprise-members)
18 | - [Click here for Enterprises Copilot API Endpoints requirements](https://docs.github.com/en/rest/copilot/copilot-usage?apiVersion=2022-11-28#get-a-summary-of-copilot-usage-for-enterprise-members)
19 | - [Click here for Organisation Copilot API Endpoints requirements](https://docs.github.com/en/rest/copilot/copilot-usage?apiVersion=2022-11-28#get-a-summary-of-copilot-usage-for-organization-members)
20 |
21 | Save the secret and don't expose it!
22 |
23 | ### Grafana
24 | - Sign up for a [free Grafana Cloud account](https://grafana.com/auth/sign-up/create-user). You can have up to 3 free users!
25 | - Follow the prompts and add your own cloud stack. Your Grafana Cloud stack URL should be XXXXXX.grafana.net
26 | - Wait a couple of minutes and get ☕ or 🍵
27 | - Navigate to your cloud stack URL and welcome to Grafana Cloud!!
28 | - On the left hand side of the screen, go to the Add new connection button
29 |
30 |
31 | - Search for 'infinity' and click on the data source
32 |
33 |
34 | - Click on Install on the right hand corner. Wait 2 minutes and enjoy ☕
35 |
36 |
37 |
38 | - Click on the left hand menu button in the top left hand corner and navigate to Data Sources
39 |
40 |
41 |
42 | - Click on add new Data Source
43 | - Type in Infinity in the search bar and click on the infinity result. You should be at this page
44 |
45 |
46 | - Rename your data source name to whatever you like. Ideally 'GitHub Copilot'
47 |
48 | - Click on the default flag to turn it on(optional)
49 | - Go to the Authentication tab and paste your GitHub token in Bearer Token
50 | - Add 'https://api.github.com' as allowed hosts
51 | - Click Save and Test
52 | - Open copilotsample.json file and replace all occurences of `your-org` and `your-enterprise` with your GitHub organisation and enterprise name
53 | - Navigate to the left hand menu ---> Dashboards ---> New ----> Import
54 | - Paste the contents of copilotsample.json into the screen. Alternatively, upload the whole file
55 | - Select the Data source you created earlier
56 | - VOILA! Your dashboard is here
57 |
58 | **Note:** If you haven't updated `your-org` and `your-enterprise` with your GitHub organisation and enterprise name earlier, you'll need to change the URL of each panel to the relevant API endpoints above. Do this by going to the top right hand corner of each Panel --> Edit --> change URL... or follow the instructions under the JSON template edit subheading
59 |
60 |
61 |
62 |
63 | Metrics ideas obtained from https://resources.github.com/learn/pathways/copilot/essentials/measuring-the-impact-of-github-copilot/
64 |
65 | Shoutout to @andrekolodochka and @benksmillie for the ideas
66 |
67 | # Contact Info
68 | Feel free to contact me to discuss any issues, questions, or comments.
69 |
70 | My contact info can be found on my GitHub page.
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/dummydata/copilotusersapi.json:
--------------------------------------------------------------------------------
1 | {
2 | "seat_breakdown": {
3 | "total": 32,
4 | "added_this_cycle": 9,
5 | "pending_invitation": 0,
6 | "pending_cancellation": 0,
7 | "active_this_cycle": 12,
8 | "inactive_this_cycle": 11
9 | },
10 | "seat_management_setting": "assign_selected",
11 | "public_code_suggestions": "block"
12 | }
13 |
--------------------------------------------------------------------------------