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
kohbis
May 10, 2025
Technology
300
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
340
Kubernetes環境周りの責任範囲をいい機会なので考える / Taking the Opportunity to Clarify Kubernetes Responsibilities
kohbis
2
410
『家族アルバム みてね』におけるAmazon EKSコストとの向き合い方 / Optimizing Amazon EKS Costs: The FamilyAlbum Case
kohbis
4
1.7k
潜在的課題探索活動の近況報告 / Exploration of latent challenges
kohbis
2
170
いま、あらためて考えてみるアカウント管理 with IaC / Account management with IaC
kohbis
3
1.1k
〜『世界中の家族のこころのインフラ』を目指して”次の10年”へ〜 SREが導いたグローバルサービスの信頼性向上戦略とその舞台裏 / Towards the Next Decade: Enhancing Global Service Reliability
kohbis
4
6.9k
Grafana MCP serverでなんかし隊 / Try Grafana MCP server
kohbis
0
1k
データベースで見る『家族アルバム みてね』の変遷 / The Evolution of Family Album Through the Lens of Databases
kohbis
5
1.6k
SREコミュニティイベントとわたし / Me and SRE community events
kohbis
2
320
Other Decks in Technology
See All in Technology
“ID沼入口” - 基本とセキュリティから始める、考え続けるためのID管理技術勉強会 告知&イントロ
ritou
0
350
アラート調査向けAIエージェントの本番導入とその後/AI Agents for Alert Investigation: Production Deployment and After
taddy_919
1
300
時期が悪い!それでもRaspberry Piを買って遊んで活用するには / 20260627-osc26do-rpi-jikigawarui
akkiesoft
1
950
AWS Summit Japan 2026の振り返りと2027へ向けて / AWS Summit Japan 2026 Recap and Prospects for 2027
kaminashi
1
160
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
310
きのこカンファレンス2026_肩書きを外したとき私は誰か
yamasatimi
1
110
NDIAS CTF 2026 問題解説会資料
bata_24
0
150
“詰む”前に仕組みを作れ 〜技術の波に溺れないためのキャッチアップ術〜
takasyou
8
4.8k
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
260
本当の”仕事”を手放せる未来が見えた
mu7889yoon
0
210
『AIに負けない』より『AIと遊ぶ』」〜ワクワクが最強のテスト・QA学習戦略_公開用
odan611
1
280
AWS PrivateLink × SCIM で実現する セキュアで運⽤負荷の低い Databricks 基盤の構築
tsuda7
0
120
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
220
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
55k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
The SEO identity crisis: Don't let AI make you average
varn
0
510
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
330
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
WENDY [Excerpt]
tessaabrams
11
38k
Mobile First: as difficult as doing things right
swwweet
225
10k
Docker and Python
trallard
47
3.9k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
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