Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update metrics fetcher to use a Typescript-based pipeline #90

Merged
merged 25 commits into from
Feb 5, 2024

Conversation

ajhenry
Copy link
Collaborator

@ajhenry ajhenry commented Jan 30, 2024

This PR replaces the old go-based data fetching backend with a typescript-based pipeline-inspired backend. The objective of this work is to make it easier to read and write fetching data from the github api and performing transformations on it.

This PR accomplishes the following:

  • Keeps all the old fields that were present in the old data.json file generated by the go backend
  • Adds more fields like issue metrics including resolution time and age of open issues
  • Adds automatic retries and backoff strategies for the GitHub API rate limits
  • Adds an extensible pipeline so new fields can be easily added
  • Updates the action to run instead of the go backend
  • Adds debugging configurations
  • Adds the ability to have configuration via an external file

Things that need to be fleshed out

  • Configuration flow
  • Tests

Things we need to address

  • collaboratorsCount is missing
  • projectsCount is missing
  • ~~watchersCount is incorrect (there is a bug where watchers count is different on rest than on GQL) ~~
  • issuesCount is missing (total of all issues not including PR's)
  • openIssues count includes PR's
  • openPullRequestCount is incorrect
  • mergedPullRequestsCount is missing
  • name missing on orgInfo
  • createdAt missing in orgInfo

cc: @ipc103

closes https://github.com/github/ospo/issues/1993

ipc103 and others added 18 commits January 26, 2024 22:18
We're exploring using TypeScript and octokit for our backend instead of
Go. This adds a basic typescript structure and command to fetch data.

The basic idea is that we can now use pipeline functions to append data
to our result. This should make it easier to compose data. If this continues
to look promising, we can add a test to compare to the results of the Go backend
to ensure we're getting the same data.

Co-authored-by: Andrew Henry <ajhenry@github.com>
This uses fs-extra to generate a JSON file. In the future we'll be
able to move the file location to generate into the UI app directory.

Co-authored-by: Andrew Henry <ajhenry@github.com>
repo: repoName,
state: state,
// Need to limit this query somehow, otherwise it will take forever/timeout
since: config.since,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually pretty nice because I think this means we'll be able to reuse this for some very basic time-based snapshots i.e. age 6 months ago, 3 months ago, today, something like that?

};
};

const calculateIssueResponseTime = async (

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable calculateIssueResponseTime.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to merge this for now anyway, we will redo this later.

ajhenry and others added 4 commits February 1, 2024 15:15
The name is easier to read, so we'll use this for the UI/data instead of
the spdxId.

Co-authored-by: Andrew Henry <ajhenry@github.com>
@ajhenry ajhenry marked this pull request as ready for review February 5, 2024 19:21
Copy link
Collaborator

@ipc103 ipc103 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We 🍐'd on these fixes, going to address the remaining points as followup issues.

@ajhenry ajhenry merged commit 7b41984 into main Feb 5, 2024
3 checks passed
@ajhenry ajhenry deleted the ajhenry/ts-backend branch February 5, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants