Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHPでもTraceがしたい!! / Introduction of OpenCensus f...
Search
castaneai
June 27, 2019
Programming
0
1.9k
PHPでもTraceがしたい!! / Introduction of OpenCensus for PHP
OpenCensus/OpenTelemetry meetup vol.2 での発表資料です
https://opencensus.connpass.com/event/132588/
castaneai
June 27, 2019
Tweet
Share
More Decks by castaneai
See All by castaneai
Cloud Gaming Platform with Go
castaneai
2
2.9k
自己紹介と、環境と、Scrapboxのすすめ / engineer_ekaki self-introduction
castaneai
1
2k
お絵かきとScrapbox / Painting and Scrapbox
castaneai
0
810
Other Decks in Programming
See All in Programming
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
110
2025 컴포즈 마법사
jisungbin
0
160
FluorTracer / RayTracingCamp11
kugimasa
0
110
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
710
jakarta-security-jjug-ccc-2025-fall
tnagao7
0
100
Rails Girls Sapporo 2ndの裏側―準備の日々から見えた、私が得たもの / SAPPORO ENGINEER BASE #11
lemonade_37
2
200
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
300
ZOZOにおけるAI活用の現在 ~モバイルアプリ開発でのAI活用状況と事例~
zozotech
PRO
7
3k
connect-python: convenient protobuf RPC for Python
anuraaga
0
320
エディターってAIで操作できるんだぜ
kis9a
0
240
CSC305 Lecture 14
javiergs
PRO
0
330
なぜ強調表示できず ** が表示されるのか — Perlで始まったMarkdownの歴史と日本語文書における課題
kwahiro
12
7.5k
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
140
7.2k
Navigating Team Friction
lara
190
16k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
680
Documentation Writing (for coders)
carmenintech
76
5.2k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Context Engineering - Making Every Token Count
addyosmani
9
440
Transcript
PHPでも Traceがしたい! OpenTelemetry meetup vol.2
@castaneai GitHub castaneai Twitter castanea • OpenCensus for PHP Contributor
• ゲームのサーバーやさん • GCPの同人誌などを書いてます
突然ですが アンケート
PHPをメインで 使っている人?
None
None
PHPにもある! OpenCensus Instrumentation
census-instrumentation/opencensus-php
使い方
[1] Install opencensus package $ composer require opencensus/opencensus:~0.2
[2] Create Exporter $exporter = new StackdriverExporter();
[3] Start Tracing $exporter = new StackdriverExporter(); Tracer::start($exporter);
[4] Create Span $exporter = new StackdriverExporter(); Tracer::start($exporter); Tracer::inSpan(['name' =>
'test-span'], function () { sleep(1); echo 'hello'; });
[5] Done!!
OpenCensus for PHP のさらにすごい ところ
PHPインタプリタに 直接踏み込む Tracing
OpenCensus PHP Extension
[1] Install opencensus extension $ pecl install opencensus-alpha
[2] Enable the extension in php.ini extension=opencensus.so
[3] Watching for function invocation $exporter = new StackdriverExporter(); Tracer::start($exporter);
sleep(1); echo 'hello'; opencensus_trace_function('sleep');
[4] Done!!
ライブラリ内の関数でも built-in関数でも 直接手を加えずに Traceできる
よく使いそうなライブラリは Integration あり • curl (Guzzle) • gRPC • PDO
(Database driver) • Laravel • Wordpress • etc...
None
(Alpha) ... productionで使えないのでは…?
ライブラリのチューニングに役立った!
うおおお!! OpenCensus for PHP!! すごい!今すぐ試し たい!
でもPHPの 環境構築 面倒くさい… nginx?? fpm??
castaneai/php-opencensus-example docker-compose で すぐに試せるセット 作りました!!!
OpenCensus for PHP 最近の動向
OpenCensus Stats
OC Agent 対応も