Skip to content

Add webhook-based monitoring specification with GitLab System Hook support#38

Merged
notfolder merged 6 commits into
mainfrom
copilot/update-monitoring-with-hooks
Nov 23, 2025
Merged

Add webhook-based monitoring specification with GitLab System Hook support#38
notfolder merged 6 commits into
mainfrom
copilot/update-monitoring-with-hooks

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 23, 2025

Issue requests transitioning from 5-minute polling to webhook-based monitoring for GitHub/GitLab issues and pull requests. Current approach wastes API quota and introduces unnecessary latency.

Changes

Added comprehensive Japanese specification document (docs/webhook_specification.md) covering:

Architecture

  • FastAPI webhook server receiving GitHub/GitLab events
  • HMAC-SHA256 (GitHub) and token (GitLab) signature validation
  • Event filtering: labeled actions with coding agent label
  • Existing Task classes and RabbitMQ queue integration unchanged
  • GitLab System Hook support: Additional endpoint for instance-wide monitoring

Design specifications (in Japanese)

  • Detailed design (詳細設計): Module functionality described in Japanese instead of code examples
  • Security considerations (セキュリティ考慮事項): Authentication, network security, rate limiting, input validation
  • Monitoring & logging (監視・ロギング): Log levels and output examples
  • Testing strategy (テスト戦略): Unit tests, integration tests, E2E tests
  • Performance considerations (パフォーマンス考慮事項): Load estimates and scalability

Document structure (9 sections)

  1. Overview (概要)
  2. Current state analysis (現状分析)
  3. Webhook design (Webhook方式の設計)
  4. Detailed design (詳細設計)
  5. Security considerations (セキュリティ考慮事項)
  6. Monitoring & logging (監視・ロギング)
  7. Testing strategy (テスト戦略)
  8. Performance considerations (パフォーマンス考慮事項)
  9. Summary (まとめ)

GitLab System Hook Support

  • Endpoint: POST /webhook/gitlab/system for instance-wide hooks (in addition to project-level webhooks)
  • Configuration: GITLAB_SYSTEM_HOOK_TOKEN environment variable for separate authentication
  • Compatibility: Issue and Merge Request events use identical payload structure in both system hooks and project webhooks
  • Use cases: Multi-project monitoring (system hooks) vs single project monitoring (project webhooks)
  • Permissions: Admin required for system hooks vs Maintainer for project webhooks
  • Flexibility: Both types can be used simultaneously or migrated gradually

Key design points

  • Real-time processing (seconds vs 5 minutes)
  • 60-80% reduction in API calls
  • Horizontal scaling via multiple webhook server instances
  • Event-driven architecture for better scalability
  • Full compatibility with GitLab System Hooks without architectural changes

No code changes in this PR—specification only. The document focuses on architecture and design rather than implementation details.

Original prompt

This section details on the original issue you should resolve

<issue_title>ポーリングではなくてhookで監視したい</issue_title>
<issue_description>現在、github/gitlabのissueやpull request/merge requestをポーリング監視しているが、これをhookで監視する様にしたい。仕様を検討して。

日本語のmarkdownで仕様を出力して下さい。</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 23, 2025 12:30
Co-authored-by: notfolder <20558197+notfolder@users.noreply.github.com>
Co-authored-by: notfolder <20558197+notfolder@users.noreply.github.com>
Copilot AI changed the title [WIP] Update monitoring to use webhooks instead of polling Add webhook-based monitoring specification to replace polling Nov 23, 2025
Copilot AI requested a review from notfolder November 23, 2025 12:33
Copy link
Copy Markdown
Owner

@notfolder notfolder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot レビューに従って修正して

Comment thread docs/webhook_specification.md
Comment thread docs/webhook_specification.md Outdated
#### 4.7.2 必要な権限
- Webhookを設定するには、プロジェクトの **Maintainer** 以上の権限が必要

## 5. 実装計画
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実装計画は不要

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実装計画セクションを削除しました。(5e32222)

Comment thread docs/webhook_specification.md Outdated
- 移行ガイド
- リリースノート

## 6. 移行戦略
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この章も不要

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移行戦略セクションを削除しました。(5e32222)

Comment thread docs/webhook_specification.md Outdated
- RabbitMQキューは両方式で共通のため、データロスなし
- 処理中タスクは影響を受けない

### 6.3 移行チェックリスト
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この章も不要

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移行チェックリストを削除しました。(5e32222)

Comment thread docs/webhook_specification.md Outdated
2024-01-15 10:30:45 INFO [webhook.server] Task queued successfully
```

### 8.2 メトリクス
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

監視メトリクスは不要

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

メトリクスサブセクションを削除しました。(5e32222)

Comment thread docs/webhook_specification.md Outdated
- キュー投入の高速化
- 不要なデータベースアクセスの削減

## 11. よくある質問(FAQ)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FAQも不要

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FAQセクションを削除しました。(5e32222)

Co-authored-by: notfolder <20558197+notfolder@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 23, 2025

@copilot レビューに従って修正して

すべてのレビューコメントに従って修正しました。詳細設計のコード例を日本語説明に変更し、実装計画、移行戦略、メトリクス、FAQの各セクションを削除しました。(5e32222)

Copy link
Copy Markdown
Owner

@notfolder notfolder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot システムフック対応したい。この設計で大丈夫か確認してください。

Comment thread docs/webhook_specification.md
Co-authored-by: notfolder <20558197+notfolder@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 23, 2025

@copilot システムフック対応したい。この設計で大丈夫か確認してください。

確認しました。現在の設計はGitLabシステムフックに完全対応可能です。

システムフック対応の詳細を仕様書に追加しました:

  • 専用エンドポイント /webhook/gitlab/system の追加
  • GITLAB_SYSTEM_HOOK_TOKEN による認証
  • ペイロード互換性の確認
  • 設定手順と権限要件の明記

プロジェクトWebhookとシステムフックは併用可能で、段階的な移行もサポートします。(29ef3ea)

Co-authored-by: notfolder <20558197+notfolder@users.noreply.github.com>
Copilot AI changed the title Add webhook-based monitoring specification to replace polling Add webhook-based monitoring specification with GitLab System Hook support Nov 23, 2025
Copilot AI requested a review from notfolder November 23, 2025 13:10
@notfolder notfolder marked this pull request as ready for review November 23, 2025 13:13
@notfolder notfolder merged commit 46238ff into main Nov 23, 2025
@notfolder notfolder mentioned this pull request Nov 23, 2025
@notfolder notfolder deleted the copilot/update-monitoring-with-hooks branch November 27, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ポーリングではなくてhookで監視したい

2 participants