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で分散型アプリケーション の処理フローを可視化する
Search
Hank Ehly
September 05, 2022
Technology
1.8k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
OpenTelemetryで分散型アプリケーション の処理フローを可視化する
Hank Ehly
September 05, 2022
More Decks by Hank Ehly
See All by Hank Ehly
Fivetranでデータ移動を自動化する
hankehly
0
670
Celeryの紹介と本番運用のTips
hankehly
0
1.7k
ChatGPTを活用した 便利ツールの紹介
hankehly
1
1.4k
Efficient Energy Analytics with Airflow, Spark, and MLFlow
hankehly
0
420
Deferrable Operators入門
hankehly
0
790
【初心者/ハンズオン】Dockerコンテナの基礎知識
hankehly
0
610
Compositeパターン: オブジェクトの階層関係をエレガントに表現する方法
hankehly
0
360
10/29 Airflowの基礎を学ぶハンズオンワークショップ
hankehly
0
330
システム/データ品質保証のための Airflow 活用法
hankehly
0
700
Other Decks in Technology
See All in Technology
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
240
Webとヘルスデータ
yukukotani
0
150
KAEN Company Deck
kaen
PRO
0
290
スクラムで身についていた動き方を、XPで捉え直してみた
codmoninc
1
160
#jawssonic2026 あの時代が悪かった ~動かなかったSageMakerと共に迎えたイベント当日~
ktkn1129
0
120
Kiro Crewしか勝たん!?
miu_crescent
PRO
0
160
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
130
AIエージェントの開発・提供におけるセキュリティリスクの論点と対策
flatt_security
1
490
Level Up Your CDK DX: 5 Tools I’ve Been Building
gotok365
2
180
はじめてのDatabricks:技術者向けワークショップ / beginner-workshop
databricksjapan
PRO
0
140
いま、生成AIにKaggleをどこまで 任せられるか — ROGIIコンペでの進め方とTips
k951286
2
1.3k
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
120
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
67k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Abbi's Birthday
coloredviolet
3
9.7k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
310
Are puppies a ranking factor?
jonoalderson
2
3.9k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Designing Powerful Visuals for Engaging Learning
tmiket
1
530
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Transcript
OpenTelemetryで分散型アプリケーション の処理フローを可視化する
• Hank Ehly (ハンク イーリー) • ENECHANGE株式会社 • qiita.com/hankehly •
github.com/hankehly • connpass.com/user/hankehly • New: Meety (カジュアル面談) 自己紹介
アジェンダ 1. オブザーバビリティとは 2. OpenTelemetryとは 3. トレースとは 4. Pythonアプリケーションの導入例
• 内部構造を知らなくても、外側から動き方が理解できる • 出会ったことがない問題でも、原因特定が容易にできる オブザーバビリティとは アプリケーションは、シグナルを出す必要がある 1. トレース 2. メトリクス
3. ログ これをインストルメンテーション と言います。 WHY IS THIS HAPPENING? エラー I see..
オブザーバビリティとは • 分散型アプリケーション(Lambda、Kubernetes、ECS、RDS…) • より速く、独立した形でアプリケーションを構築/リリース • 規模が大きくなると、処理の流れやサービスの関係の確認が難しくなる • デプロイ後のトラブル・緊急時に、スピードと情報の正確性が非常に重要 PostgreSQL
:5432 Ruby on Rails :3000 Nginx :8000 Airflow :8080 /mnt/data (ストレージ) 1インスタンスに全部 PostgreSQL Airflow Ruby on Rails /Nginx ストレージ 独立している
OpenTelemetryとは • アプリケーションコードをインスツルメンテーションする仕組みです。 • ベンダーに依存しない、標準化されたツールを提供する ◦ SDK(Python、Ruby、JavaScript、Go、Java、等々…) ◦ API(ルール定義) ◦
テレメトリーデータを受信、処理、出力するための「 Collector」バイナリー
OpenTelemetryとは ECS Cluster Lambda 1 分散型アプリケーション Lambda 2 DynamoDB
OpenTelemetryとは Collector ECS Cluster Lambda 1 分散型アプリケーション Lambda 2 収集/転送
DynamoDB
X-Ray OpenTelemetryとは Collector Datadog Prometheus Jaeger ECS Cluster Lambda 1
分散型アプリケーション Lambda 2 可視化/保存 収集/転送 DynamoDB
フォーム送信(ブラウザー) 時間 トレースとは POST /api/tasks GET /firebase/auth Task.objects.create (Python) INSERT
INTO tasks … (SQL) • 何が、どの順番で行われ、どのくらい時間かかったかが分かる • ボタン押下、HTTPリクエスト、Python関数実行、DBからレコード取得…
{ "name": "Example Trace", "context": { "trace_id": "0x5b8aa5a2d2c872e8321cf37308d69df2", "span_id": "0x5fb397be34d26b51",
}, "start_time": "2022-04-29T18:52:58.114304Z", "end_time": "2022-04-29T18:52:58.114435Z", "events": [ { "name": "フォーム送信(ブラウザー)", "timestamp": "2022-04-29T18:52:58.114561Z" }, { "name": "POST /api/tasks", "timestamp": "2022-04-29T18:53:00.012345Z" }, { "name": "GET /firebase/auth", "timestamp": "2022-04-29T18:53:01.012345Z" } ... 処理フロー
ウェブリクエスト 非同期的ジョブ実行 S3バケット一覧取得
実装は大変そう…
Auto Instrumentation (自動インストルメンテーション)
import os import sys def main(): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instrumentation_example.settings") try: from
django.core.management import execute_from_command_line except ImportError as exc: ...
import os import sys +from opentelemetry.instrumentation.django import DjangoInstrumentor def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instrumentation_example.settings") + DjangoInstrumentor().instrument() try: from django.core.management import execute_from_command_line except ImportError as exc: ... 自動インストルメンテーション (モンキーパッチ)
import os import sys +from opentelemetry.instrumentation.django import DjangoInstrumentor +from opentelemetry.instrumentation.botocore
import BotocoreInstrumentor def main(): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instrumentation_example.settings") + DjangoInstrumentor().instrument() + BotocoreInstrumentor().instrument() try: from django.core.management import execute_from_command_line except ImportError as exc: ...
import os import sys +from opentelemetry.instrumentation.django import DjangoInstrumentor +from opentelemetry.instrumentation.botocore
import BotocoreInstrumentor +from opentelemetry.instrumentation.redis import RedisInstrumentor def main(): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instrumentation_example.settings") + DjangoInstrumentor().instrument() + BotocoreInstrumentor().instrument() + RedisInstrumentor().instrument() try: from django.core.management import execute_from_command_line except ImportError as exc: ...
コンテキストのプロパゲーション trace_id=123 trace_id=123 trace_id=123 trace_id=123
ご清聴ありがとうございます! Jaeger OpenTelemetry X-Ray ADOT AWS Cloud Trace GCP OSS