Share
Embed
Transcript
23 slides
-
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. まとめ -
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: -
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 コネクションのオープン数。 メトリクスの一例 -
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 server側の設定 Node collector server postgres app: nodejs- server /metrics
previewFeaturesにメトリクスを追加 スリープするSQLを実行 /metricsエンドポイントにメトリクスを公開 コネクションプール5、プール数を超過したリクエストのタイムアウトを5に設定