Prometheus (監視システム・2012)(プロメテウス)
SoundCloud 2012年公開・CNCF Graduated のオープンソース監視システム。Pull 型・PromQL クエリ言語・TSDB (時系列DB)、Kubernetes 標準監視。
概要
Prometheus はSoundCloud (音楽配信) の社内監視システムとして2012年にMatt Proud / Julius Volz / Björn Rabenstein 等が開発開始、2015年オープンソース公開・2016年CNCF (Cloud Native Computing Foundation) 第2プロジェクト (Kubernetes 後)・2018年Graduated (CNCF最上位ステータス)。Pull 型 (Prometheus がTarget からMetrics 取得) アーキテクチャ・PromQL (Prometheus Query Language)・TSDB (時系列DB) 内蔵で、Kubernetes / マイクロサービス監視の事実上標準。
主要マイルストーン
| 年月 | 出来事 |
|---|---|
| 2012 | SoundCloud 内部開発開始 |
| 2015-01-21 | オープンソース公開 |
| 2016-05 | CNCF Incubating |
| 2017-11-08 | Prometheus 2.0 (新TSDB) |
| 2018-08 | CNCF Graduated |
| 2020 | Prometheus 2.18 (Backfill / Remote Write 改良) |
| 2023 | Prometheus 2.50 (UI改善) |
| 2024-11 | Prometheus 3.0 |
Prometheus 主要技術
| 項目 | 仕様 |
|---|---|
| アーキ | Pull 型 (Prometheus → Target) |
| プロトコル | HTTP /metrics エンドポイント |
| データ形式 | Text (Prometheus exposition format) |
| クエリ | PromQL (関数型) |
| ストレージ | 内蔵TSDB (時系列DB) |
| 保持期間 | 15日 (デフォルト) ・拡張可 |
| Federation | あり (Prometheus 間連携) |
| Alerting | AlertManager (別バイナリ) |
| Dashboard | Grafana 連携 (Prometheus単独 UI なし) |
| HA | あり (Thanos / Cortex / Mimir) |
Pull 型 vs Push 型
| 項目 | Prometheus (Pull) | Datadog / New Relic (Push) |
|---|---|---|
| 制御 | Prometheus 側 | Target 側 |
| Discovery | Service Discovery (Kubernetes / Consul) | Agent 配布 |
| Failure 検知 | Pull失敗で即検知 | 別ヘルスチェック |
| ファイアウォール | サーバ→Target | Target→外 (穴開け不要) |
| マルチクラウド | 困難 | 容易 |
Pull 型はKubernetes と相性抜群 (Service Discovery で自動Target 検出)。
PromQL クエリ言語
Prometheus 独自関数型クエリ:
# 1. インスタンスCPU使用率
rate(node_cpu_seconds_total{mode="user"}[5m]) * 100
# 2. メモリ使用率の95%パーセンタイル
quantile_over_time(0.95,
(1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)[1h:])
# 3. 過去1時間のAPI エラー率
sum(rate(http_requests_total{status=~"5.."}[1h]))
/
sum(rate(http_requests_total[1h])) * 100
# 4. Pod別CPU使用量 (Kubernetes)
sum by (pod) (
rate(container_cpu_usage_seconds_total{namespace="default"}[5m])
)
複雑な集計・アラート条件・SLO 計算等を表現的に記述可能。
エコシステム (CNCF / OSS)
| ツール | 機能 |
|---|---|
| Prometheus | Metrics 収集 / TSDB |
| AlertManager | アラート通知 (Slack / Email / Webhook) |
| Grafana | Dashboard 可視化 |
| Pushgateway | 短命Job (Cron 等) Push Metrics |
| Node Exporter | Linux / Windows OS Metrics |
| cAdvisor | Container Metrics |
| Blackbox Exporter | HTTP / DNS / TCP probe |
| Loki | ログ集約 (Grafana Labs) |
| Tempo | トレース (Grafana Labs) |
| Thanos | 長期保存 + HA |
| Cortex | Multi-tenant HA |
| Mimir | Grafana Mimir (Cortex 後継) |
| VictoriaMetrics | Prometheus 互換 + 高性能 |
Exposition Format (Text-based)
Prometheus のmetric 公開形式:
# HELP http_requests_total Total HTTP requests
# TYPE http_requests_total counter
http_requests_total{method="GET",status="200"} 1027
http_requests_total{method="GET",status="404"} 3
http_requests_total{method="POST",status="200"} 472
# HELP http_request_duration_seconds Request duration
# TYPE http_request_duration_seconds histogram
http_request_duration_seconds_bucket{le="0.005"} 24054
http_request_duration_seconds_bucket{le="0.01"} 33444
http_request_duration_seconds_count 144320
http_request_duration_seconds_sum 53423
Text 形式・人間可読・全Lang Library 対応 (Python / Java / Go / Node.js / Ruby 等)。
主要採用企業
| 企業 | 用途 |
|---|---|
| Kubernetes (公式) | クラスタ監視 |
| SoundCloud (起源) | 音楽配信 |
| DigitalOcean | クラウド監視 |
| GitLab | DevOps Platform |
| Robinhood | 金融 |
| Showmax | ストリーミング |
| Uber | マイクロサービス監視 |
| Wikipedia | サーバ監視 |
Prometheus 3.0 (2024-11)
主要変更:
- UTF-8 Metric/Label 名対応
- Native Histograms 安定化
- OpenTelemetry Metrics 直接受信
- 古い機能廃止 (PromQL @ Modifier・Remote Write 1.0)
- 性能改善
関連用語との違い
- vs Grafana: Prometheus = 収集・保存 / Grafana = 可視化
- vs Datadog / New Relic: OSS / 商用
- vs Nagios / Zabbix: 古典 / 現代Kubernetes
FAQ
Q1: Datadog より良い? A: 用途別。Kubernetes / マイクロサービス Native ならPrometheus 圧倒・Multi-Cloud / SaaS 統合管理ならDatadog ($15-30/Host) 優位・運用工数で選ぶ。
Q2: ログも保存? A: Prometheus は Metrics 専用・ログはLoki / Elasticsearch / Datadog / Grafana Cloud で別管理。
Q3: スケーラビリティ? A: 単一Prometheus は中規模 (~1000ノード) 限界・大規模はThanos / Cortex / Mimir / VictoriaMetrics で水平スケール。