github-copilot-resources / copilot-metrics-viewer

Tool to visualize the Copilot metrics provided via the Copilot Business Metrics API (current in public beta)
https://ashy-sky-02a7d0403.5.azurestaticapps.net/
MIT License
215 stars 99 forks source link

add seat analysis support for Github Enterprise, since newly released… #49

Closed DevOps-zhuang closed 18 hours ago

DevOps-zhuang commented 1 week ago

Add seat analysis support for Github Enterprise, since newly released Github API support enterprise level seat information in 6/21, thanks for check.

https://docs.github.com/en/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-enterprise

Updates to the README:

Changes to the getSeatsApi function:

Changes to the Seat model:

Changes to the sample response data:

Changes to the Vue components:

DevOps-zhuang commented 1 week ago

@martedesco could you please help check it? I already test it for real orgs. and mock data with both enterprise and orgs. since I don't have a formal copilot enabled github enterprise, I didn't test that scenarios. hope it works, since the only difference is the API URL. thanks! :-)

AdrianDsg commented 1 week ago

Thanks @DevOps-zhuang for providing these valuable contributions to the project as a reaction to my message in #41.

Maybe there's also the chance to provide analytics for the assigning GitHub Enterprise team(s) (assigning_team)?

{
  "total_seats": 1,
  "seats": [
    {
      "created_at": "2021-08-03T18:00:00-06:00",
      "updated_at": "2021-09-23T15:00:00-06:00",
      "pending_cancellation_date": null,
      "last_activity_at": "2021-10-14T00:53:32-06:00",
      "last_activity_editor": "vscode/1.77.3/copilot/1.86.82",
      "assignee": {
        "login": "octocat",
        "id": 1,
        "node_id": "MDQ6VXNlcjE=",
        // ...
        "type": "User",
        "site_admin": false
      },
      "assigning_team": {
        "id": 1,
        "node_id": "MDQ6VGVhbTE=",
        "url": "https://api.github.com/teams/1",
        "html_url": "https://github.com/orgs/github/teams/justice-league",
        "name": "Justice League",
        "slug": "justice-league",
        "description": "A great team.",
        "privacy": "closed",
        "notification_setting": "notifications_enabled",
        "permission": "admin",
        "members_url": "https://api.github.com/teams/1/members{/member}",
        "repositories_url": "https://api.github.com/teams/1/repos",
        "parent": null
      }
   }
]
DevOps-zhuang commented 1 week ago

Thanks @DevOps-zhuang for providing these valuable contributions to the project as a reaction to my message in #41.

Maybe there's also the chance to provide analytics for the assigning GitHub Enterprise team(s) (assigning_team)?

{
  "total_seats": 1,
  "seats": [
    {
      "created_at": "2021-08-03T18:00:00-06:00",
      "updated_at": "2021-09-23T15:00:00-06:00",
      "pending_cancellation_date": null,
      "last_activity_at": "2021-10-14T00:53:32-06:00",
      "last_activity_editor": "vscode/1.77.3/copilot/1.86.82",
      "assignee": {
        "login": "octocat",
        "id": 1,
        "node_id": "MDQ6VXNlcjE=",
        // ...
        "type": "User",
        "site_admin": false
      },
      "assigning_team": {
        "id": 1,
        "node_id": "MDQ6VGVhbTE=",
        "url": "https://api.github.com/teams/1",
        "html_url": "https://github.com/orgs/github/teams/justice-league",
        "name": "Justice League",
        "slug": "justice-league",
        "description": "A great team.",
        "privacy": "closed",
        "notification_setting": "notifications_enabled",
        "permission": "admin",
        "members_url": "https://api.github.com/teams/1/members{/member}",
        "repositories_url": "https://api.github.com/teams/1/repos",
        "parent": null
      }
   }
]

thanks for suggesiton, It is a good suggesiton, and I just added 'seat' support for seat analysis in my local environemtn, it works for the mock data. then when I swith to real org, it is just blank, I just found there is no "assigning_team" returned in my environment at all, though there are 16 teams, almost every developer are within one team. and I am checking with Github team for it, not sure whether it is data error. will keep monitoring it.

DevOps-zhuang commented 1 week ago

Thanks @DevOps-zhuang for providing these valuable contributions to the project as a reaction to my message in #41.

Maybe there's also the chance to provide analytics for the assigning GitHub Enterprise team(s) (assigning_team)?

{
  "total_seats": 1,
  "seats": [
    {
      "created_at": "2021-08-03T18:00:00-06:00",
      "updated_at": "2021-09-23T15:00:00-06:00",
      "pending_cancellation_date": null,
      "last_activity_at": "2021-10-14T00:53:32-06:00",
      "last_activity_editor": "vscode/1.77.3/copilot/1.86.82",
      "assignee": {
        "login": "octocat",
        "id": 1,
        "node_id": "MDQ6VXNlcjE=",
        // ...
        "type": "User",
        "site_admin": false
      },
      "assigning_team": {
        "id": 1,
        "node_id": "MDQ6VGVhbTE=",
        "url": "https://api.github.com/teams/1",
        "html_url": "https://github.com/orgs/github/teams/justice-league",
        "name": "Justice League",
        "slug": "justice-league",
        "description": "A great team.",
        "privacy": "closed",
        "notification_setting": "notifications_enabled",
        "permission": "admin",
        "members_url": "https://api.github.com/teams/1/members{/member}",
        "repositories_url": "https://api.github.com/teams/1/repos",
        "parent": null
      }
   }
]

checked with GitHub experts. The explanation for the team is provided below "assigning_team": {"description": "The team through which the assignee is granted access to GitHub Copilot, if applicable.",....} so the 'assigning_team' here means 'the team where the user was assigned/received copilot license', not the team the user belongs to...so if the account was not assigned copilot through teams, the assigin-team here is blank, so I am doubting whether it is worth adding the teams here, it will create more confusion... your suggestion? thanks.

romeroej-inch commented 6 days ago

why hasnt this been merged. it works beautifully :D

AdrianDsg commented 20 hours ago

@martedesco please consider looking into this any time soon