API Monitoring

Rates API includes a robust monitoring system that continuously checks the health of all endpoints. This system uses GitHub Actions to run automated checks every 15 minutes and alert developers when issues are detected.

How Monitoring Works

The monitoring workflow:

  1. Runs every 15 minutes via GitHub Actions
  2. Checks the health of all API endpoints
  3. Creates a GitHub Issue when problems are detected
  4. Notifies the repository owner through GitHub’s notification system

Monitored Endpoints

The following endpoints are continuously monitored:

  • API Root: The main API endpoint
  • Mortgage Rates: Both list and by-institution endpoints
  • Personal Loan Rates: Both list and by-institution endpoints
  • Car Loan Rates: Both list and by-institution endpoints
  • Credit Card Rates: Both list and by-issuer endpoints
  • Time Series Endpoints: Historical data for all rate types
  • API Documentation: The OpenAPI documentation endpoint

Alert System

When an endpoint fails, the monitoring system:

  1. Creates a new GitHub Issue with detailed information
  2. Labels the issue as “incident” and “high-priority”
  3. Mentions the repository owner to trigger a notification
  4. Provides specific details about which endpoints failed and why

GitHub Notifications

The notification system uses GitHub’s built-in @mentions to alert team members. Users will receive notifications according to their GitHub notification preferences (email, web, mobile).

To ensure you receive timely alerts:

  1. Check your GitHub notification settings at https://github.com/settings/notifications
  2. Enable notifications for “Issues” activity
  3. Configure your preferred notification method (web, email, mobile)

Required Permissions

The GitHub Action requires specific permissions to create issues and add labels. These permissions are already configured in the workflow file:

# Required permissions for creating issues and using labels
permissions:
  issues: write
  contents: read

If you’re using an organization with restricted permissions, ensure that:

  1. The repository settings allow GitHub Actions to create issues

    • Go to repository Settings > Actions > General
    • Under “Workflow permissions”, select “Read and write permissions”
    • Check “Allow GitHub Actions to create and approve pull requests”
    • Click “Save”
  2. Create the required labels in your repository:

    • Go to repository Issues > Labels
    • Create “incident” and “high-priority” labels if they don’t exist

Extending the Monitoring System

You can extend the monitoring system to include additional checks:

  • Add new endpoints to the monitoring workflow
  • Implement more detailed health checks
  • Set up additional notification channels (e.g., Slack, Discord, email)
  • Configure custom alerting thresholds or criteria