OSS探訪GitHubでログイン

Counter・Gauge・HistogramをGo applicationへ組み込みPrometheusへ公開する公式client

スコアの見方

OSS規模スコアはStars・Watchers・Forks・Contributorsを対数圧縮して重み付けした現在の規模指標(上限なし)です。発掘スコアは現在のOSS規模スコアから発掘時点のOSS規模スコアを引いた値、更新ペースは直近30日Commit数、成長モメンタムは直近の観測期間におけるOSS規模スコア差、OSS健全度は取得できた更新状況・Community Health・Releaseの0〜100評価です。

Stars
6,037
主要言語
Go
ライセンス
Apache-2.0
リポジトリ最終更新
2026/10/05
ページ内ナビ

概要

prometheus/client_golangはGo application向けのPrometheus公式client libraryです。Counter、Gauge、Histogram、Summary、custom Collector等でmetricsをinstrumentし、promhttpでPrometheus scrape endpointを公開できます。別packageとしてPrometheus HTTP API clientも含みます。

特徴と向いている用途

公式資料に基づく紹介・実機未検証 · 内容確認日:

主な特徴

metric typeとCollectorを使ってapplication stateをinstrumentする

Counter、Gauge、Histogram、Summaryやcustom Collectorをregistryへ登録し、request数、latency、queue depth等のapplication metricsをPrometheus data modelとして公開できます。

出典:[2]

promhttpでscrape endpointを公開しPrometheus HTTP APIもqueryする

instrumentation libraryに加えHTTP handlerを提供し、Prometheus serverからscrapeできるendpointを構成できます。api/prometheus packageにはPrometheus HTTP APIをqueryするclientもあります。

出典:[2]

向いている用途

Go serviceのmetricsをPrometheus/OpenMetrics ecosystemへ統一したい場合に向く

API、worker、batch等のruntime metricsをPrometheusへ集約し、Grafana alert/dashboard等のobservability pipelineへ接続するGo backendに適します。

出典:[2]

導入前の確認

v1.24.1はGo 1.25。HTTP API clientなどexperimental surfaceはSemVerのbreaking保証対象外

v1.24.1のgo.modはGo 1.25を指定し、READMEは直近2 major Go releaseをsupport対象とします。HTTP API client等のexperimental APIはbreaking changeでもmajor bumpしない場合があります。1.24.1ではnil URL requestでpromhttpがpanicする不具合が修正されています。

出典:[3][2][4]

参考にした公式資料

  1. [1]prometheus/client_golang — GitHub repository(2026-10-06)
  2. [2]client_golang v1.24.1 — README(2026-10-06)
  3. [3]client_golang v1.24.1 — go.mod(2026-10-06)
  4. [4]client_golang v1.24.1 release(2026-10-06)
  5. [5]client_golang Apache-2.0 license(2026-10-06)
編集部からの補足

application metricsをPrometheus形式で公開する標準的なGo clientです。metric labelのcardinalityとcollector lifecycleは運用負荷へ直結するため、label値をboundedに保ち、registrationやHTTP handlerの構成をapplication起動時に固定すると安全です。

3ステップで試す

  1. 1

    ソースを取得

    git clone --depth 1 https://github.com/prometheus/client_golang.git
  2. 2

    リポジトリへ移動

    cd client_golang
  3. 3

    公式手順を確認

    READMEのInstallation / Quick Start / Getting Startedにある公式コマンドを続けて実行してください。

    find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
公式READMEで確認

成長

成長の推移 · 直近30日

6,037 Stars

推移データを蓄積中です。

開発アクティビティ

直近90日・週次

Commit(直近30日)
56
Open PR
55

開発アクティビティを蓄積中です。

Built with

カテゴリとタグ

GitHubデータ

GitHubのデータGitHubの詳細データを見る
Stars
6,037
Forks
1,325
Watchers
71
Open Issues
89
Contributors
250
所有者種別
Organization
主要言語
Go
ライセンス
Apache-2.0
リポジトリ最終更新
2026/10/05

このOSSの使い方や活用事例をMarkdownで投稿できます。管理者が承認した後に公開されます。

情報の誤りを報告

掲載内容に誤りや古い情報があればお知らせください。

このページを読んで、次に何をすればよいか分かりましたか?