Wednesday, October 21, 2015

Monitoring Java based Applications: Metrics+Graphite+Grafana

As developers when we write a piece of code we try our best to make sure we have carefully chosen the best algorithms, the data structures are carefully tuned to match the situation at hand and the piece of software we wrote just works out of the box. Unfortunately life is not ideal and there are some hiccups that are bound to hit us however smooth the ride be. Some nasty bugs will inevitably show up on the production server as the software is used for a length of time. The best one can do then is to monitor the software being used in production environment, anticipate the problems before it hits the user and hampers their experience.

This post will talk about such a stack for monitoring java based applications involving:

We will use dropwizard metrics to instrument our Java code and push the data to graphite. Graphite will store our time-series data meaning values such as latency, performance, throughput, counts etc corresponding to say our APIs. Though Graphite renders graphs built on top of the time-series data as and when required, Graphite on its own doesn't provide the best visual experience and dashboard properties. We will thence use Grafana to build and view our dashboards. So the pipeline on a high level will be this:

Here is the documentation of dropwizard metrics listing its various capabilities. Their documentation is not that great, in my opinion, but workable. The good news is there is also a spring library that provides annotations you can use directly to enable instrumentation. Just add an annotation on top of a method and thats it. Here is an example:

@Metered(absolute = true, name= "RuntimeError")
public ErrorMessage handleThrowable(HttpServletRequest request, Throwable t) {



As you see here, there is an annotation (@Metred) which is responsible for instrumenting the following method- handleThrowable(...). The metred annotation gives the timed average meaning number of errors in a unit of time. As simple as that! The code in bold is all you need to write to instrument the following method, for instance.

Next, we need to tell our metrics where Graphite resides so data can be sent to Graphite. Here is how you configure this. The prefixedWith() attribute defines how Graphite will show this. Here is a screenshot from my Graphite dashboard showing the tree-based structure that we just set.


On the right of this pane shown above you ca see the graph you select. The visual features in Graphite is rather limited so we will forward the Graphit input to Grafana. Here is a video introducing Grafana interface.e

Make your dashboards the way you wish to see your graphs and keep monitoring to stay ahead of the bugs!


  1. Great work, I’m happy that I came across with your site this article is on point,thanks again and have a great day. Keep update more information..

    Android Training in Chennai

  2. I agree with your thoughts!!! As the demand of java programming application keeps on increasing, there is massive demand for java professionals in software development industries. Thus, taking training will assist students to be skilled java developers in leading MNCs.Best Java Training in Chennai | JAVATraining Institutes in Chennai

  3. Hi Dude,
    Awesome Post!!! With unique content, I really get interest to read this post. I hope this article help many of them who looking this pretty information.
    Hadoop Training in Chennai|Big Data Training Chennai|Best Hadoop Training in Chennai


  4. Great and useful article. Creating content regularly is very tough. Your points are motivated me to move on.

    SEO Company in Chennai

  5. Great explanation to given on this post .The given information very impressed for me really so nice content.

    DotNet Training in Chennai Mylapore

  6. Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai Java Online Training Java Online Training

  7. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai Java Training in Chennai

    Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training in Chennai

  8. Hi, Really your post was very informative. Today's internet era learn Hadoop Online Training will helps you to reach your goal.Selenium Training

  9. Excellent articles and really interesting.I read that our blog very nice.We'll give all example code excellent and then easy observe the all useful information.Selenium Training Chennai | Selenium Training in Chennai

  10. I get a lot of great information from your blog. Thank you for your sharing this informative blog. I have bookmarked this page for my future reference.
    Selenium Training in Chennai

  11. Hi, I am really happy to found such a helpful and fascinating post that is written in well manner. Thanks for sharing such an informative post. keep update your blog.R Programming Online Training

  12. Thank you for Sharing.(ERP) Enterprise Resource Planning Software Solutions in Chennai.
    ERP Software Company Chennai | ERP Software Development Chennai

  13. Thank you for this valuable information. I have got some important suggestions from it. Get your business to the next level in simple steps.
    ERP Solutions in Chennai | ERP Software Solutions in Chennai.

  14. There was very wonderful information and that's great one. I really appreciate the kind words, thanks for sharing that valuable information.
    Graphic design course in chennai

  15. very usefull informatation.and iam expecting more posts like this please keep updating us........

  16. Nice blog with smart content., The explanation of java concept was so informative. Thanks for sharing such a nice blog. Java Training in Chennai | Dot Net Training in Chennai

  17. Awesome Blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog. Selenium Training Institute in Chennai | ISTQB Training Institute in Chennai | Six Sigma Certification Training in Chennai

  18. I would like to say thank you for the amazing details and concepts you are sharing in this.
    Webseiten Gestaltung Lüdenscheid

  19. Fantastic Blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog.
    Mat Lab Project Center in Chennai | Embedded Project Center in Chennai | IEEE Project Center in Chennai | Final Year Project Center in Chennai

  20. The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .
    office 2010 professional plus key deutsch

  21. Sap Training Institute in Noida-Webtrackker is the exceptional SAP training center in noida. SAP or systems software and products in facts processing are an extraordinary a part of ERP or organization aid planning. ERP is an integration of several software or packages this is used to streamline the techniques of a big scale enterprise or business. ERP has been essential parts of enterprise organization way manipulate and one of the principal structures of ERP has been SAP.
    Sas Training Institute in Noida
    PHP Training Institute in Noida
    Hadoop Training Institute in Noida
    Oracle Training Institute in Noida
    Linux Training Institute in Noida
    Dot net Training Institute in Noida
    Salesforce training institute in noida
    Java training institute in noida

  22. Interesting post! This is really helpful for me. I like it! Thanks for sharing!
    online marketing lüdenscheid

  23. Australia best tutor is well known academic portal. Here students can get different kind of Online Assignment help services like that

    1.Online Assignment Help
    2.Instant Assignment Help
    3.Assignment Help
    4.Help with Assignment assignment Help

    And also access that services at any time and any where.

  24. Air conditioning maintenance birmingham- onlyrepaircenter has the 30 Years Experience in Air conditioning maintenance service in birmingham. If you are facing the problem in your air conditioning of any company such as Daikin, Mitsubishi, Carrier, Fujitsu, Toshiba, Airedale, Sanyo, Trane and LG then you can contact to us.

    Air Conditioning Installation birmingham,
    Commercial air conditioning repair Birmingham,
    residential air conditioning repair birmingham ,
    Air Conditioning Maintenance birmingham ,
    window ac repair birmingham,

  25. I really enjoyed while reading your article. The information you have delivered in this post was damn good. Keep sharing your post with efficient news.
    MSC Project Center in Chennai | MSC Project Center in Velachery

  26. very usefull informatation.and iam expecting more posts like this please keep updating us.......
    Selenium Training in Chennai
    Oracle Training in Chennai

  27. I really enjoyed while reading your article, the information you have delivered in this post was damn good. Keep sharing your post with efficient news.. Automation Anywhere Training in Chennai | RPA Training Institute in Chennai | UI Path Training Institute in Chennai

  28. Nice info! It would be really useful for those who are Searching ..Thanks for sharing..

    aws training in chennai

  29. Your website content nice nice and interesting to observe.
    jobbörse Neunkirchen

  30. I read this article. I think You put a lot of effort to create this article. I appreciate your work.
    Dissertation Writing Services

  31. Excellent information with unique content and it is very useful to know about the information based on blogs...
    Best IT Training Institute in Chennai |Best IT Training Institute in Velachery

  32. Thanks for sharing such informative guide on Java technology. This post gives me detailed information about the Java technology. I am working as trainer in leading IT training academy offering Java Training in Chennai and i use your guide to educate my studentsMS Office Summer Course in Chennai | MS Office Summer Course in Velachery | MS Office Summer Course in Taramani

  33. It is a one of the great discussion which is very essential for me as well.Summer Courses in Chennai | Summer Courses in Chrompet

  34. This is an awesome post.Really very informative and creative contents..Thanks a lot for sharing your interesting article.
    Best Summer Courses for Hardware Networking in Chennai | No.1 Summer Course in Guindy

  35. Just pure brilliance from you here. I have never expected something less than this from you and you have not disappointed me at all. I suppose you will keep the quality work going on.
    Best Summer Courses for Business Administration in Chennai | No.1 Vacation Classes in Velachery

  36. Nice post. Great information and really very much useful. Thanks for sharing and keep updating.
    Best Summer Courses for School Students in Chennai | Best Summer Courses for School Students in Velachery

  37. Awesome Post with unique content. I really get interest to read this post. I hope this article help many of them…
    No.1 CorelDraw Summer Course in Guindy | Perfect Vacation Classes in Chennai

  38. Thank you for sharing nice information really very nice ..i am interested thank you. Adobe Photoshop Vacation Classes in Chennai | Best Technical Boot Camp in Chennai

  39. The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post.
    Photoshop Training Institute in Chennai | Best Multimedia Training Institute in Velachery

  40. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.
    Graphics Designing Training Institute in chennai | Best Multimedia courses in Velachery

  41. It is a one of the great discussion which is very essential for me as well. I must follow the handy discussion and sure that the content will be very useful to me as well. Keep it up.
    Tata Sky New Connection | Tata Sky DTH | Tata Sky DTH New Connection

  42. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
    Good AWS Training in Tambaram | AWS Courses in Adyar | AWS Institute in Besant Nagar

  43. Nice..Its informative...You have clearly explained about the concept..Its very useful for me to understand..Keep on sharing..
    AWS Certification Exam Centers in Taramani | AWS Training in Shozhinganallur

  44. Excellent information!!!..Thanks for your informative post. Found really awesome and unique information you have shared...
    Android Exam Certification Training in Chennai | No.1 Android Exam in Velachery

  45. You made some good points there. I did a search on the topic and found most people will agree with your blog
    Hardware and Networking Certification Center in Chennai | No.1 Hardware Exam in Medavakkam

  46. Good read.. however I think everyone is ahead of themselves again tech wise. I know everyone thinks we will be using some high tech wearable computers...
    Certified Ethical Hacking Training in Chennai | No.1 Ethical Hacking in Porur

  47. Interesting and informative article.. very useful to me.. thanks for sharing your wonderful ideas.. please keep on updating..
    Cisco Certification Training in Chennai | Excellent Cisco Courses in Pallavaram

  48. Pretty post! I found some useful information in your post, it was awesome to read, thanks for sharing this great content to my vision, thanks.
    Certified Ethical Hacking Exam Courses in Chennai | Profressional Ethical Hacking in Tambaram