github-monitoring

module
v0.0.0-...-d527ca8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2025 License: MIT

README ΒΆ

πŸ“Š Askrella GitHub Actions Resource Monitor

Go Version Build Status License Dependabot Test Coverage

A lightweight system resource monitoring daemon that tracks CPU, memory, storage, and network usage during GitHub Actions workflows. The collected metrics are visualized as graphs and can be posted as a comment on the associated Pull Request.

Developed by and for Askrella β€’ Core Maintainer: @steve-hb

✨ Features

  • πŸ–₯️ System Metrics Collection: Monitors CPU, memory, disk, and network usage
  • βš™οΈ Configurable Monitoring: Adjust sampling intervals and choose which metrics to collect
  • πŸ“ˆ Visualization: Generates time-series graphs for all collected metrics
  • πŸ”„ GitHub Integration: Posts results directly to GitHub Pull Requests
  • πŸš€ Low Overhead: Designed to run alongside CI/CD workflows without significant impact
  • βœ… Code Quality: Enforced through comprehensive golangci-lint configuration
  • πŸ”„ Dependency Management: Automated with Dependabot to keep dependencies up-to-date

πŸš€ Quick Start

Using GitHub Action

Simply add the monitoring action to your workflow:

- name: Monitor Performance
  uses: askrella/github-monitoring/.github/actions/monitoring@main
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    command: "go test ./... -v"

Note: The monitoring daemon runs in the background and will not block your workflow steps.

Using Command Line
# Build the tool
go build -o monitor ./cmd/monitor

# Start monitoring
./monitor start --interval 1

# Run your workload
go test ./...

# Stop and generate visualizations
./monitor stop
./monitor visualize

πŸ”„ Using as a GitHub Action

This repository provides a reusable GitHub Action that you can use in your own workflows to monitor performance.

Direct Action Usage
- name: Monitor Performance
  uses: askrella/github-monitoring/.github/actions/monitoring@main
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    command: "go test ./... -v"
    interval: 1
    metrics: "cpu,memory,disk,network"
    wait_after_command: 5
Reusable Workflow Usage
name: Performance Test
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  monitor-tests:
    uses: askrella/github-monitoring/.github/workflows/reusable-monitoring.yml@main
    with:
      command: "go test ./... -v"
      interval: "1"
      metrics: "cpu,memory,disk,network"
    secrets:
      github_token: ${{ secrets.GITHUB_TOKEN }}

See the GitHub Actions Documentation for more details.

πŸ› οΈ Command Line Reference

Monitor Command
monitor start [flags]
FlagDescriptionDefault
--interval, -iSampling interval in seconds1
--output, -oPath to save metrics datametrics.json
--cpu, -cCollect CPU metricstrue
--memory, -mCollect memory metricstrue
--disk, -dCollect disk metricstrue
--network, -nCollect network metricstrue
--verbose, -vEnable verbose loggingfalse
Stop Command
monitor stop [flags]
FlagDescriptionDefault
--output, -oPath to save metrics datametrics.json
Visualize Command
monitor visualize [flags]
FlagDescriptionDefault
--input, -iPath to metrics data filemetrics.json
--output-dir, -oDirectory to save visualization filesvisualizations
Process Command
monitor process [flags]
FlagDescriptionDefault
--input, -iPath to metrics data file to processmetrics.json
--output-dir, -oDirectory to save visualization filesvisualizations
--comment-pr, -pWhether to comment on the PR with resultsfalse
--github-token, -tGitHub token for PR comments"" (uses GITHUB_TOKEN env var if not provided)
--verbose, -vEnable verbose loggingfalse
PR Comment Command
monitor pr-comment [flags]
FlagDescriptionDefault
--report-dir, -rDirectory containing visualization files and reportvisualizations
--token, -tGitHub token for authentication
--owner, -oGitHub repository owner/organization
--repo, -pGitHub repository name
--pr, -nPull request number

πŸ“Š Output

The monitoring daemon generates the following output:

πŸ“„ JSON Metrics File

Raw metrics data with timestamps for further analysis.

πŸ“ˆ Visualization Files

  • CPU Usage
  • Per-Core CPU Usage
  • Memory Usage
  • Disk Usage
  • Network Usage

πŸ“ Markdown Report

A comprehensive summary including:
  • Statistical analysis
  • Performance trends
  • Visual graphs

πŸ§ͺ Testing

For information on running and writing tests, see the Testing Guide.

πŸ› οΈ Building from Source

git clone https://github.com/askrella/github-monitoring.git
cd github-monitoring
go build -o monitor ./cmd/monitor

πŸ“‹ Requirements

  • Go 1.24 or later

πŸ“ License

MIT License

πŸ‘₯ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Directories ΒΆ

Path Synopsis
cmd
monitor command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL