コンテンツへスキップ
LatchkeyLatchkey home

StatsD vs Prometheus: どちらのメトリクスアプローチ?

StatsD は小さな集約デーモンを持つ、シンプルな push ベースのメトリクスプロトコルです。Prometheus は豊富なクエリ言語を備えた、次元的な pull ベースの監視システムです。

StatsD はアプリケーションが UDP 経由で counter や timer を fire-and-forget でデーモンに送り、それが集約して転送する仕組みで、次元性よりもシンプルさを重視します。Prometheus はラベル付きメトリクスをスクレイプし、PromQL、アラート、大きなエコシステムを提供します。StatsD はシンプルさと容易なアプリ計装で勝り、Prometheus は次元的なクエリ、アラート、エコシステムで勝ります。

StatsDPrometheus
モデルpush (UDP)pull (scrape)
次元限定的 (タグは様々)一級のラベル
クエリ下流の store 経由PromQL
アラート外部組み込み
最適な用途シンプルなアプリメトリクス次元的な監視

ユースケースとモデル

StatsD は、アプリが scrape エンドポイントを公開せずにシンプルなメトリクスを push する、素早いアプリケーション計装に適しています。Prometheus は、ラベル、強力なクエリ、組み込みのアラートを備えた次元的な監視に適しています。statsd_exporter は StatsD メトリクスを Prometheus にブリッジできます。

運用と CI への適合

StatsD はきわめて軽量です。Prometheus はより完全なシステムですが、それでも運用はシンプルです。どちらも CI でエフェメラルなインスタンスに対して実行され、より高速なマネージドランナーがメトリクスパイプラインの統合テストを短縮します。

Decide with your own numbers, not a feature table

Feature comparisons age badly and rarely decide anything, because both tools in a mature category can do the job. What differs is how each behaves on your repository, and that takes one afternoon to measure.

Terminal
# time a cold install with each candidate, cache cleared
hyperfine --prepare "rm -rf node_modules" --warmup 1 \
  "<tool-a> install" "<tool-b> install"

# and the thing CI actually pays for: a cold run with no local cache
docker run --rm -v "$(pwd):/w" -w /w node:22 sh -c "<tool> install"

What actually changes when you switch

  • Lockfile format. A switch is a one-way door for anyone still on the old tool until everyone migrates, so plan it as a single coordinated change.
  • Resolution strictness. Tools differ on whether an undeclared transitive import works, and the stricter one will surface latent bugs as new failures.
  • CI cache configuration. The cache path and key differ per tool; carrying over the old ones silently disables caching.
  • Everyone on the team and every runner must move together. Pin the version so they cannot drift.

結論

きわめてシンプルな push 計装が欲しいなら StatsD。次元的なメトリクス、PromQL、組み込みのアラートが欲しいなら Prometheus。多くの場合、両方の利点を得るために exporter を介して StatsD を Prometheus にブリッジします。

よくある質問

StatsD vs Prometheus: Which Metrics Approach?
StatsD lets applications fire-and-forget counters and timers over UDP to a daemon that aggregates and forwards them, valuing simplicity over dimensionality. Prometheus scrapes labeled metrics and offers PromQL, alerting, and a large ecosystem.
Use case and model?
StatsD suits quick application instrumentation where apps push simple metrics without exposing a scrape endpoint. Prometheus suits dimensional monitoring with labels, powerful queries, and built-in alerting. A statsd_exporter can bridge StatsD metrics into Prometheus.
Ops and CI fit?
StatsD is trivially light; Prometheus is a fuller system but still simple to run. Both are exercised in CI against ephemeral instances, where faster managed runners shorten integration tests of metric pipelines.
Which should I choose?
Want dead-simple push instrumentation: StatsD. Want dimensional metrics, PromQL, and built-in alerting: Prometheus. Many bridge StatsD into Prometheus via the exporter for the best of both.

関連ガイド