SlideShare a Scribd company logo
1 of 43
Download to read offline
Metrics by Coda Haleto know your app’ health
Izzet Mustafayev@EPAM Systems
@webdizz webdizz izzetmustafaiev
http://webdizz.name
this is me
● SA at EPAM Systems
● primary skill is Java
● JUG member/speaker
● hands-on-coding with Ruby, Groovy and
some Scala
● passionate about agile, clean code
practices and devops movement
agenda
● introduction
● why should i care
● features
● reporting
● recipes
● alternatives
● q&a
Finish or Start?
Familiar?
Possible?!.
Your app?!.
Dreams...
One thing...
● does my app work?
● does my app work?
● will my app keep working?
● does my app work?
● will my app keep working?
● what happened that
made my app stop
working?
Statistics
Metrics
Features
Registry.
..- is the heart of metrics framework
MetricRegistry registry = new MetricRegistry();​
// or
@Bean
public MetricRegistry metricRegistry(){
return new MetricRegistry();
}
Gauge...
- is the simplest metric type that just returns a value
registry.register(
name(Persistence.class, "entities-cached"),
new Gauge<Integer>() {
public Integer getValue() {
return cache.getItems();
}
}
);​
Counter...
- is a simple incrementing and decrementing integer value
Counter onSiteUsers = registry.counter(
name(User.class, "users-logged-in"));
// on login increase
onSiteUsers.inc();​
// on logout/session expiration decrease
onSiteUsers.dec();​
Histogram.
..- measures the distribution of values in a stream of data
Histogram requestTimes = registry.histogram(
name(Request.class, "request-processed")
);
requestTimes.update(request.getTime());
​
Meter...
- measures the rate at which a set of events occur
Meter timedOutRequests = registry.meter(
name(Request.class, "request-timed-out")
);
// in finally block on time-out
timedOutRequests.mark();
Timer...
- is basically a histogram of the duration of a type of event
and a meter of the rate of its occurrence
​Timer requests = registry.timer(
name(Request.class, "request-processed")
);
Timer.Context time = requests.time();
// in finally block of request processing
time.stop();​
Health Check..
- is a unified way of performing application health checks
public class BackendHealthCheck extends HealthCheck {
private Backend backend;
protected Result check() {
if (backend.ping()) {
return Result.healthy();
}
return Result.unhealthy("Can't ping backend");
}
}
Reporting
JMX
// somewhere in your application​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
JmxReporter reporter =
JmxReporter.forRegistry(registry).build();
reporter.start();​
HTTP
● AdminServlet
○ MetricsServlet
○ ThreadDumpServlet
○ PingServlet
○ HealthCheckServlet
Console
ConsoleReporter reporter = ConsoleReporter.forRegistry
(registry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
reporter.start(1, TimeUnit.MINUTES);​
Slf4jReporter reporter = Slf4jReporter.forRegistry(registry)
.outputTo(LoggerFactory.getLogger("com.app.metrics"))
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
reporter.start(1, TimeUnit.MINUTES);​
Ganglia & Graphite
Naming by Matt Aimonetti
<namespace>.<instrumented section>.<target (noun)>.
<action (past tense verb)>
Example
● customers.registration.validation.failed
Nesting
● customers.registration.validation.failure.
similar_email_found
● customers.registration.validation.failure.
email_verification_failed
AOP
There is an easy way to introduce metrics using AOP.
<aop:config proxy-target-class="false">
<aop:aspect id="controllerProfilerAspect"
ref="executionMonitor">
<aop:pointcut id="controllerMethods"
expression="execution(*
com.app.controller.*Controller.*(..))" />
<aop:around pointcut-ref="controllerMethods"
method="logExecutionTime" />
</aop:aspect>
</aop:config>
​
public Object logExecutionTime(ProceedingJoinPoint joinPoint)
throws Throwable {
String namePfx = metricNamePrefix(joinPoint);
Timer.Context time = registry.timer(
name(namePfx, "timed")).time();
try {
// execute joint point ...
} catch(Throwable throwable) {
registry.counter(
name(namePfx, "exception-counted")).inc();
throw throwable;
} finally {
time.stop()
}
}
​
metrics-spring
@Configuration
@EnableMetrics
public class ApplicationConfiguration {
@Bean
public MetricRegistry metricRegistry(){
return new MetricRegistry();
}
// your other beans here ...
}
// annotations
@Timed, @Metered, @ExceptionMetered, @Counted​, @Gauge,
@CachedGauge and @Metric
instrumentation
● JVM
● Jetty
● Jersey
● InstrumentedFilter​
● InstrumentedEhcache​
● InstrumentedAppender (Log4j and Logback)
● InstrumentedHttpClient
Alternatives
https://github.com/twitter/zipkin
Zipkin is a distributed tracing system that helps
Twitter gather timing data for all the disparate
services.
Zipkin provides three services:
● to collect data: bin/collector
● to extract data: bin/query
● to display data: bin/web
http://www.moskito.org/
MoSKito is a
● Multi-purpose: collects any possible type of
performance data, including business-related
● Non-invasive: does not require any code
change
● Interval-based: works simultaneously with
short & long time intervals, allowing instant
comparison
● Data privacy: keeps collected data locally,
with no 3rd party resources involved.
● Analysis tools: displays accumulated
performance data in charts. Live profiling:
records user actions as system calls.
https://code.google.com/p/javasimon/
Java Simon is a
simple monitoring API that allows you to
follow and better understand your application.
Monitors (familiarly called Simons) are
placed directly into your code and you can
choose whether you want to count something or
measure time/duration.
https://github.com/Netflix/servo
Servo goal is to provide a simple interface for
exposing and publishing application metrics in
Java.
● JMX: JMX is the standard monitoring
interface for Java
● Simple: It is trivial to expose and publish
metrics
● Flexible publishing: Once metrics are
exposed, it is easy to regularly poll the
metrics and make them available for
reporting systems, logs, and services like
Amazon’s CloudWatch.
Summary
getting started
● http://metrics.codahale.com/
● http://matt.aimonetti.
net/posts/2013/06/26/practical-guide-to-
graphite-monitoring/
● http://www.ryantenney.com/metrics-spring/
q&a
ThanksIzzet Mustafayev@EPAM Systems
@webdizz webdizz izzetmustafaiev
http://webdizz.name

More Related Content

What's hot

ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...
ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...
ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...DicodingEvent
 
Serverless Angular, Material, Firebase and Google Cloud applications
Serverless Angular, Material, Firebase and Google Cloud applicationsServerless Angular, Material, Firebase and Google Cloud applications
Serverless Angular, Material, Firebase and Google Cloud applicationsLoiane Groner
 
The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016Frank Lyaruu
 
Do we need a bigger dev data culture
Do we need a bigger dev data cultureDo we need a bigger dev data culture
Do we need a bigger dev data cultureSimon Dittlmann
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overviewAlex Bachuk
 
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java GirlFull-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java GirlLoiane Groner
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use casesFabio Biondi
 
Designing applications with Redux
Designing applications with ReduxDesigning applications with Redux
Designing applications with ReduxFernando Daciuk
 
Gerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRxGerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRxLoiane Groner
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidEgor Andreevich
 
Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaAli Muzaffar
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Loiane Groner
 
ProvJS: Six Months of ReactJS and Redux
ProvJS:  Six Months of ReactJS and ReduxProvJS:  Six Months of ReactJS and Redux
ProvJS: Six Months of ReactJS and ReduxThom Nichols
 
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018Loiane Groner
 
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConfFull-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConfLoiane Groner
 
Apollo. The client we deserve
Apollo. The client we deserveApollo. The client we deserve
Apollo. The client we deserveYuri Nezdemkovski
 

What's hot (20)

ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...
ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...
ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...
 
Using redux
Using reduxUsing redux
Using redux
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
Serverless Angular, Material, Firebase and Google Cloud applications
Serverless Angular, Material, Firebase and Google Cloud applicationsServerless Angular, Material, Firebase and Google Cloud applications
Serverless Angular, Material, Firebase and Google Cloud applications
 
The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016
 
Redux Universal
Redux UniversalRedux Universal
Redux Universal
 
Do we need a bigger dev data culture
Do we need a bigger dev data cultureDo we need a bigger dev data culture
Do we need a bigger dev data culture
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java GirlFull-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
 
Designing applications with Redux
Designing applications with ReduxDesigning applications with Redux
Designing applications with Redux
 
Gerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRxGerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRx
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich Android
 
Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJava
 
Unit testing hippo
Unit testing hippoUnit testing hippo
Unit testing hippo
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
 
ProvJS: Six Months of ReactJS and Redux
ProvJS:  Six Months of ReactJS and ReduxProvJS:  Six Months of ReactJS and Redux
ProvJS: Six Months of ReactJS and Redux
 
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
 
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConfFull-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
 
Apollo. The client we deserve
Apollo. The client we deserveApollo. The client we deserve
Apollo. The client we deserve
 

Similar to Metrics by coda hale : to know your app’ health

Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVCMaarten Balliauw
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappearedLuc Bors
 
Dhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro PresentationDhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro PresentationDhanasekaran Nagarajan
 
First QTP Tutorial
First QTP TutorialFirst QTP Tutorial
First QTP Tutorialtjdhans
 
QTP Tutorial Slides Presentation.
QTP Tutorial Slides Presentation.QTP Tutorial Slides Presentation.
QTP Tutorial Slides Presentation.Jaya Priya
 
TDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit HappensTDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit HappensJackson F. de A. Mafra
 
Debugging Planning Issues Using Calcite's Built-in Loggers
Debugging Planning Issues Using Calcite's Built-in LoggersDebugging Planning Issues Using Calcite's Built-in Loggers
Debugging Planning Issues Using Calcite's Built-in LoggersStamatis Zampetakis
 
Automated Performance Testing
Automated Performance TestingAutomated Performance Testing
Automated Performance TestingLars Thorup
 
Sql storeprocedure
Sql storeprocedureSql storeprocedure
Sql storeprocedureftz 420
 
Workflow demo
Workflow demoWorkflow demo
Workflow demoKamal Raj
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsAbhijeet Vaikar
 
jBPM5 in action - a quickstart for developers
jBPM5 in action - a quickstart for developersjBPM5 in action - a quickstart for developers
jBPM5 in action - a quickstart for developersKris Verlaenen
 
Spring AOP @ DevClub.eu
Spring AOP @ DevClub.euSpring AOP @ DevClub.eu
Spring AOP @ DevClub.euarsenikum
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And MavenPerconaPerformance
 
Aspect-Oriented Programming
Aspect-Oriented ProgrammingAspect-Oriented Programming
Aspect-Oriented ProgrammingAndrey Bratukhin
 
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs LifeTesting with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs LifePeter Gfader
 
SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011David O'Dowd
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0Matt Raible
 

Similar to Metrics by coda hale : to know your app’ health (20)

Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappeared
 
Dhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro PresentationDhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro Presentation
 
First QTP Tutorial
First QTP TutorialFirst QTP Tutorial
First QTP Tutorial
 
QTP Tutorial Slides Presentation.
QTP Tutorial Slides Presentation.QTP Tutorial Slides Presentation.
QTP Tutorial Slides Presentation.
 
TDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit HappensTDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit Happens
 
Debugging Planning Issues Using Calcite's Built-in Loggers
Debugging Planning Issues Using Calcite's Built-in LoggersDebugging Planning Issues Using Calcite's Built-in Loggers
Debugging Planning Issues Using Calcite's Built-in Loggers
 
Automated Performance Testing
Automated Performance TestingAutomated Performance Testing
Automated Performance Testing
 
Sql storeprocedure
Sql storeprocedureSql storeprocedure
Sql storeprocedure
 
Workflow demo
Workflow demoWorkflow demo
Workflow demo
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
jBPM5 in action - a quickstart for developers
jBPM5 in action - a quickstart for developersjBPM5 in action - a quickstart for developers
jBPM5 in action - a quickstart for developers
 
Spring AOP @ DevClub.eu
Spring AOP @ DevClub.euSpring AOP @ DevClub.eu
Spring AOP @ DevClub.eu
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
Aspect-Oriented Programming
Aspect-Oriented ProgrammingAspect-Oriented Programming
Aspect-Oriented Programming
 
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs LifeTesting with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
 
Spring AOP
Spring AOPSpring AOP
Spring AOP
 
SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0
 
Spring framework part 2
Spring framework  part 2Spring framework  part 2
Spring framework part 2
 

More from Izzet Mustafaiev

Kotlin strives for Deep Learning
Kotlin strives for Deep LearningKotlin strives for Deep Learning
Kotlin strives for Deep LearningIzzet Mustafaiev
 
Consumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolutionConsumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolutionIzzet Mustafaiev
 
Functional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenixFunctional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenixIzzet Mustafaiev
 
Don’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleaguesDon’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleaguesIzzet Mustafaiev
 
Performance testing for web-scale
Performance testing for web-scalePerformance testing for web-scale
Performance testing for web-scaleIzzet Mustafaiev
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?Izzet Mustafaiev
 
Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!Izzet Mustafaiev
 
µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015Izzet Mustafaiev
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development PipelineIzzet Mustafaiev
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Izzet Mustafaiev
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices ArchitectureIzzet Mustafaiev
 
“Bootify your app - from zero to hero
“Bootify  your app - from zero to hero“Bootify  your app - from zero to hero
“Bootify your app - from zero to heroIzzet Mustafaiev
 
Buildr - build like you code
Buildr -  build like you codeBuildr -  build like you code
Buildr - build like you codeIzzet Mustafaiev
 

More from Izzet Mustafaiev (20)

Overcome a Frontier
Overcome a FrontierOvercome a Frontier
Overcome a Frontier
 
Web Security... Level Up
Web Security... Level UpWeb Security... Level Up
Web Security... Level Up
 
Kotlin strives for Deep Learning
Kotlin strives for Deep LearningKotlin strives for Deep Learning
Kotlin strives for Deep Learning
 
Can I do AI?
Can I do AI?Can I do AI?
Can I do AI?
 
Consumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolutionConsumer-Driven Contracts to enable API evolution
Consumer-Driven Contracts to enable API evolution
 
Functional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenixFunctional web with elixir and elm in phoenix
Functional web with elixir and elm in phoenix
 
Fabric8 CI/CD
Fabric8 CI/CDFabric8 CI/CD
Fabric8 CI/CD
 
Don’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleaguesDon’t let your code to be illiterate along with your colleagues
Don’t let your code to be illiterate along with your colleagues
 
Performance testing for web-scale
Performance testing for web-scalePerformance testing for web-scale
Performance testing for web-scale
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?
 
Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!Fault tolerance - look, it's simple!
Fault tolerance - look, it's simple!
 
µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015µServices Architecture @ EPAM WOW 2015
µServices Architecture @ EPAM WOW 2015
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
“Bootify your app - from zero to hero
“Bootify  your app - from zero to hero“Bootify  your app - from zero to hero
“Bootify your app - from zero to hero
 
Buildr - build like you code
Buildr -  build like you codeBuildr -  build like you code
Buildr - build like you code
 
Groovy MOPping
Groovy MOPpingGroovy MOPping
Groovy MOPping
 
TDD with Spock @xpdays_ua
TDD with Spock @xpdays_uaTDD with Spock @xpdays_ua
TDD with Spock @xpdays_ua
 

Recently uploaded

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 

Recently uploaded (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 

Metrics by coda hale : to know your app’ health

  • 1. Metrics by Coda Haleto know your app’ health Izzet Mustafayev@EPAM Systems @webdizz webdizz izzetmustafaiev http://webdizz.name
  • 2. this is me ● SA at EPAM Systems ● primary skill is Java ● JUG member/speaker ● hands-on-coding with Ruby, Groovy and some Scala ● passionate about agile, clean code practices and devops movement
  • 3. agenda ● introduction ● why should i care ● features ● reporting ● recipes ● alternatives ● q&a
  • 4.
  • 11. ● does my app work?
  • 12. ● does my app work? ● will my app keep working?
  • 13. ● does my app work? ● will my app keep working? ● what happened that made my app stop working?
  • 17. Registry. ..- is the heart of metrics framework MetricRegistry registry = new MetricRegistry();​ // or @Bean public MetricRegistry metricRegistry(){ return new MetricRegistry(); }
  • 18. Gauge... - is the simplest metric type that just returns a value registry.register( name(Persistence.class, "entities-cached"), new Gauge<Integer>() { public Integer getValue() { return cache.getItems(); } } );​
  • 19. Counter... - is a simple incrementing and decrementing integer value Counter onSiteUsers = registry.counter( name(User.class, "users-logged-in")); // on login increase onSiteUsers.inc();​ // on logout/session expiration decrease onSiteUsers.dec();​
  • 20. Histogram. ..- measures the distribution of values in a stream of data Histogram requestTimes = registry.histogram( name(Request.class, "request-processed") ); requestTimes.update(request.getTime()); ​
  • 21. Meter... - measures the rate at which a set of events occur Meter timedOutRequests = registry.meter( name(Request.class, "request-timed-out") ); // in finally block on time-out timedOutRequests.mark();
  • 22. Timer... - is basically a histogram of the duration of a type of event and a meter of the rate of its occurrence ​Timer requests = registry.timer( name(Request.class, "request-processed") ); Timer.Context time = requests.time(); // in finally block of request processing time.stop();​
  • 23. Health Check.. - is a unified way of performing application health checks public class BackendHealthCheck extends HealthCheck { private Backend backend; protected Result check() { if (backend.ping()) { return Result.healthy(); } return Result.unhealthy("Can't ping backend"); } }
  • 25. JMX // somewhere in your application​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ JmxReporter reporter = JmxReporter.forRegistry(registry).build(); reporter.start();​
  • 26. HTTP ● AdminServlet ○ MetricsServlet ○ ThreadDumpServlet ○ PingServlet ○ HealthCheckServlet
  • 27. Console ConsoleReporter reporter = ConsoleReporter.forRegistry (registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(1, TimeUnit.MINUTES);​ Slf4jReporter reporter = Slf4jReporter.forRegistry(registry) .outputTo(LoggerFactory.getLogger("com.app.metrics")) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(1, TimeUnit.MINUTES);​
  • 29.
  • 30. Naming by Matt Aimonetti <namespace>.<instrumented section>.<target (noun)>. <action (past tense verb)> Example ● customers.registration.validation.failed Nesting ● customers.registration.validation.failure. similar_email_found ● customers.registration.validation.failure. email_verification_failed
  • 31. AOP There is an easy way to introduce metrics using AOP. <aop:config proxy-target-class="false"> <aop:aspect id="controllerProfilerAspect" ref="executionMonitor"> <aop:pointcut id="controllerMethods" expression="execution(* com.app.controller.*Controller.*(..))" /> <aop:around pointcut-ref="controllerMethods" method="logExecutionTime" /> </aop:aspect> </aop:config> ​
  • 32. public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable { String namePfx = metricNamePrefix(joinPoint); Timer.Context time = registry.timer( name(namePfx, "timed")).time(); try { // execute joint point ... } catch(Throwable throwable) { registry.counter( name(namePfx, "exception-counted")).inc(); throw throwable; } finally { time.stop() } } ​
  • 33. metrics-spring @Configuration @EnableMetrics public class ApplicationConfiguration { @Bean public MetricRegistry metricRegistry(){ return new MetricRegistry(); } // your other beans here ... } // annotations @Timed, @Metered, @ExceptionMetered, @Counted​, @Gauge, @CachedGauge and @Metric
  • 34. instrumentation ● JVM ● Jetty ● Jersey ● InstrumentedFilter​ ● InstrumentedEhcache​ ● InstrumentedAppender (Log4j and Logback) ● InstrumentedHttpClient
  • 36. https://github.com/twitter/zipkin Zipkin is a distributed tracing system that helps Twitter gather timing data for all the disparate services. Zipkin provides three services: ● to collect data: bin/collector ● to extract data: bin/query ● to display data: bin/web
  • 37. http://www.moskito.org/ MoSKito is a ● Multi-purpose: collects any possible type of performance data, including business-related ● Non-invasive: does not require any code change ● Interval-based: works simultaneously with short & long time intervals, allowing instant comparison ● Data privacy: keeps collected data locally, with no 3rd party resources involved. ● Analysis tools: displays accumulated performance data in charts. Live profiling: records user actions as system calls.
  • 38. https://code.google.com/p/javasimon/ Java Simon is a simple monitoring API that allows you to follow and better understand your application. Monitors (familiarly called Simons) are placed directly into your code and you can choose whether you want to count something or measure time/duration.
  • 39. https://github.com/Netflix/servo Servo goal is to provide a simple interface for exposing and publishing application metrics in Java. ● JMX: JMX is the standard monitoring interface for Java ● Simple: It is trivial to expose and publish metrics ● Flexible publishing: Once metrics are exposed, it is easy to regularly poll the metrics and make them available for reporting systems, logs, and services like Amazon’s CloudWatch.
  • 41. getting started ● http://metrics.codahale.com/ ● http://matt.aimonetti. net/posts/2013/06/26/practical-guide-to- graphite-monitoring/ ● http://www.ryantenney.com/metrics-spring/
  • 42. q&a
  • 43. ThanksIzzet Mustafayev@EPAM Systems @webdizz webdizz izzetmustafaiev http://webdizz.name