Try Insights Snapshot in your GH repo

We’re building an Insights Snapshot that brings the most critical Insights metrics directly to your GitHub repo. Adding a code snippet to your public repo .readme file will display key metrics for the project bringing visibility to throughput, duration, and success rate. Once saved to your .readme file, you can click on the badge which will take you to the Insights Page for more in-depth metrics.

What to do:

  1. Add the code snippet below to your public GitHub repo .readme file
[![InsightsSnapshot](https://dl.circleci.com/insights-snapshot/gh/<org_name>/<project_name>/<branch_name>/<workflow_name>/badge.svg)](https://app.circleci.com/insights/github/<org_name>/<project_name>/workflows/<workflow_name>?branch=<branch_name>)

EDIT by @jerdog: You can also put this into any HTML file with the following code snippet:

<p align="center">
  <a href="https://app.circleci.com/insights/github/<org_name>/<project_name>/workflows/<workflow_name>?branch=<branch_name>">
    <img src="https://dl.circleci.com/insights-snapshot/gh/<org_name>/<project_name>/<branch_name>/<workflow_name>/badge.svg" alt="InsightsSnapshot" />
  </a>
</p>
  1. Replace: <org_name>, <project_name>, <workflow_name>, <branch_name> with your relevant org and project information.

  * Metrics Summary:
    * Throughput: Average daily number of selected workflow run over last 30 days
    * Duration: 95th percentile duration of selected workflow over last 30 days
      * 95th percentile gives you an idea of the highest duration, or the longest you’re waiting on a build to finish, excluding the last 5 percent to account for potential transitory spikes.
    * Success Rate: Percentage of successful builds for the selected workflow over last 30 days
  1. Tell us what you think!
  • Are there different metrics you’d like to see? Are trends useful in this view? Comment and let us know!

To learn more about CircleCI Insights, visit our docs.

3 Likes

This is a good feature :smiley:. Because the success rate of workflow, etc. can be easily checked in README.md.

I was curious about a few things.

  • I think the link is broken because there is no [ at the beginning of ![InsightsSnapshot](https://dl.circleci.com/insights-snapshot/gh/<org_name>/<project_name>/<branch_name>/<workflow_name>/badge.svg)](https://app.circleci.com/insights/github/<org_name>/<project_name>/workflows/<workflow_name>?branch=<branch_name>).
  • I thought it would be useful if the <workflow_name> and <branch_name> were also displayed in the SVG.
    • However, doing so might make it look more complicated…
  • It would be nice to be able to generate markdown snippets from the Web UI.

Thanks :grinning:

3 Likes

Thank you @korosuke613!

1 Like

Very nice. One question. It defaults to 30 days. Is there a way to pass configuration to show 7 day insights?

Not at the moment. But this is good feedback because this is definitely something we could add down the line. Thank you!

I’m not sure if I’m doing something wrong, but this does not work for me (free plan, atm).

Hitting the app.circleci.com URL manually sort of works, though it redirects to the overview page, but the SVG link with the same replacement values returns a “Project is unavailable or doesn’t exist” result. Naturally, the same happens when I add this to a project’s README.MD file.

Also, not sure how I would specify the “all branches” branch name that you can specify when going to the insights area in the UI. Would I use the GUID that I see in the URL when manually navigating?

Can you copy in the markdown code you’re using and we can check into this?

I assume this doesn’t work for Private repos. It doesn’t appear to work even with providing a token like the badges.

Hey @cdhunt! It should work on private repos as well. It should even work with the token from the generated status badge. Let me know if you’re seeing a specific error or if it’s not working for you.

2 Likes

It sure does! I’m not sure what I screwed up the first time.

2 Likes

I edited the first post, but wanted to make sure it was called out as well. Not only does this work on markdown files, i.e. README.md) but you can also put an Insights Snapshot widget on ANY page with the following syntax:

<p align="center">
  <a href="https://app.circleci.com/insights/github/<org_name>/<project_name>/workflows/<workflow_name>?branch=<branch_name>">
    <img src="https://dl.circleci.com/insights-snapshot/gh/<org_name>/<project_name>/<branch_name>/<workflow_name>/badge.svg" alt="InsightsSnapshot" />
  </a>
</p>
1 Like

Thank you all so much for your feedback! We used it to make version 2 even better. Watch this short clip (20 seconds) to see how easy it is to add to your repo and let us know what you think!

https://youtu.be/TU75WB2d97E

1 Like

I think the branch name and workflow name are smartly included. Very good!

2 Likes

Here’s updated documentation that deals with private repos and the steps necessary to get them working: