æ¬ç¨¿ã¯ ã¹ã¿ãã£ãµããªProduct Team Advent Calendar 2024 2æ¥ç®ã®è¨äºã§ãã
ã¹ã¿ãã£ãµããªã§ã½ããã¦ã§ã¢ã¨ã³ã¸ãã¢ãã¨ã³ã¸ãã¢ãªã³ã°ããã¼ã¸ã£ããã£ã¦ãã @pankona ã§ããGitHub Copilot Usage API ãå³ãã£ã¦ã¿ã話ããã¾ãã
GitHub Copilot ã¯ä¾¿å©ã¨è©å¤ã§ã¯ãã
ã¹ã¿ãã£ãµããªã§ã¯ GitHub Copilot for Business ã使ã£ã¦ãã¾ããä»å¹´ã®ã¯ããã«ã¯ä»¥ä¸ã®ãããªè¨äºãæ稿ãã¾ããã blog.studysapuri.jp
å ã®è¨äºãæ稿ããã®ã2024å¹´1æ22æ¥ã®ãã¨ã ã£ãããã§ãããã以åãã GitHub Copilot ãã¼ã¡ã¼ã¡å°å ¥ãã¦ãããã¨ãæãã¨ãå¼çµç¹ã« GitHub Copilot ãå°å ¥ããã¦ãããããä¸å¹´ä»¥ä¸ãçµéãã¦ããã¨è¨ãããã§ãããã¾ã§ã¯å¤§å¤æ°ã®ã½ããã¦ã§ã¢ã¨ã³ã¸ã㢠(Web ã¨ã³ã¸ãã¢ããAndroid/iOS ã¨ã³ã¸ãã¢ããSRE ã) ããæ¯æ¥ GitHub Copilot ã使ã£ã¦ã³ã¼ãã£ã³ã°ãã¦ããããã«è¦åãããã¾ãã
ãã ãGitHub Copilot ãå®éã©ã®ç¨åº¦æ´»ç¨ããã¦ãããã¨ããã®ã¯ããåããã¾ãããããã£ã±ã使ã£ã¦ãããã便å©ã ãããããªãã§ã¯çæ´»ã§ããªããã¨ãã£ã声ã¯ããèããã¦ãããã®ã®ãã¯ããã¦è²»ç¨å¯¾å¹æã«ããç¨åº¦ã«çç£æ§ã¯ä¸ãã£ã¦ããã®ã§ãããããç§éã¯é°å²æ°ã§ GitHub Copilot ã使ã£ã¦ããã®ã§ã¯ãªãã§ãããããæ´»ç¨ã®å ·åãã§ããã ãå®éçã«ç¥ããããªãã¾ããã
GitHub Copilot ã®æ´»ç¨åº¦ãç¥ããã
å æ¥ã2024å¹´10æ30æ¥ã® GitHub Blog ã§ãGitHub Copilot Metrics API ã GA release ã«ãªã£ãã¨ã®ã¢ãã¦ã³ã¹ãããã¾ããã
è¨äºãèªããã¨ã«ã¯ããã®æã® API ãç¨ãããã¨ã§ GitHub Copilot ãã©ã®ç¨åº¦ä½¿ããã¦ãããã¨ãããã¼ã¿ãåå¾ãããã¨ãã§ãããã§ããã¡ãªã¿ã«ãGitHub Copilot ã®å©ç¨ãã¼ã¿ãç¥ãããã«ç¨æããã¦ãã API 㯠GitHub Copilot Metrics API ã¨ãGitHub Copilot Usage API ã®ã種é¡ãããããã§ãã
ãã£ããå©ãã¦ã¿ã¾ãããã©ããªãã¼ã¿ãåãããå³ãã£ã¦ã¿ã¾ãããã
GitHub Copilot Usage API ãå©ãã¦ã¿ã
GitHub Copilot Usage API ãå©ãã¦ã¿ã¾ãããgh
ã³ãã³ããç¨ãã¦å©ããã¨ãã§ããã®ã§ãã¨ã¦ãç°¡åã§ã (ç°¡åã¨è¨ãã¤ã¤ãå©ãããã«ã¯ manage_billing:copilot,read:org
ã®æ¨©éãå¿
è¦ã§ããããããªãã«å¼·æ¨©ãå¿
è¦ã§ããå¯è½æ§ãããã¾ã) ã以ä¸ã¯ Organization åä½ã§ã® GitHub Copilot Usage ã確èªããããã®ã³ãã³ãã§ãã
# GitHub CLI api # https://cli.github.com/manual/gh_api gh api \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /orgs/quipper/copilot/usage
ãããå©ãã¨ããã¸ã大ã㪠JSON ãã¡ã¤ã«ãéã£ã¦ãã¾ããJSON ã«ã¯ãç´è¿ä¸ã¶æã® GitHub Copilot ã®å©ç¨ãã¼ã¿ãå ¥ã£ã¦ãã¾ããåãããã¼ã¿ã¯æ¦ã以ä¸ã®ã¨ããã§ãã - æ¥æ¯ã®ä½¿ç¨é (ãµã¸ã§ã¹ãã§ã³ã®æ°ãã¢ã¯ã»ãããããæ°ãä½æãããã«ã©ããããã®éã) - ããã°ã©ãã³ã°è¨èªå¥ã§ã®ä½¿ç¨é - ã¨ãã£ã¿å¥ã§ã®ä½¿ç¨é
ããã¸ã大ã㪠JSON ãã¡ã¤ã«ã¯ ChatGPT ã«é£ã¹ããã¦åæãã¦ãããã¾ããããã¦ãå¼çµç¹ã§ã¯ã©ã®ãããªãã¼ã¿ã«ãªã£ã¦ããããããããç´¹ä»ãã¾ãã
ãã¼ã¿ãå³ãã
æåã«ãã¢ã¯ã»ããçãè¦ã¦ã¿ã¾ãã
ã¢ã¯ã»ããçã¨ããã®ã¯ãGitHub Copilot ããã®ãµã¸ã§ã¹ãã§ã³ãããæ°ãæ¯æ°ã«ãã¦ãããã»ã©ãã®ææ¡ãåãå ¥ãããã示ãæ°å¤ã§ããé«ããã°é«ãã»ã© "使ããææ¡" ãé«é »åº¦ã§ãã¦ããã£ã¦ãããã¨ã«ãªããçç£æ§ã«å¯ä¸ãã¦ããã¨è¨ããããªæ°ããã¾ãã
è¦ãã¨ãããã ããã30%å¼±ãããã§ããããããããé«ãã¨ã¿ããä½ãã¨ã¿ããã¯å¾®å¦ãªã¨ããã§ãããããããä»ç¤¾ããã®ã¬ãã¼ããªã©ãæè¦ãã¦ä¸¦ã¹ã¦ã¿ãã¨ããããããã®æ°å¤ãå¹³åçã§ããããã§ãã以ä¸ã¯ 2022å¹´7æã® GitHub Blog ã§ãããGitHub Blog ã§ãããã 20~30% ãããã®ã¢ã¯ã»ããçã§ãããã¨ã触ãããã¦ãã¾ãã github.blog
ç¶ãã¦ããµã¸ã§ã¹ãã§ã³æ°ã¨ã¢ã¯ã»ããæ°ãããã°ã©ãã³ã°è¨èªå¥ã«ã©ã³ãã³ã°ãããã®ãè¦ã¦ã¿ã¾ãã
typescriptreact ã§ã®å©ç¨ããã³ããã§å¤ããã¨ãåãã£ã¦ãã¾ãã次ã㧠RubyãtypescriptãGo ã¨ç¶ãã¦ããã¾ãããã®ãããã¯ã¹ã¿ãã£ãµããªã§ä¸»ã«ä½¿ããã¦ãã (ç±å¿ã«ç·¨éããã¦ãã) ããã°ã©ãã³ã°è¨èªãä½ã§ãããã表ãã¦ããã¨è¨ãããã§ãã
typescriptreact ã®å©ç¨ãå¤ãçç±ã¨ãã¦èããããããªãã¨ããããã³ãã¨ã³ãã主ã«è§¦ã£ã¦ããæ¹ã ã«ãã¢ãªã³ã°ãã¦ã¿ã¾ãããæ°ãããReact ã® Class Component ã Function Component ã«ç½®ãæãããããªä½æ¥ãå¤ããããGitHub Copilot ã«ããªãã®é¨åãå©ãã¦ããã£ã¦ãããã¨ã®ãã¨ã§ããã"ã³ã¼ãã¢ããã¤ã¼ã¼ã·ã§ã³" ã®ãããªãæ¦ã決ã¾ã£ããã¿ã¼ã³ã®å¤æ´ãç¹°ãè¿ãè¡ã (ãã ãæ©æ¢°çã«ã¯é£ãã) ãããªä½æ¥ã«ã¯å¼·ãå³æ¹ã«ãªã£ã¦ããããã¨ã示åãã¦ããã®ããããã¾ããã
次ã«ããµã¸ã§ã¹ãã§ã³æ°ã¨ã¢ã¯ã»ããæ°ãã¨ãã£ã¿å¥ã«ã©ã³ãã³ã°ãããã®ãè¦ã¦ã¿ã¾ãã
å è¿°ã® typescriptreact ããã³ããã§ä½¿ããã¦ãããã¨ã¨ãé¢é£ãã¦ãããã§ãããå¼çµç¹ã§ã¯ VSCode ã大人æ°ã§ãããã¨ãåãã£ã¦ãã¾ããVSCode 㯠GitHub Copilot ã¨ã®ã¤ã³ãã°ã¬ã¼ã·ã§ã³ãã¨ã¦ãå¼·åã§ããGitHub Copilot ã®æ©æµããã£ããå¾ããã¨æã£ãã VSCode ããã¡ã¼ã¹ããã§ã¤ã¹ã«ãªãã¨ãããã¨ãè¨ããããããã¾ããããã¡ãªã¿ã«ç§ã¯ Vim ã使ã£ã¦ãã¾ãã
ããªã便å©ã«ä½¿ããã¦ããããããã¨ããã¼ã¿ã§åãã£ã
GitHub Copilot Usage API ãå©ããã¨ã§ãããªã大éã«ãµã¸ã§ã¹ãã§ã³ããã¦ããã¨ãããã¨ããã¼ã¿ã§åãã£ã¦ãã¾ããããµã¸ã§ã¹ãã§ã³æ°ããããªãã«å¤ãä¸ã§ã¢ã¯ã»ããçãå¹³åçã§ãããªãã°ããã£ãã GitHub Copilot ãæ´»ç¨ã§ãã¦ããã¨è¨ããããããã¾ãããã¾ãããã¾å¼çµç¹ã§ç±å¿ã«æ±ããã¦ããããã°ã©ãã³ã°è¨èªãã©ããªã®ãã¨ãããã¨ããã¤ãã§ã«åãã£ãããã«ãè¦ãã¾ãã
GitHub Copilot Usage APIã便å©ãª API ã§ãã®ã§ãGitHub Copilot ãæ¡ç¨ãã¦ããçµç¹ã«ãããã¾ãã¦ã¯å©ãã¦ã¿ã¦ãã¼ã¿ãå³ãã£ã¦ã¿ãã®ãä¸èã§ã¯ãªãã§ããããã