datadog-actions-metrics icon indicating copy to clipboard operation
datadog-actions-metrics copied to clipboard

Feature: A Metric for 'Dev Cycle Time'

Open kuritz opened this issue 3 years ago • 3 comments

Hello, my team is using this action and find it useful. Thanks for creating this!

Many of these are useful to us, but particularly the github.actions.pull_request_closed.since_opened_seconds metric is shedding light on our current PR process. We'd love to also be able to measure what someone might refer to as 'Dev Cycle Time' or 'Pull Request Lead Time', which would measure the time from first commit on a feature branch, until the PR is closed.

Is this something you would be willing to add to the action? I imagine this feature might require passing a github token with more permission than the one provided by actions to use the API and get the start time (time of first commit, or head branch creation event) to calculate this metric. I would be happy to put together a PR to implement this.

kuritz avatar Dec 16 '21 19:12 kuritz

Thank you for your proposal. That's interesting.

It is possible to get the timestamp of first commit by pulls.listCommits API https://octokit.github.io/rest.js/v18#pulls-list-commits. For example, https://api.github.com/repos/int128/datadog-actions-metrics/pulls/175/commits. I think author.date is suitable for the cycle time because committer.date is updated by rebase operation.

int128 avatar Dec 19 '21 06:12 int128

I added the following metrics. Can you check them?

github.actions.pull_request_closed.since_first_authored_seconds Time from the authored time of the first commit until closed

github.actions.pull_request_closed.since_first_committed_seconds Time from the committed time of the first commit until closed

int128 avatar Dec 29 '21 12:12 int128

I am seeing data for both of these metrics. Thanks so much for adding them, @int128!

kuritz avatar Dec 29 '21 21:12 kuritz