Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Custom Prometheus Exporterによる オブザーバビリティ拡張 / Ext...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kohbis
May 10, 2025
Technology
310
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Custom Prometheus Exporterによる オブザーバビリティ拡張 / Extending observability with Custom Prometheus Exporter
大LT 2025 春 in Aizu
https://zli.connpass.com/event/351157/
kohbis
May 10, 2025
More Decks by kohbis
See All by kohbis
『家族アルバム みてね』における インシデント対応との向き合い方 / Approach incident response in Family Album
kohbis
2
420
Kubernetes環境周りの責任範囲をいい機会なので考える / Taking the Opportunity to Clarify Kubernetes Responsibilities
kohbis
2
450
『家族アルバム みてね』におけるAmazon EKSコストとの向き合い方 / Optimizing Amazon EKS Costs: The FamilyAlbum Case
kohbis
4
1.8k
潜在的課題探索活動の近況報告 / Exploration of latent challenges
kohbis
2
190
いま、あらためて考えてみるアカウント管理 with IaC / Account management with IaC
kohbis
3
1.2k
〜『世界中の家族のこころのインフラ』を目指して”次の10年”へ〜 SREが導いたグローバルサービスの信頼性向上戦略とその舞台裏 / Towards the Next Decade: Enhancing Global Service Reliability
kohbis
4
7.5k
Grafana MCP serverでなんかし隊 / Try Grafana MCP server
kohbis
0
1.1k
データベースで見る『家族アルバム みてね』の変遷 / The Evolution of Family Album Through the Lens of Databases
kohbis
5
1.6k
SREコミュニティイベントとわたし / Me and SRE community events
kohbis
2
330
Other Decks in Technology
See All in Technology
全員がプロダクトへ向き合う組織を持続成長させるために——組織づくりのフライホイールと4象限 / The Flywheel Model and Four Quadrants for Organizational Design
hiro_torii
1
350
本番に近いテストをもっと手軽に - Postmanで広がるAPIテストの世界 / Expanding the World of API Testing with Postman
yokawasa
1
220
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
いま好きなこと 最初はそんなに好きじゃなかった #tamagawadev
nishiuma
1
220
AIで実装は速くなった。なのにプロダクトは速くならない。職能の壁を越えて価値のフローを設計する
nwiizo
3
4.4k
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
110
『自分で判断できるか』を基準に、プロダクトのハンズオン研修でAI利用の線を引いてみた / Where We Drew the Line on AI in Hands-on Training
honyanya
1
830
AIエージェントを雇う前に決める5つのこと
knishioka
1
140
多摩川(.dev)ランニング入門 / Tamagawa.dev#3
fujiwara3
3
260
Point Cloud as a Foreign Language for Multi-modal Large Language Model
takmin
0
360
[DroidKaigi 2026] Making UI specifications visible: Android UI development in the AI agent era supported by Compose Screenshot Testing and galleries
syarihu
0
470
Claude Codeで開発以外の業務も爆速化しよう!
minorun365
PRO
12
9.5k
Featured
See All Featured
Balancing Empowerment & Direction
lara
6
1.3k
Chasing Engaging Ingredients in Design
codingconduct
0
290
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
510
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
850
The SEO identity crisis: Don't let AI make you average
varn
0
550
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.6k
Technical Leadership for Architectural Decision Making
baasie
3
550
A designer walks into a library…
pauljervisheath
211
24k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
590
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Transcript
©MIXI Custom Prometheus Exporterによる オブザーバビリティ拡張 2025/05/10 大LT 2025 春 in
Aizu 株式会社MIXI みてね事業本部 みてねプラットフォーム部 SREグループ 杉本浩平
©MIXI 2 お話しすること • “オブザーバビリティ ” • Prometheus • Prometheus
Exporter • Custom Prometheus Exporterの実装
©MIXI 3 “オブザーバビリティ ” システムの出力を調査することによって内部の状態を測定する能力のこと ※1 4つの主要なデータタイプ( MELT) Metrics •
システムのパフォーマンスやリソース使用状況を定量的に示す数値データ Events • システム内で発生した特定の事象や状態変化を記録するデータ Logs • システムやアプリケーションの動作に関する詳細なテキスト記録 Traces • 分散システムにおけるリクエストの流れを追跡し、各サービス間のやり取りや処理時間を可視化するデー タ ※1 https://www.splunk.com/ja_jp/blog/devops/observability.html
©MIXI 4 Prometheus Prometheus collects and stores its metrics as
time series data. メトリクスを時系列データとして収集&保存する ※1 主なコンポーネント Prometheus Server • ターゲットからMetricsを収集して保存(他いろいろ) Service Discovery • ターゲットを自動的に検出 Exporter • システムやアプリケーションのMetricsをPrometheus Serverが収集できる形式で提供 Pushgateway • ライフサイクルが短いジョブからMetricsをプッシュ Alertmanager • Prometheus Serverから送信されるアラートを処理 ※1より引用 ※1 https://prometheus.io/docs/introduction/overview
©MIXI 5 Prometheus Exporter • いわゆる監視エージェントの役割 • 特定のシステムやアプリケーションをターゲットとし、メトリクスを収集し、 HTTPエンドポイントで公開 •
公式ドキュメントに記載されているだけでも200ほど • DBやクラウドサービスなど、あらゆるシステムやサービスに対応したPrometheus公式またはサードパーティ製 どのようなときに欲しくなる? 1. 利用しているソフトウェアがPrometheus形式のメトリクスを提供していない (例)MySQL server exporter, Redis exporter, 2. ホストマシンのシステムメトリクスを取得したい (例)Node/system metrics exporter, Windows exporter 3. ネットワーク機器や外部サービスを監視したい (例)SNMP exporter, Blackbox exporter 4. 独自アプリケーションやサービスを監視したい (例)クライアントライブラリで Expoterを自作 https://prometheus.io/docs/instrumenting/clientlibs/
©MIXI 6 Prometheusのメトリクス形式 1行目:# HELP メトリクスの説明文 2行目:# TYPE メトリクスの種類 3行目:メトリクス
この例では「HTTPメソッド x レスポンスコードごとのリクエスト数の変化を時系列的に追跡する」 ことが可能になる Prometheusのメトリクス形式でレスポンスを返却するエンドポイントを公開さえできれば ありとあらゆるシステムやアプリケーションの可視化や分析が可能になる
©MIXI 7 Custom Prometheus ExporterのRuby実装例(without client library) Prometheusのメトリクス形式の出力であればいい ので シンプルな実装でカスタムメトリクスを公開可能
1. メトリクスデータを Hash.new で初期化 2. ダミーデータを作成 • metrics += 1 で定期的に加算 3. webrickサーバーを起動 4. /metrics へのリクエストに、Prometheusのメトリクス形式のテ キストをレスポンス • # HELP を追加 • # TYPE を追加 • Hashのkey/valueを追加 ⬆ メトリクスの種類が増えただけ対応する必要がある
©MIXI 8 Custom Prometheus ExporterのRuby実装例(with client library) クライアントライブラリを使用すると簡単に作成可能 公式にはGo /
Java or Scala / Python / Ruby / Rustをサポート 1. Rubyのclientライブラリを使用 https://github.com/prometheus/client_ruby 2. レジストリを作成して、メトリクスを管理(in-memory) Counterメトリクスを定義 • GaugeやHistogramなどタイプがある https://prometheus.io/docs/concepts/metric_types 3. レジストリにCounterメトリクスを登録 4. ダミーデータを作成 • counter.increment で定期的に加算 5. webrickサーバーを起動 6. /metrics へのリクエストに、Prometheusのメトリクス形式のテ キストをレスポンス • クライアントライブラリが組み立ててくれる
©MIXI 9 業務で見ているもの(一部)
©MIXI “オブザーバビリティ ”に 思いを馳せてみるのもよいかも?
©MIXI