Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
La métrologie dans les applications Scala
Search
Matthieu Guillermin
October 28, 2016
Programming
0
150
La métrologie dans les applications Scala
Talk Scala.IO 2016
Matthieu Guillermin
October 28, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
140
Patterns of Patterns
denyspoltorak
0
330
Cell-Based Architecture
larchanjo
0
140
Cap'n Webについて
yusukebe
0
150
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
900
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
120
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
450
Java 25, Nuevas características
czelabueno
0
110
これならできる!個人開発のすゝめ
tinykitten
PRO
0
130
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
160
認証・認可の基本を学ぼう後編
kouyuume
0
250
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
440
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.9k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
30
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
0
94
WCS-LA-2024
lcolladotor
0
390
Building Applications with DynamoDB
mza
96
6.8k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
The Language of Interfaces
destraynor
162
25k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
310
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Transcript
La métrologie dans les applications Scala Matthieu Guillermin Scala.IO 2016
Matthieu Guillermin Lead Dev Brainify - Analytics e-commerce
Est-ce que mon service fonctionne ? Est-ce que les temps
de réponse sont corrects ? Est-ce que mon service renvoie des erreurs 500 ? Il y a beaucoup d'erreurs, qu'est-ce qui cloche ? « Ça fait 1 heure que l'appli ne fonctionne plus, qu'est-ce qu'il se passe ? »
Logs • Disponible dans toutes les applications • Très détaillé
• Difficile à exploiter • Difficile d'avoir une vision synthétique
Métriques • Valeurs numériques • Facile à stocker • Facile
à exploiter • Affichage • Triggers / Alertes
Statsd / Graphite Cabot Service A Kamon Service B Kamon
Service C Kamon Grafana system C* ES Kafka Kong
Enregistrement des métriques
Kamon • JVM / Scala • Reactive-friendly • Modulaire •
http://kamon.io
Kamon - Metrics • Flush interval • Instruments • Counter
• Histogram • ...
// Counter val authCounter = Kamon.metrics.counter("auth") def auth(username: String, password:
String) = { authCounter.increment() // ... } // Histogram val docSizeHistogram = Kamon.metrics.histogram("doc-size") def storeDocument(doc: Document) = { docSizeHistogram.record(doc.size) // ... }
Kamon - Trace • Enregistrement du "temps passé" • Granularité
: Traces / Segments
def userCreate(user: User) = { val context = Kamon.tracer.newContext("userCreate") //
... validateUser(user) // ... context.finish() } def validateUser(user: User) = { val segment = Tracer.currentContext.startSegment("validateUser", "myCategory", "myLib") // ... segment.finish() }
def userCreate(user: User) = { Tracer.withNewContext("userCreate", autoFinish = true) {
validateUser(user) // ... } } def validateUser(user: User) = { Tracer.currentContext.withNewSegment("validateUser", "cat", "lib") { // ... } }
def notifyUser(user: User) = { Tracer.currentContext.withNewAsyncSegment("notifyUser", "cat", "lib") { sendEmail(user.email)
// sendEmail() is returning a Future } }
Kamon - Intégrations • JVM : • Heap, GC, ...
• Akka : Metrics sur Actor, Router, Dispatcher • Ex : time-in-mailbox, processing-time, errors,... • Play : Metrics sur requêtes HTTP • Ex : requêtes entrantes, WSClient,...
class User @Inject()(val userService: UserService) extends Controller { def create(username:
String, password: String) = TraceName("user-create") { Action.async { userService.create(username, password) .map(user => Ok(Json.toJson(user))) } } }
kamon { statsd { hostname = my.statsd.server flush-interval = 1
minute simple-metric-key-generator { application = "my-service" } } metric { tick-interval = 1 minute filters { akka-actor { includes = ["application/user/**"] # excludes = [] } } } system-metrics { sigar-enabled = false jmx-enabled = true } }
Visualisation des métriques
Grafana • Visualisation des métriques • Dashboards • Templating /
annotations • http://grafana.org/
None
None
None
Alerting
Alerting • Etre alerté d'un incident - hits / last
2 minutes = 0 - 2xx_status = 0
Alerting • Prévenir un incident - heap_usage > 90% -
disk_free < 10% - response_time > 200ms
Cabot • Services / Checks • ICMP / HTTP /
Graphite • Notifications • Slack • Twilio (SMS / Phone) http://cabotapp.com/
None
None
None
None
Conclusion • Mettre en place de la métrologie • Investissement
qui en vaut la peine • Simple • Dev + Ops • Processus itératif