Giter VIP home page Giter VIP logo

devopsmetrics's Introduction

DevOps Metrics

Build Coverage Status Code Smells Current Release

Why should we care about DevOps Metrics and what are they? All engineering, including software, needs metrics to track performance, but many metrics when measured individually, can be 'gamed', or don't encourage the right behaviors or incentives. This has been an issue with metrics for many years. The DORA metrics are a step in the right direction, combining several metrics that encourage the behaviors and incentives - and hence that encourage DevOps teams to perform at a high level of performance. DORA metrics aren't perfect, but are still the best we have available today.

This project is focused on helping you collect and analyze four key high performing DevOps metrics from GitHub and Azure DevOps. DORA's "State of DevOps" research and Accelerate highlighted four driving indicators of high performing DevOps teams. While these four metrics are widely used in DevOps discussion, it's challenging to implement and capture all of the metrics.

  • Deployment frequency: Number of deployments to production. This is important, as it highlights how often you can deploy to production - which in turn indicates there is a mature automated testing and a mature CI/CD pipeline to release to production.
  • Lead time for changes: Time from committing a change to deployment to production. How quickly can we change a line of code and have it running in production? Again, this indicates mature automated testing and a mature CI/CD pipeline able to handle changes.
  • Mean time to restore (MTTR): How quickly restoration of production occurs in an outage or degradation. When there is a degradation, how quickly can the system auto-heal itself, scale to handle increased load, and/or This one is contraversal, as it's challenging to compare different events that cause degradation.
  • Change failure rate: After a production deployment, was it successful? Or was a fix or rollback required after the fact? How often is a change we made 'successful'? This ties in well with deployment frequency and lead time for changes, but is challenging to measure - as it requires a signoff off of success. Not just that the code deployed correctly, but that there weren't adverse effects or degradation of the deployment to the system

High performing metrics 1

The current solution:

We currently have all four of the metrics implemented and undergoing a pilot. (The Azure DevOps widget is currently not planned - but is possible if someone wants to build it!).

  • Deployment Frequency, in both Azure DevOps and GitHub:

    • How does it work? We look at the number of successful pipeline runs.
    • Assumptions/things we can't currently measure:
      • The build is multi-stage, and leads to a deployment in a production environment.
      • We only look at a single branch (usually the main branch), hence we ignore feature branches (as these probably aren't deploying to production)
    • Current limitations: Only one build/run/branch can be specified Deployment Frequency
  • Lead time for changes, in both Azure DevOps and GitHub:

    • How does it work? We look at the number of successful pipeline runs and match it with Pull Requests
    • Assumptions/things we can't currently measure:
      • We currently count the pull request and deployment durations, averaging them for the time period to create the lead time for changes metric.
      • We start measuring at the last commit for a branch to the PR close/merge time. Development is variable that depends on the task, and doesn't help with this measurement.
      • We assume we are following a git flow process, creating feature branches and merging back to the main branch, which is deployed to production on the completion of pull requests
      • We assume that the user requires pull requests to merge work into the main branch - we are looking at all work that is not on this main branch - hence we currently only support one main branch.
    • Current limitations: Only one repo and main branch can be specified Lead time for changes
  • Time to restore service, in Azure

    • How does it work? We setup Azure Monitor alerts on our resources, for example, on our web service, where we have an alerts for HTTP500 and HTTP403 errors, as well as monitoring CPU and RAM. If any of these alerts are triggered, we capture the alert in an Azure function, and save it into a Azure table storage, where we can aggregate and measure the time of the outage. When the alert is later resolved, this also triggers through the same workflow to save the the resolution and record the restoration of service.
    • Assumptions/things we can't currently measure:
      • Our project is hosted in Azure
      • The production environment is contained in a single resource group
      • There are appropriate alerts setup on each of the resources, each with action groups to save the alert to Azure Storage
      • We generate an SLA, but it's entirely based on the MTTR time - assuming the application is "not available" during this time
    • Current limitations:
      • Only one production resource group can be specified
      • If there is catastrophic resource group failure, (e.g. deleted), there is a high chance that some/all of the alerts will also be deleted Time to restore service
  • Change failure rate, in Azure DevOps and GitHub

    • How does it work? We look at builds, and let the user indicate if it was successful or a failure. By default (currently), the build is considered a failure. (We are going to change this to success by default later)
    • Assumptions/things we can't currently measure:
      • The build is multi-stage, and leads to a deployment in a production environment.
      • We only look at a single branch (usually the main branch), hence we ignore feature branches (as these probably aren't deploying to production)
      • The user has reviewed the build/deployment and confirmed that the production deployment was successful
    • Current limitations: Only one build/run can be specified Change failure rate

Architecture

Developed in .NET 8. A GitHub action runs the CI/CD process.

Currently the CI/CD process:

  1. Builds the code
  2. Runs the unit tests
  3. Deploys the webservice to a Azure web app (https://devops-prod-eu-service.azurewebsites.net)
  4. Deploys the demo website to a Azure web app (https://devops-prod-eu-web.azurewebsites.net)
  5. Deploys the function website to a Azure function

Dependabot runs daily to check for dependency upgrades.

Architecture diagram

Badges

The API can generate a URL for static badges, some samples are shown below: Build Build Build

Setup

Deploying to Azure

  • Run the infrastructure setup script [Currently \src\DevOpsMetrics.Infrastructure\DeployInfrastructureToAzure2.ps1]
  • DevOpsMetrics.Service setup: Keyvault URL and application insights id set as part of setup script
  • Browse to [website name].azurewebsites.net/Home/Settings, and setup your projects as needed. Note that all secrets are loaded into the keyvault and are controlled by you!

To debug/run tests

What's next?

  • Upgrades to packaging and setup (in progress)
  • Upgrades to store data in CosmosDB (currently in Azure storage)
  • Support for more scenarios, releases, etc
  • Azure DevOps marketplace integrations, so you can see the changes real time on your project/repo. (lower priority to focus on GitHub)

References

Footnotes

  1. Chart from page 11 of state of DevOps 2022 report โ†ฉ

devopsmetrics's People

Contributors

chrishanna avatar dependabot-preview[bot] avatar dependabot[bot] avatar samsmithnz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devopsmetrics's Issues

Daily DevOps - 28-Jul-2020, 9:51:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0.5333
Deployments times per week 3.7331

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status
482 01-Jul-2020, 2:17:57 am 01-Jul-2020, 2:27:20 am 9:23 completed
484 02-Jul-2020, 12:49:34 pm 02-Jul-2020, 12:58:29 pm 8:55 completed
487 03-Jul-2020, 10:49:13 am 03-Jul-2020, 10:58:05 am 8:52 completed
499 06-Jul-2020, 12:20:09 pm 06-Jul-2020, 12:29:17 pm 9:08 completed
501 14-Jul-2020, 12:04:34 pm 14-Jul-2020, 12:13:56 pm 9:22 completed
504 15-Jul-2020, 4:41:40 pm 15-Jul-2020, 4:52:02 pm 10:22 completed
506 15-Jul-2020, 6:34:25 pm 15-Jul-2020, 6:43:40 pm 9:15 completed
517 19-Jul-2020, 9:33:56 pm 19-Jul-2020, 9:47:26 pm 13:30 completed
519 25-Jul-2020, 3:48:14 pm 25-Jul-2020, 4:02:56 pm 14:42 completed
521 25-Jul-2020, 7:48:38 pm 25-Jul-2020, 8:02:55 pm 14:17 completed
525 27-Jul-2020, 6:54:08 pm 27-Jul-2020, 7:07:59 pm 13:51 completed
530 27-Jul-2020, 8:03:33 pm 27-Jul-2020, 8:19:12 pm 15:39 completed
534 28-Jul-2020, 2:10:00 pm 28-Jul-2020, 2:25:36 pm 15:36 completed
536 28-Jul-2020, 2:44:37 pm 28-Jul-2020, 2:59:14 pm 14:37 completed
541 28-Jul-2020, 4:01:00 pm 28-Jul-2020, 4:20:02 pm 19:02 completed
542 28-Jul-2020, 4:01:51 pm 28-Jul-2020, 4:13:29 pm 11:38 completed

Create Azure DevOps widget

  • Create new marketplace publisher and destination
  • Create hello world app
  • Package hello world app
  • Publish hello world app
  • Use CI to package package
  • Use CD to publish package
  • Implement deployment frequency

Move PAT Tokens into a secure location and stop passing them as query parameters

Couple options here:

  • Put the pat tokens into a key vault

  • Use database/settings table with key to identify it
    exchange with a code that extracts the PAT token from the settings table (and therefore isn't passed around like candy).

  • Basic Authentication:
    Advantages:

    • PAT tokens and Client Secrets are visible in the URL

    Disadvantages:

    • Basic authentication is still user visible in requests. This is better, but not the best.
  • Other...?

Daily DevOps - 28-Jul-2020, 9:52:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0.5333
Deployments times per week 3.7331

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status
482 01-Jul-2020, 2:17:57 am 01-Jul-2020, 2:27:20 am 9:23 completed
484 02-Jul-2020, 12:49:34 pm 02-Jul-2020, 12:58:29 pm 8:55 completed
487 03-Jul-2020, 10:49:13 am 03-Jul-2020, 10:58:05 am 8:52 completed
499 06-Jul-2020, 12:20:09 pm 06-Jul-2020, 12:29:17 pm 9:08 completed
501 14-Jul-2020, 12:04:34 pm 14-Jul-2020, 12:13:56 pm 9:22 completed
504 15-Jul-2020, 4:41:40 pm 15-Jul-2020, 4:52:02 pm 10:22 completed
506 15-Jul-2020, 6:34:25 pm 15-Jul-2020, 6:43:40 pm 9:15 completed
517 19-Jul-2020, 9:33:56 pm 19-Jul-2020, 9:47:26 pm 13:30 completed
519 25-Jul-2020, 3:48:14 pm 25-Jul-2020, 4:02:56 pm 14:42 completed
521 25-Jul-2020, 7:48:38 pm 25-Jul-2020, 8:02:55 pm 14:17 completed
525 27-Jul-2020, 6:54:08 pm 27-Jul-2020, 7:07:59 pm 13:51 completed
530 27-Jul-2020, 8:03:33 pm 27-Jul-2020, 8:19:12 pm 15:39 completed
534 28-Jul-2020, 2:10:00 pm 28-Jul-2020, 2:25:36 pm 15:36 completed
536 28-Jul-2020, 2:44:37 pm 28-Jul-2020, 2:59:14 pm 14:37 completed
541 28-Jul-2020, 4:01:00 pm 28-Jul-2020, 4:20:02 pm 19:02 completed
542 28-Jul-2020, 4:01:51 pm 28-Jul-2020, 4:13:29 pm 11:38 completed

How will other users consume this?

From a scale perspective, this is just one table storage container, can it handle 10, 100, 1000 users? We certainly don't want to be managing other users data.

Therefore, from a data perspective, users need confidence that their data is protected - hence, the current solution with a central azure data store is not ideal. There should be some way for users to easily configure and deploy this to their own tenants.

Daily DevOps - 29-Jul-2020, 12:00:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0
Deployments times per month 0

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status

Refactor secrets into Key Vault

While all secrets in the POC are managed with User Secrets and injecting secrets into the web app on deployment, there could be some benefit to refactoring PAT Token and Client Secrets into a key vault.

Prepare for hackathon

  • Add ARM template
  • Add slots to web app
  • Add functional testing via Selenium to test the staging slot before it swaps
  • Add code reviews to branch policies
  • Create architecture diagram

Daily DevOps - 29-Jul-2020, 11:58:56 am

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0
Deployments times per month 0

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status

Daily DevOps - 29-Jul-2020, 11:59:56 am

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0
Deployments times per month 0

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status

Daily DevOps - 28-Jul-2020, 9:55:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0.5333
Deployments times per week 3.7331

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status
482 01-Jul-2020, 2:17:57 am 01-Jul-2020, 2:27:20 am 9:23 completed
484 02-Jul-2020, 12:49:34 pm 02-Jul-2020, 12:58:29 pm 8:55 completed
487 03-Jul-2020, 10:49:13 am 03-Jul-2020, 10:58:05 am 8:52 completed
499 06-Jul-2020, 12:20:09 pm 06-Jul-2020, 12:29:17 pm 9:08 completed
501 14-Jul-2020, 12:04:34 pm 14-Jul-2020, 12:13:56 pm 9:22 completed
504 15-Jul-2020, 4:41:40 pm 15-Jul-2020, 4:52:02 pm 10:22 completed
506 15-Jul-2020, 6:34:25 pm 15-Jul-2020, 6:43:40 pm 9:15 completed
517 19-Jul-2020, 9:33:56 pm 19-Jul-2020, 9:47:26 pm 13:30 completed
519 25-Jul-2020, 3:48:14 pm 25-Jul-2020, 4:02:56 pm 14:42 completed
521 25-Jul-2020, 7:48:38 pm 25-Jul-2020, 8:02:55 pm 14:17 completed
525 27-Jul-2020, 6:54:08 pm 27-Jul-2020, 7:07:59 pm 13:51 completed
530 27-Jul-2020, 8:03:33 pm 27-Jul-2020, 8:19:12 pm 15:39 completed
534 28-Jul-2020, 2:10:00 pm 28-Jul-2020, 2:25:36 pm 15:36 completed
536 28-Jul-2020, 2:44:37 pm 28-Jul-2020, 2:59:14 pm 14:37 completed
541 28-Jul-2020, 4:01:00 pm 28-Jul-2020, 4:20:02 pm 19:02 completed
542 28-Jul-2020, 4:01:51 pm 28-Jul-2020, 4:13:29 pm 11:38 completed

Create GitHub widget

Should it be a GitHub app or oAuth app?

  • Make decision on GitHub app or oAuth app? (GitHub App)

https://docs.github.com/en/developers/apps/about-apps
https://docs.github.com/en/developers/apps/differences-between-github-apps-and-oauth-apps

  • GitHub apps run as the user who authorized them. GitHub Apps run as themselves.
GitHub Apps OAuth Apps
You must be an organization owner or have admin permissions in a repository to install a GitHub App on an organization. If a GitHub App is installed in a repository and requires organization permissions, the organization owner must approve the application. You can authorize an OAuth app to have access to resources.
You can install a GitHub App on your personal repository. You can authorize an OAuth app to have access to resources.
You must be an organization owner, personal repository owner, or have admin permissions in a repository to uninstall a GitHub App and remove its access. You can delete an OAuth access token to remove access.
You must be an organization owner or have admin permissions in a repository to request a GitHub App installation. If an organization application policy is active, any organization member can request to install an OAuth App on an organization. An organization owner must approve or deny the request.
  • Establish language needed
  • Create base GitHub app and setup (probably storage account connection string?)
  • Add CI/CD to continuously push changes
  • Add deployment frequency metric to GitHub app
  • Review

Daily DevOps - 29-Jul-2020, 12:01:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0
Deployments times per month 0

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status

Daily DevOps - 29-Jul-2020, 12:02:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0
Deployments times per month 0

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status

Daily DevOps - 28-Jul-2020, 9:53:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0.5333
Deployments times per week 3.7331

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status
482 01-Jul-2020, 2:17:57 am 01-Jul-2020, 2:27:20 am 9:23 completed
484 02-Jul-2020, 12:49:34 pm 02-Jul-2020, 12:58:29 pm 8:55 completed
487 03-Jul-2020, 10:49:13 am 03-Jul-2020, 10:58:05 am 8:52 completed
499 06-Jul-2020, 12:20:09 pm 06-Jul-2020, 12:29:17 pm 9:08 completed
501 14-Jul-2020, 12:04:34 pm 14-Jul-2020, 12:13:56 pm 9:22 completed
504 15-Jul-2020, 4:41:40 pm 15-Jul-2020, 4:52:02 pm 10:22 completed
506 15-Jul-2020, 6:34:25 pm 15-Jul-2020, 6:43:40 pm 9:15 completed
517 19-Jul-2020, 9:33:56 pm 19-Jul-2020, 9:47:26 pm 13:30 completed
519 25-Jul-2020, 3:48:14 pm 25-Jul-2020, 4:02:56 pm 14:42 completed
521 25-Jul-2020, 7:48:38 pm 25-Jul-2020, 8:02:55 pm 14:17 completed
525 27-Jul-2020, 6:54:08 pm 27-Jul-2020, 7:07:59 pm 13:51 completed
530 27-Jul-2020, 8:03:33 pm 27-Jul-2020, 8:19:12 pm 15:39 completed
534 28-Jul-2020, 2:10:00 pm 28-Jul-2020, 2:25:36 pm 15:36 completed
536 28-Jul-2020, 2:44:37 pm 28-Jul-2020, 2:59:14 pm 14:37 completed
541 28-Jul-2020, 4:01:00 pm 28-Jul-2020, 4:20:02 pm 19:02 completed
542 28-Jul-2020, 4:01:51 pm 28-Jul-2020, 4:13:29 pm 11:38 completed

Add a database to cache data and remove worst case scenario (everytime!)

  • Many of the build pipelines remove builds after a certain number of builds or days, especially Pull Request/feature branches

By caching the data, I'll have a longer list of data to build a real picture.

  • Add builds, pull requests and pull request commits to an Azure Storage table
  • Create a process to update these tables regularly (hourly? daily?)
  • Move the criteria into a settings table
  • Final integration testing

Daily DevOps - 29-Jul-2020, 11:57:56 am

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0
Deployments times per month 0

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status

Create Probot automation

Probot needs to do

  • Create prototype Probot
  • Run periodically
  • Run the API to get data
  • Process the data and create a static image from the binary stream
  • Fix the settings
    Stretch goals:
  • stretch goal: Post the badges for all 4 metrics
  • stretch goal: Post the badges into readme.md file
  • stretch goal: Can we post as the bot instead of the owner

Daily DevOps - 28-Jul-2020, 9:54:33 pm

Daily DevOps Metrics


Days Included In Metrics : 30

Devops Badge

Metric Value
Deployments Per Day Metric 0.5333
Deployments times per week 3.7331

Build History

buildNumber startTime endTime buildDurationInMinutesAndSeconds status
482 01-Jul-2020, 2:17:57 am 01-Jul-2020, 2:27:20 am 9:23 completed
484 02-Jul-2020, 12:49:34 pm 02-Jul-2020, 12:58:29 pm 8:55 completed
487 03-Jul-2020, 10:49:13 am 03-Jul-2020, 10:58:05 am 8:52 completed
499 06-Jul-2020, 12:20:09 pm 06-Jul-2020, 12:29:17 pm 9:08 completed
501 14-Jul-2020, 12:04:34 pm 14-Jul-2020, 12:13:56 pm 9:22 completed
504 15-Jul-2020, 4:41:40 pm 15-Jul-2020, 4:52:02 pm 10:22 completed
506 15-Jul-2020, 6:34:25 pm 15-Jul-2020, 6:43:40 pm 9:15 completed
517 19-Jul-2020, 9:33:56 pm 19-Jul-2020, 9:47:26 pm 13:30 completed
519 25-Jul-2020, 3:48:14 pm 25-Jul-2020, 4:02:56 pm 14:42 completed
521 25-Jul-2020, 7:48:38 pm 25-Jul-2020, 8:02:55 pm 14:17 completed
525 27-Jul-2020, 6:54:08 pm 27-Jul-2020, 7:07:59 pm 13:51 completed
530 27-Jul-2020, 8:03:33 pm 27-Jul-2020, 8:19:12 pm 15:39 completed
534 28-Jul-2020, 2:10:00 pm 28-Jul-2020, 2:25:36 pm 15:36 completed
536 28-Jul-2020, 2:44:37 pm 28-Jul-2020, 2:59:14 pm 14:37 completed
541 28-Jul-2020, 4:01:00 pm 28-Jul-2020, 4:20:02 pm 19:02 completed
542 28-Jul-2020, 4:01:51 pm 28-Jul-2020, 4:13:29 pm 11:38 completed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.