Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Google Cloud Managed Service for Prometheusでpr...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kojake_300
February 29, 2024
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Google Cloud Managed Service for Prometheusでprismaメトリクスを可視化してみた
kojake_300
February 29, 2024
More Decks by kojake_300
See All by kojake_300
actでGithub ActionsのVibe Codingを加速させる
kojake_300
0
210
SRE支援から見えてきたSREの核
kojake_300
3
770
OpenClarityの裏側を知りたい
kojake_300
0
440
OpenClarityを覗いてみる
kojake_300
0
380
【SRE-NEXT 2024】内製化を見据えた効果的なSRE支援のアプローチ / SRE support approach
kojake_300
3
4.1k
eBPFで計装はノーコードの時代へ Grafana Beylaの出来るコト出来ないコト
kojake_300
0
1.7k
オシャレな図を書くために意識していること
kojake_300
0
200
Skaffoldを用いたGKEアプリケーションの CD(Continuous Development)
kojake_300
0
5.2k
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
The Curious Case for Waylosing
cassininazir
1
510
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Are puppies a ranking factor?
jonoalderson
2
3.9k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
730
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Thoughts on Productivity
jonyablonski
76
5.4k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
430
Transcript
Google Cloud Managed Service for Prometheusで Prismaメトリクスを可視化してみた Copyright © 3-shake,
Inc. All Rights Reserved. 2024/02/26 Jagu'e'r O11y-SRE分科会
Agenda 1. 会社/自己紹介 2. Google Cloud Managed Service for Prometheusとは?
3. Prismaとは? 4. 検証 5. まとめ
会社/自己紹介 01 Copyright © 3-shake, Inc. All Rights Reserved.
About 3-shake
Sreake SRE(SRE総合支援サービス) 技術戦略から設計、構築、運用までワンストップ支援する 技術支援サービス 技術戦略 コンサルティング システム 設計 構築 /
実装 支援 アセスメント (パフォーマンス / セキュリティ) 運用支援 Micro Service , Multi Cloud や k8sをはじめとしたCloud Native な先進的技術及び大規模なサービス 運用に強みを持つエンジニアによる技術支援 ベンダー的な役割ではなく「お客様の チームメンバー」という立ち位置で最新技術の提案から運用支援ま でをトータルご支援
Google Cloud Managed Service for Prometheusとは? 02 Copyright © 3-shake,
Inc. All Rights Reserved.
Google Cloud Managed Service for Prometheus(以下GMP)は、Prometheusのマネージドサービス。 Cloud Monitoringと統合されており、Cloud Monitoring上でメトリクスを表示することが可能。 さらに、PromQLにも対応。
Google Cloud Managed Service for Prometheusとは? https://cloud.google.com/stackdriver/docs/managed-prometheus?hl=ja#gmp-system-overview
マネージドコレクションを有効にすることでデプロイされるdaemonsetでメトリクスを収集しGMPに exportする。 ユーザはメトリクス収集対象のpodを定義したPodMonitoringカスタムリソースをデプロイするだけ で良いので比較的簡単な設定。 以下のクラスタに対してデフォルトで有効。 • 1.25以降のGKE Autopilotクラスタ • 1.27以降のGKE
Standardクラスタ ① マネージドコレクション Node Node Node collector collector collector PodMonioring GMP https://cloud.google.com/stackdriver/docs/managed-prometheus/setup-managed?hl=ja#enable-mgdcoll-gke selector: matchLabels: app: test endpoints: - port: 8000 interval: 10s pod pod pod app: hoge app: test app: hoge
GMPに対応しているPrometheusをGKEにデプロイし、GMPにメトリクスをエクスポート。 Prometheus Operatorにも対応しており、既にPrometheusを運用しているクラスタでの移行手段の一つ になる。 ② セルフデプロイコレクション Node Node Node Promethe
us PodMonior GMP selector: matchLabels: app: test endpoints: - port: 8000 interval: 10s hoge-pod pod pod app: hoge app: test app: foo scrape_configs: - metrics_path: '/metrics' static_configs: - targets: ['hoge-pod:8000]
Opentelemetry Collectorでは、標準でexport先にGMPを指定出来る。 ③ Opentelemetry Collector Node Node Node Otel Collector
GMP hoge-pod pod pod app: hoge app: test app: foo receivers: prometheus: config: scrape_configs: - targets: ['hoge-pod:8000] exporters: googlemanagedprometheus:
その他の設定 他にも色々あるので興味あれば https://cloud.google.com/stackdriver/docs/managed-prometheus/setup-otel?hl=ja#env-setup
Prismaとは? 03 Copyright © 3-shake, Inc. All Rights Reserved.
TypeScript用の次世代のORマッパー。 Prismaとは? https://www.prisma.io/typescript drizzle-orm typeorm sequelize prisma 36.2k 32.9k 28.9k
17.3k TypeScript ORM スター数 (登壇時点)
プレビューだがメトリクス収集設定がある。 Prismaでのメトリクス収集 https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/metrics メトリクス名 概要 prisma_client_queries_active 現在アクティブなPrismaクライアントのクエリ数。 prisma_client_queries_wait 全てのコネクションが使用中の場合、接続を待機しているPrismaクライアント数。 prisma_pool_connections_busy
現在ビジー状態のコネクション数。 prisma_pool_connections_idle 現在使用されていないプール接続の数。 prisma_pool_connections_open コネクションのオープン数。 メトリクスの一例
検証 04 Copyright © 3-shake, Inc. All Rights Reserved.
GMPのマネージドコネクションを使用し、PrismaメトリクスをCloudMonitoringで可視化する。 環境 Node Node Node collector collector collector PodMonioring GMP
selector: matchLabels: app: nodejs-server endpoints: - port: 3000 interval: 10s client server postgres app: nodejs- server /metrics
メトリクス収集の設定 Node collector PodMonioring クラスタの設定でGMPを有効にする PodMonitoringリソースをapply
Node server側の設定 Node collector server postgres app: nodejs- server /metrics
previewFeaturesにメトリクスを追加 スリープするSQLを実行 /metricsエンドポイントにメトリクスを公開 コネクションプール5、プール数を超過したリクエストのタイムアウトを5に設定
CloudMonitoring PromQL実行結果 ビジーなコネクション数を可視化することが出来た!
GMPの活用 ❏ マネージドコレクションは簡単に導入でき、Cloud Monitoring経由で参照できるため気軽にアプリ ケーションメトリクス収集が可能になった。 ❏ O11yにおいてはいかに色々なテレメトリを収集出来ているかが鍵。アプリログだけではエラーの 真因に辿りつかないケースも多々あるため、まずは収集してみる。 ❏ 特にコネクション数はdebugモードにしないとログに出ないことが多く、障害調査に時間がかかっ
てしまう。可視化できていると一発で原因がわかるかも?
まとめ 05 Copyright © 3-shake, Inc. All Rights Reserved.
❏ GMPのマネージドコレクションは導入が簡単。 ❏ Prometheusの運用が不要で、Cloud Monitoringから参照出来る。 ❏ まずは気軽にメトリクス収集を。 まとめ
ご清聴ありがとうございました