Skip to content

インシデントダッシュボード: GitHub Pages/Issuesでのメトリクス可視化 #61

@nwiizo

Description

@nwiizo

Jobs to be Done

状況: 定期的な振り返りやレポート作成時
ジョブ: インシデント対応の傾向と改善状況を把握したい
期待する成果: データに基づいた改善活動ができる

背景

インシデント情報はGitHub Issuesに蓄積されるが、傾向分析やメトリクス確認には手動集計が必要。GitHub内で完結するダッシュボード機能を提供する。

提案する機能

1. サマリーIssue自動生成

週次/月次でインシデントサマリーを自動生成

## 📊 インシデントサマリー (2024年1月)

### 概要
| 指標 | 今月 | 先月 | 変化 |
|------|------|------|------|
| インシデント数 | 12 | 15 | ↓ 20% |
| 平均MTTA | 5分 | 8分 | ↓ 37% |
| 平均MTTR | 25分 | 40分 | ↓ 37% |
| Severity 1 | 1 | 2 | ↓ 50% |

### カテゴリ別
- インフラ: 5件
- アプリケーション: 4件
- 外部サービス: 3件

### Top 原因
1. デプロイ起因 (4件)
2. 設定ミス (3件)
3. リソース枯渇 (2件)

### 未完了のフォローアップ
- [ ] #45: メモリリーク修正
- [ ] #48: アラート閾値調整
- [ ] #52: ランブック更新

2. GitHub Actions定期実行

# .github/workflows/incident-report.yaml
name: Monthly Incident Report
on:
  schedule:
    - cron: '0 0 1 * *'  # 毎月1日
jobs:
  report:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Generate Report
        run: |
          ./alert-menta report --period monthly --output issue

3. GitHub Pages ダッシュボード(将来)

  • 静的HTMLとしてメトリクスを可視化
  • Chart.js等でグラフ表示

4. 設定

reporting:
  enabled: true
  schedule: "monthly"  # weekly, monthly
  output:
    type: "issue"  # issue, markdown_file, github_pages
    labels: ["report", "incident-summary"]
  metrics:
    - incident_count
    - mtta
    - mttr
    - severity_distribution
    - category_distribution

競合分析

Keep

  • 概要: オープンソースのアラート管理プラットフォーム
  • 特徴: 単一ペインUI、複数ソース統合
  • ダッシュボード: Webベースのリアルタイムダッシュボード
  • 参考: https://github.com/keephq/keep

incident.io

  • 概要: 商用インシデント管理プラットフォーム
  • 特徴: 洗練されたダッシュボード、MTTA/MTTR追跡
  • 参考: https://incident.io/

技術詳細

GitHub Pages静的サイト生成

.github/
  pages/
    index.html      # ダッシュボードテンプレート
    data.json       # メトリクスデータ
    charts.js       # Chart.js設定

JSON→HTML変換

// internal/report/generator.go
type ReportData struct {
    Period      string         `json:"period"`
    GeneratedAt time.Time      `json:"generated_at"`
    Metrics     MetricsSummary `json:"metrics"`
    Incidents   []IncidentSummary `json:"incidents"`
}

type MetricsSummary struct {
    TotalCount    int           `json:"total_count"`
    MTTA          time.Duration `json:"mtta"`
    MTTR          time.Duration `json:"mttr"`
    ByCategory    map[string]int `json:"by_category"`
    BySeverity    map[string]int `json:"by_severity"`
    TopCauses     []CauseSummary `json:"top_causes"`
}

func GenerateReport(issues []github.Issue, period string) (*ReportData, error) {
    // 1. インシデントIssueをフィルタリング
    incidents := filterIncidentIssues(issues)
    
    // 2. メトリクス計算
    metrics := calculateMetrics(incidents)
    
    // 3. レポートデータ構築
    return &ReportData{
        Period:      period,
        GeneratedAt: time.Now(),
        Metrics:     metrics,
        Incidents:   summarizeIncidents(incidents),
    }, nil
}

Chart.js統合

<!-- .github/pages/index.html -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
// data.jsonを読み込んでチャート描画
fetch('data.json')
  .then(r => r.json())
  .then(data => {
    // インシデント数推移
    new Chart(document.getElementById('incidentChart'), {
      type: 'line',
      data: {
        labels: data.months,
        datasets: [{
          label: 'Incidents',
          data: data.incident_counts
        }]
      }
    });
    
    // カテゴリ分布
    new Chart(document.getElementById('categoryChart'), {
      type: 'doughnut',
      data: {
        labels: Object.keys(data.metrics.by_category),
        datasets: [{
          data: Object.values(data.metrics.by_category)
        }]
      }
    });
  });
</script>

GitHub Actions ワークフロー

# .github/workflows/dashboard.yaml
name: Update Dashboard
on:
  schedule:
    - cron: '0 0 * * 0'  # 毎週日曜
  workflow_dispatch:

jobs:
  update:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pages: write
    steps:
      - uses: actions/checkout@v4
      - name: Generate Data
        run: |
          ./alert-menta report --output json > .github/pages/data.json
      - name: Deploy to Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: .github/pages

差別化ポイント

観点 Keep incident.io alert-menta
ダッシュボード Webアプリ SaaS GitHub Pages
デプロイ Docker/K8s N/A (SaaS) GitHub Actions
データソース マルチソース 独自DB GitHub Issues
料金 オープンソース 有料 オープンソース

alert-mentaの強み:

  • GitHub内で完結(Issues → Pages)
  • 追加インフラ不要
  • 静的サイトで高速・低コスト

受け入れ基準

  • alert-menta report コマンドでサマリーが生成される
  • MTTA/MTTRが自動計算される
  • GitHub Actionsで定期実行できる
  • サマリーがIssueとして投稿される

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions