Menu
Open source Enterprise

Visualizing data from Github GraphQL API

image

We can leverage Github graphql API to query the github stats using this infinity plugin graphql api.

Sample Query given in the below example. You can customize your query to bring the stats you needed.

Query Editor

image

image

Query Used:

graphql
{
  repository(owner: "$GithubUser", name: "$GithubRepo") {
    issues(last: 20) {
      edges {
        node {
          author {
            login
          }
          state
          title
          url
        }
      }
    }
  }
}

Datasource Configuration

Select Basic user authentication mode and use your github username and PAT token as password

image

Github Organization Summary example

image

corresponding query used is given below

graphql
{
  repositoryOwner(login: "$GithubUser") {
    repositories(first: 100) {
      data: nodes {
        name
        stargazers {
          totalCount
        }
        openissues: issues(states: OPEN) {
          totalCount
        }
        openpr: pullRequests(states: OPEN) {
          totalCount
        }
      }
    }
  }
}

Note:

  • Queries are not paginated
  • Github rate limits apply
  • If you need paginated and full set of results, use grafana github stats plugin