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
opentelemetry-goとGCPでパフォーマンス解析
Search
Yohei Iino
July 26, 2022
Technology
0
76
opentelemetry-goとGCPでパフォーマンス解析
opentelemetry-goとGCPでパフォーマンス解析
Yohei Iino
July 26, 2022
Tweet
Share
More Decks by Yohei Iino
See All by Yohei Iino
T3 Stack(応用編: Next Auth & SSRの実装紹介)
wheatandcat
1
22
App Routerの紹介
wheatandcat
0
13
Flutter × GraphQLでアプリを作ってみる
wheatandcat
0
28
T3 Stack + Supabaseでアプリを作ってみる
wheatandcat
0
71
Supabaseの紹介
wheatandcat
0
74
tRPCの紹介
wheatandcat
0
62
Plasmoの紹介
wheatandcat
0
47
Playwrightの紹介
wheatandcat
0
110
Vitestの紹介
wheatandcat
1
81
Other Decks in Technology
See All in Technology
Evolutionary Optimization of Model Merging Recipes
fuyu_quant0
3
530
AWS アーキテクチャクイズ
yuu26
2
700
マイクロサービス環境におけるDB戦略 in DMMプラットフォーム
pospome
11
3k
ビジネスとコード品質の接合点 そしてコード品質がそこに及ぼす影響 / The Intersections of Business and Engineering, and The Impact of Code Quality There
mtx2s
10
1k
MongoDB Atlas Vectorsearchではじめる生成AIアプリ開発
chie8842
3
510
HoneycombとOpenTelemetryでオブザーバビリティに入門してみる
sumiren
2
160
イチから学ぶdbt / Learn dbt from scratch
shinyaa31
0
120
KTC_DBRE.pdf
_awache
0
290
技術イベントはなんとかひねり出す 日経の技術広報の取り組み/techpr3
nishiuma
0
230
家族アルバム みてねで直面してきた技術的負債 / MIXI KAG 2024
isaoshimizu
17
7.7k
社内共通ルールを値オブジェクトにして社内ライブラリとして運用してみた話
leveragestech
2
1.2k
依存ライブラリはどこに?
takesection
0
110
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
160
13k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
18
1.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
10
4.5k
Making Projects Easy
brettharned
106
5.4k
Debugging Ruby Performance
tmm1
68
11k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
319
20k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
226
16k
Side Projects
sachag
451
41k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.3k
Fantastic passwords and where to find them - at NoRuKo
philnash
35
2.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
343
19k
Web development in the modern age
philhawksworth
201
10k
Transcript
opentelemetry-go とGCP でパフォーマンス解析 Press Space for next page
自己紹介 📝 飯野陽平(wheatandcat ) 🏢 フリーランスエンジニア(シェアフル株式会社CTO ) 💻 Blog: https://www.wheatandcat.me/
🛠 今までに作ったもの memoir ペペロミア Atomic Design Check List
OpenTelemetry とは OpenTelemetry は、オープンソースのオブザーバビリティフレームワーク 運用しているアプリのパフォーマンスや健全性が正常な状態か判断するために使用する情報をテレメトリーデータ と呼ばれている テレメトリーデータは主に3 つのカテゴリに分類される ログ メトリクス
トレース OpenTelemetry は、それらのテレメトリデータを収集するためのベンダーに依存しないAPI 、ソフトウェア開発キッ ト(SDK) 、その他のツールを提供している Learn More 1 Learn More 2
opentelemetry-go リポジトリ: opentelemetry-go OpenTelemetry は、OpenCensus (+ Stackdriver )、OpenTracing のプロジェクトの正式な後継版 検索時に以下のリポジトリで実装されたものもヒットするが、これから実装するならopentelemetry-go
が推奨なの で注意 opencensus-go opentracing-go
対応のパッケージのサンプル OpenTelemetry のGitHub に言語ごとにリポジトリが作成されている https://github.com/open-telemetry?q=go&type=all&language=&sort= Go 言語なら以下を確認 opentelemetry-go-contrib Go のフレームワークなら以下を確認
https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation/github.com
実装してみた① 実際にプロジェクトにopentelemetry-go を実装したみた。 構成は以下の通り プロジェクト: memoir-backend フレームワーク: gqlgen ベンダー: Cloud
Trace 最初はDatadog のAPM を想定していたが、Cloud Run For Manager をサポートしていなかったので😓、 Cloud Trace で実装
実装してみた② PR https://github.com/wheatandcat/memoir-backend/pull/128 以下を解説 gqlgen のトレースのハンドリングの解説 Cloud Trace の出力のデモ
Cloud Trace を実装してみての感想と課題 トレース情報が可視化されて、各 API の処理速度を直感的にわかるようになった 今回のプロジェクトはAPI の数も少ないのでトレース情報のみでも十分に解析可能だが、以下のようなケースでは別 のアプローチを考える必要がある トレース情報が大雑把すぎる。具体的に遅い処理を検知したい
API や処理数が膨大で漠然と全体的に遅い ユーザーによって処理が遅い 上記のケースではCloud Profiler が有効なので紹介
Cloud Profiler とは Cloud Profiler は、本番環境のアプリケーションからCPU 使用率やメモリ割り当てなどの情報を継続的に収集できる サービス トレースのような大雑把な情報は出力できないが、ピンポイントにボトルネックになっている処理の検知が行える 料金は無料なので、取り敢えず実装しておいても損は無さそう
Learn More
実装してみた 以下を参考に実装 https://cloud.google.com/profiler/docs/profiling-go?hl=ja 以下を解説 Cloud Profiler のデモ memoir-backend は処理がシンプル過ぎて、解説向きの情報が無いので以下で解説 以下を参考に実際の利用方法の解説
チュートリアル: Go アプリの最適化
おまけ 今回、実装までは行わなかったが、今回紹介したCloud Trace とCloud Profiler などの情報をまとめて、Cloud Monitoring でアラートもできそう https://cloud.google.com/architecture/integrating-monitoring-logging-trace-observability-and-alerting? hl=ja
Cloud Monitoring の説明は以下を参照 https://cloud.google.com/monitoring/monitor-compute-engine-virtual-machine
まとめ OpenTelemetry は現状デファクトなので、理解しておいたほうが良さそう パフォーマンス解析のアプローチについて理解できた 早くDatadog のAPM がCloud Run For Manager
をサポートして欲しい GKE 構成にすれば使えるけど、個人プロジェクトで、そこまで管理コストをかけたくない 😓
ご清聴ありがとうございました