SlideShare a Scribd company logo
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
Metrics by coda hale : to know your app’ health
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
Metrics by coda hale : to know your app’ health
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

PDF
Metrics
Zach Cox
 
PDF
Continuous performance management with Gatling
Radoslaw Smilgin
 
PDF
Wicket Live on Stage
Martijn Dashorst
 
PDF
Extending Spark With Java Agent (handout)
Jaroslav Bachorik
 
PDF
React state management with Redux and MobX
Darko Kukovec
 
PDF
Mobx for Dummies - Yauheni Nikanowich - React Warsaw #5
Marcin Mieszek
 
PDF
Gatling - Bordeaux JUG
slandelle
 
PPT
Springaopdecoded ajip
Makarand Bhatambarekar
 
Metrics
Zach Cox
 
Continuous performance management with Gatling
Radoslaw Smilgin
 
Wicket Live on Stage
Martijn Dashorst
 
Extending Spark With Java Agent (handout)
Jaroslav Bachorik
 
React state management with Redux and MobX
Darko Kukovec
 
Mobx for Dummies - Yauheni Nikanowich - React Warsaw #5
Marcin Mieszek
 
Gatling - Bordeaux JUG
slandelle
 
Springaopdecoded ajip
Makarand Bhatambarekar
 

What's hot (20)

PDF
ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...
DicodingEvent
 
PDF
Using redux
Jonas Ohlsson Aden
 
PDF
Introducing spring
Ernesto Hernández Rodríguez
 
PDF
Serverless Angular, Material, Firebase and Google Cloud applications
Loiane Groner
 
PPTX
The Road To Reactive with RxJava JEEConf 2016
Frank Lyaruu
 
PDF
Redux Universal
Nikolaus Graf
 
PDF
Do we need a bigger dev data culture
Simon Dittlmann
 
PDF
React.js and Redux overview
Alex Bachuk
 
PDF
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
Loiane Groner
 
PDF
Angular & RXJS: examples and use cases
Fabio Biondi
 
PDF
Designing applications with Redux
Fernando Daciuk
 
PDF
Gerenciamento de estado no Angular com NgRx
Loiane Groner
 
PDF
Intro to RxJava/RxAndroid - GDG Munich Android
Egor Andreevich
 
PPTX
Reactive Programming on Android - RxAndroid - RxJava
Ali Muzaffar
 
PPTX
Unit testing hippo
Ebrahim Aharpour
 
PDF
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
PPTX
ProvJS: Six Months of ReactJS and Redux
Thom Nichols
 
PDF
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
Loiane Groner
 
PDF
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
Loiane Groner
 
PDF
Apollo. The client we deserve
Yuri Nezdemkovski
 
ServiceWorker: Exploring the Core of the Progressive Web App-Bagus Aji Santos...
DicodingEvent
 
Using redux
Jonas Ohlsson Aden
 
Introducing spring
Ernesto Hernández Rodríguez
 
Serverless Angular, Material, Firebase and Google Cloud applications
Loiane Groner
 
The Road To Reactive with RxJava JEEConf 2016
Frank Lyaruu
 
Redux Universal
Nikolaus Graf
 
Do we need a bigger dev data culture
Simon Dittlmann
 
React.js and Redux overview
Alex Bachuk
 
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
Loiane Groner
 
Angular & RXJS: examples and use cases
Fabio Biondi
 
Designing applications with Redux
Fernando Daciuk
 
Gerenciamento de estado no Angular com NgRx
Loiane Groner
 
Intro to RxJava/RxAndroid - GDG Munich Android
Egor Andreevich
 
Reactive Programming on Android - RxAndroid - RxJava
Ali Muzaffar
 
Unit testing hippo
Ebrahim Aharpour
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
ProvJS: Six Months of ReactJS and Redux
Thom Nichols
 
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
Loiane Groner
 
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
Loiane Groner
 
Apollo. The client we deserve
Yuri Nezdemkovski
 
Ad

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

PPT
Introduction to ASP.NET MVC
Maarten Balliauw
 
PPTX
...and thus your forms automagically disappeared
Luc Bors
 
PPT
Dhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran Nagarajan
 
PPT
First QTP Tutorial
tjdhans
 
PPT
QTP Tutorial Slides Presentation.
Jaya Priya
 
PDF
TDC 2015 - POA - Trilha PHP - Shit Happens
Jackson F. de A. Mafra
 
PDF
Debugging Planning Issues Using Calcite's Built-in Loggers
Stamatis Zampetakis
 
PDF
Automated Performance Testing
Lars Thorup
 
PPTX
Sql storeprocedure
ftz 420
 
DOC
Workflow demo
Kamal Raj
 
PDF
Good practices for debugging Selenium and Appium tests
Abhijeet Vaikar
 
ODP
jBPM5 in action - a quickstart for developers
Kris Verlaenen
 
PPT
Spring AOP @ DevClub.eu
arsenikum
 
PDF
Automated Performance Testing With J Meter And Maven
PerconaPerformance
 
ODP
Aspect-Oriented Programming
Andrey Bratukhin
 
PPTX
Testing with VS2010 - A Bugs Life
Peter Gfader
 
PPT
Spring AOP
Lhouceine OUHAMZA
 
PPT
SoftTest Ireland: Model Based Testing - January 27th 2011
David O'Dowd
 
PDF
What's Coming in Spring 3.0
Matt Raible
 
PPTX
Spring framework part 2
Skillwise Group
 
Introduction to ASP.NET MVC
Maarten Balliauw
 
...and thus your forms automagically disappeared
Luc Bors
 
Dhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran Nagarajan
 
First QTP Tutorial
tjdhans
 
QTP Tutorial Slides Presentation.
Jaya Priya
 
TDC 2015 - POA - Trilha PHP - Shit Happens
Jackson F. de A. Mafra
 
Debugging Planning Issues Using Calcite's Built-in Loggers
Stamatis Zampetakis
 
Automated Performance Testing
Lars Thorup
 
Sql storeprocedure
ftz 420
 
Workflow demo
Kamal Raj
 
Good practices for debugging Selenium and Appium tests
Abhijeet Vaikar
 
jBPM5 in action - a quickstart for developers
Kris Verlaenen
 
Spring AOP @ DevClub.eu
arsenikum
 
Automated Performance Testing With J Meter And Maven
PerconaPerformance
 
Aspect-Oriented Programming
Andrey Bratukhin
 
Testing with VS2010 - A Bugs Life
Peter Gfader
 
Spring AOP
Lhouceine OUHAMZA
 
SoftTest Ireland: Model Based Testing - January 27th 2011
David O'Dowd
 
What's Coming in Spring 3.0
Matt Raible
 
Spring framework part 2
Skillwise Group
 
Ad

More from Izzet Mustafaiev (20)

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

Recently uploaded (20)

PPTX
Presentation about Database and Database Administrator
abhishekchauhan86963
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PDF
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
PDF
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PPTX
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
Presentation about Database and Database Administrator
abhishekchauhan86963
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Exploring AI Agents in Process Industries
amoreira6
 
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 

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
  • 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);​
  • 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