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
Matthieu Guillermin
October 28, 2016
Programming
0
140
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
Cursor Meetup Tokyo ゲノミクスとCursor: 進化と制約のあいだ
koido
2
870
20250528 AWS Startupイベント登壇資料:AIコーディングの取り組み
procrustes5
0
150
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
360
機械学習って何? 5分で解説頑張ってみる
kuroneko2828
0
180
Blueskyのプラグインを作ってみた
hakkadaikon
1
400
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
230
RubyKaigi Hack Space in Tokyo & 函館最速 "予習" 会 / RubyKaigi Hack Space in Tokyo & The Fastest Briefing of RubyKaigi 2026 in Hakodate
moznion
1
130
💎 My RubyKaigi Effect in 2025: Top Ruby Companies 🌐
yasulab
PRO
1
130
FastMCPでMCPサーバー/クライアントを構築してみる
ttnyt8701
2
120
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
1
470
【TSkaigi 2025】これは型破り?型安全? 真実はいつもひとつ!(じゃないかもしれない)TypeScript クイズ〜〜〜〜!!!!!
kimitashoichi
1
300
Practical Tips and Tricks for Working with Compose Multiplatform Previews (mDevCamp 2025)
stewemetal
0
110
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
71
4.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Facilitating Awesome Meetings
lara
54
6.4k
The Power of CSS Pseudo Elements
geoffreycrofte
76
5.8k
Raft: Consensus for Rubyists
vanstee
138
7k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.2k
Stop Working from a Prison Cell
hatefulcrawdad
269
20k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.6k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Agile that works and the tools we love
rasmusluckow
329
21k
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