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
Tests API
Search
Yoshiki Nakagawa
August 30, 2016
Programming
73
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Tests API
Yoshiki Nakagawa
August 30, 2016
More Decks by Yoshiki Nakagawa
See All by Yoshiki Nakagawa
Amazon Bedrock で作る未来の開発サイクルと オペレーション戦略 / AWS Summit Japan 2025
yyoshiki41
0
1.2k
MCP Documentation Server @AI Coding Meetup #1
yyoshiki41
2
4.1k
Go API クライアントの実装 〜Go Conference に載せれなかったTIPS〜
yyoshiki41
0
750
マルチテナントのアプリケーション実装 〜実践編〜
yyoshiki41
5
3k
Canary Deployments
yyoshiki41
0
580
go-gmail-drafts
yyoshiki41
0
800
Graceful Upgrade for Go App
yyoshiki41
0
140
Other Decks in Programming
See All in Programming
Vite+ Unified Toolchain for the Web
naokihaba
0
360
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1k
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
210
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
14
7.2k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
280
A2UI という光を覗いてみる
satohjohn
1
160
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
190
Oxcを導入して開発体験が向上した話
yug1224
4
340
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
190
OSもどきOS
arkw
0
590
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
610
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
220
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
240
Code Review Best Practice
trishagee
74
20k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Color Theory Basics | Prateek | Gurzu
gurzu
0
370
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
540
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
30 Presentation Tips
portentint
PRO
1
330
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
260
GitHub's CSS Performance
jonrohan
1033
470k
Transcript
Tests API Agora Tech Talk #5 Aug / 30 /
2016 @yyoshiki41 Yoshiki Nakagawa
Health Check API Runscope Blog Build a Health Check API
for Services Underneath Your API TL;DR • Create separate health check API endpoints for all services! • Set up notifications!
Health Check API How do we monitor them? • MySQL
• Redis • BIND • etc ... They don't come with (HTTP) RESTful APIs ! Communicate over lower-level protocols like TCP and UDP.
Good Example! ElasticSearch $ curl localhost:9200/_cluster/health { "cluster_name": "pairs-jp-es-cluster", "status":
"green", "timed_out": false, "number_of_nodes": 6, "number_of_data_nodes": 5, "active_primary_shards": 8, "active_shards": 32, "relocating_shards": 0, "initializing_shards": 0, "unassigned_shards": 0, "delayed_unassigned_shards": 0, "number_of_pending_tasks": 0, "number_of_in_flight_fetch": 0, "task_max_waiting_in_queue_millis": 0, "active_shards_percent_as_number": 100 }
Create Health Check API Endpoints! Check MySQL connection <?php $config
= [ "server" => "databaseserver:3306", "username" => "root", "password" => "password" ]; header('Content-type: application/json'); $link = new mysqli($config['server'],$config['username'],$config['password']); if ($link->connect_errno) { http_response_code(503); echo('{ "status": "Unable to connect" }'); } else { http_response_code(200); echo('{ "status": "Connection successful." }'); }
Caution Do not open to the public ! Access control
by ip address or authentication. nginx Advent Calendar 2015 Day21 nginx APIΤϯυϙΠϯτຖͷΞΫηε੍ޚ
Tests API Unit test $ go test -run TestHogehoge How
do we test API endpoints??
Runscope
Runscope • Monitor API perfomance • CI
Monitor API performance Set schedules for this test Demo
Ghost Inspector
Ghost Inspector Ghost InspectorΛࢼͯ͠Έ·ͨ͠ FYI (૿੮)·ͩࢹͰফͯ͠ΔͷʁϒϥβνΣοΫࣗಈԽͷ͢͢ Ί
Demo
Automate everything Commit => Unit Test => Deploy => API
Tests => !