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
130
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
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
2
81k
コード生成を伴うLLMエージェント - 2024.07.18 Tokyo AI
smiyawaki0820
11
4.1k
Microservices rules (July 2024) : what good looks like
cer
PRO
0
1.6k
しくじり先生 Image Matching Challenge 2024 編
goosehaaan
0
810
AWS CDKにおける「再利用性」を考える / aws-cdk-reusability
gotok365
6
1.3k
スクラムマスターって孤独じゃないですか?
yoshitaroyoyo
1
140
유연한 Composable 설계
l2hyunwoo
0
380
HMSコンペ 11th Solution (team : kansai-kaggler)
t88
1
680
CSC307 Lecture 09
javiergs
PRO
1
500
Javaの現状2024夏 / Java current status 2024 summer
kishida
4
1.4k
Mastering Developer Experience: A Roadmap for Success 【開発生産性Conference 2024】
findyinc
1
380
Introduction of Happy Eyeballs Version 2 (RFC8305) to the Socket library
coe401_
1
220
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
17
8.7k
How to train your dragon (web standard)
notwaldorf
79
5.5k
A Tale of Four Properties
chriscoyier
155
22k
[RailsConf 2023] Rails as a piece of cake
palkan
35
4.4k
Learning to Love Humans: Emotional Interface Design
aarron
269
39k
Designing with Data
zakiwarfel
96
5k
Creatively Recalculating Your Daily Design Routine
revolveconf
214
11k
How to name files
jennybc
67
96k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
224
21k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
16
1.6k
Gamification - CAS2011
davidbonilla
78
4.9k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
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