AZ-400: Designing and Implementing Microsoft DevOps Solutions

Configure Monitoring for a DevOps Environment

Configure monitoring in GitHub

In this article, we explore how to configure monitoring in GitHub with a focus on a robust instrumentation strategy and preparation for the AZ-400: Designing and Implementing Microsoft DevOps Solutions exam.

Overview

Effective monitoring in GitHub is similar to a ship captain relying on instruments for navigation. GitHub Insights serves as your navigational tool, offering key metrics on commit frequency, pull request activity, issue resolution times, workflow durations, success rates, and more.


1. Exploring the KodeKloud Coffee Repository

Start by examining the KodeKloud Coffee repository. Notice the repository’s structure with folders such as .github/workflows, public, and various JavaScript files:

The image shows a GitHub repository page named "KodeKloudCoffee" with various files and folders listed, including `.github/workflows`, `public`, and several JavaScript files. The repository has 20 commits and no stars or forks.


2. Analyzing GitHub Insights

Click on the "Insights" tab in the repository to review key metrics. Here are some observations:

  • No active pull requests or issues during the week.
  • Excluding merge commits, one author pushed a total of 20 commits.

Even though the repository might not be actively developed by multiple people, it still serves as an excellent example of available monitoring features.

The image shows a GitHub repository insights page for "KodeKloudCoffee," displaying activity metrics such as commits, pull requests, and issues for the week of October 2-9, 2024. It indicates 20 commits by one author with no active pull requests or issues.

Contributors Overview

Within the Insights section, the "Contributors" view displays commit history over time. For instance, you might see that 20 commits were made in a single day by Jeremy Morgan. In repositories with multiple contributors, the graph would differentiate contributions by each individual, detailing additions and deletions.

The image shows a GitHub contributions graph displaying commits over time, with a specific user highlighted for their contributions. The graph indicates a steady increase in contributions from September 28 to October 5, 2024.


3. Monitoring Community Engagement

GitHub also provides community engagement tools. Under the Community Standards section, you can review a checklist ensuring the project meets recommended documentation practices. This feature is crucial for public repositories, as it allows for configuration of:

  • Code of conduct
  • Contributing guidelines
  • Licensing information
  • Security policy
  • Issue and pull request templates

The image shows a GitHub repository page for "KodeKloudCoffee" under the "Community Standards" section, displaying a checklist for project documentation and guidelines.


4. Analyzing Traffic Data

The Traffic metric provides insights on:

  • Referring sites
  • Workflow runs
  • Clone counts
  • Visitor statistics

Even for private repositories, monitoring traffic data can reveal important usage patterns.

The image shows a GitHub traffic analytics page with graphs displaying data on clones and visitors over a period of time. It includes specific metrics such as views, unique visitors, and clones.


5. Commit Activity and Code Frequency

Monitoring commit frequency is essential. For example, a spike of 20 commits in one day (known as "churn") might signal underlying issues like build failures in the CI/CD process.

The image shows a GitHub insights page for a repository named "KodeKloudCoffee," displaying a commit activity graph. The graph indicates a spike of 20 commits on a Monday, with no activity on other days.

The Code Frequency section shows weekly additions and deletions, providing an understanding of project evolution. Significant deletions might indicate refactoring, while many additions could suggest feature expansion.

The image shows a GitHub page displaying the code frequency graph for the repository "KodeKloudCoffee," highlighting additions and deletions over time. The graph currently shows no data points.


6. Dependency Management and Dependabot

GitHub can automatically generate a dependency graph if your repository contains files like Gemfile, package.json, or requirements.txt. In this case, no dependencies are found, but you have the option to enable Dependabot to scan for security updates automatically.

The image shows a GitHub repository page for "KodeKloudCoffee" with the "Dependency graph" section open. It indicates that Dependabot version updates aren't configured yet, with an option to create a config file.

Enabling Dependabot

To activate Dependabot, create a configuration file named "dependabot.yml" in your repository. The following snippet is tailored for an npm-based project:

# To get started with Dependabot version updates, specify the package ecosystem and the location of the package manifest.
version: 2
updates:
  - package-ecosystem: "npm" # Supported values are documented online
    directory: "/" # Location of the package manifest, e.g., package.json
    schedule:
      interval: "weekly"

Once committed, Dependabot will scan your repository weekly for dependency updates.


7. Visualizing Branch Activities with the Network Graph

The Network graph offers a timeline view of commits and branch activities. A spike (for example, 53 commits in one week) could signal the need for a deeper investigation into your process.

The image shows a GitHub network graph for the repository "KodeKloudCoffee" by "jeremykodekloud," displaying a timeline of recent commits. The interface includes options like Pulse, Contributors, and Network on the left sidebar.


8. Additional Metrics: Forks and Actions Usage

For public repositories, other vital metrics include:

Resource TypeInsights Provided
ForksNumber of users who have forked your repository
Actions UsageTotal job runs, minutes consumed, and runtime details

The Actions usage dashboard is particularly important for projects with high build minute requirements—it may be cost-effective to switch to self-hosted runners for larger workloads.

The image shows a GitHub Actions Usage Metrics page, displaying total minutes and job runs for workflows in an organization, with details on specific jobs and their runtime environments.

To review workflow runs, navigate to the "Actions" tab. Click on a workflow run to see details such as duration per step. For instance, if the Dependabot step consistently takes longer than others, it could be a candidate for optimization.

The image shows a GitHub Actions page for the repository "KodeKloudCoffee," displaying a list of recent workflow runs with their statuses and details.


9. Deployment Workflow Configuration

One workflow deploys an application to an Azure web app. Below is an example snippet of the deployment configuration:

app-name: kodekloudcoffee
publish-profile: "***"
package:
  slot-name: production
env:
  AZURE_WEBAPP_NAME: kodekloudcoffee
  AZURE_WEBAPP_PACKAGE_PATH: "."
  NODE_VERSION: "20.x"

Monitoring these workflow steps helps you identify potential bottlenecks and improve your CI/CD process.


10. Email Notifications and Webhooks

Effective communication is crucial during development. You can configure email notifications in the repository settings to ensure important alerts are not missed. Specifically, setting up email addresses for push event notifications can bypass spam filters.

The image shows a GitHub settings page for configuring email notifications, where users can set email addresses to receive notifications when push events are triggered.

In addition, GitHub allows for webhook configuration, which is ideal for integrating your repository with external systems or services.

The image shows a GitHub settings page for adding a webhook, where users can configure the payload URL, content type, secret, SSL verification, and select events to trigger the webhook.


Summary

This article covered the essentials of GitHub monitoring, including:

  • GitHub Insights and commit activity
  • Community engagement and traffic analytics
  • Code frequency metrics and dependency management
  • Network graphs to monitor branch activities
  • CI/CD workflows and configuration for deployments
  • Email notifications and webhook integrations

Key Takeaway

Effective monitoring is the foundation of a healthy and efficient development process. Utilizing GitHub’s built-in tools and features ensures you stay informed and can swiftly address any issues.

Happy monitoring, and see you in the next article!

Watch Video

Watch video content

Previous
Configure collection of telemetry by using Azure various services