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
La métrologie dans les applications Scala
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Matthieu Guillermin
October 28, 2016
Programming
150
0
Share
La métrologie dans les applications Scala
Talk Scala.IO 2016
Matthieu Guillermin
October 28, 2016
Other Decks in Programming
See All in Programming
AIとRubyの静的型付け
ukin0k0
0
530
Moments When Things Go Wrong
aurimas
3
140
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
470
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
710
Claspは野良GASの夢をみるか
takter00
0
160
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
450
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
530
エージェンティックRAGにAWSで入門しよう!
har1101
5
130
net-httpのHTTP/2対応について
naruse
0
430
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
430
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
220
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
220
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
210
Designing for Performance
lara
611
70k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
160
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Tell your own story through comics
letsgokoyo
1
940
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
260
Paper Plane (Part 1)
katiecoart
PRO
0
8.4k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
380
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