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.


graphite-left.png

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!

75 comments:

  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

    ReplyDelete
  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

    ReplyDelete
  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.
    Regards,
    Hadoop Training in Chennai|Big Data Training Chennai|Best Hadoop Training in Chennai

    ReplyDelete


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


    SEO Company in Chennai

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



    DotNet Training in Chennai Mylapore

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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.

    ReplyDelete
  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

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

    ReplyDelete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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

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

    ReplyDelete
  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

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

    ReplyDelete
  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
    5.my assignment Help

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

    ReplyDelete
  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,

    ReplyDelete
  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

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

    ReplyDelete
  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

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

    aws training in chennai

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

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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  49. Thanks for posting this useful content, Good to know about new things here, Let me share this...
    ISTQB Certifications Exam Cost in Chennai | QA Testing in Thiruvanmiyur

    ReplyDelete
  50. Nice and informative article.Thanks for sharing such nice article, keep on updating.

    Core Java Training in Chennai
    Core Java Training

    ReplyDelete
  51. Thanks for posting this useful content, Good to know about new things here.
    Cisco CCNA Certification Exams in Chennai | Best CCNA Course in Guindy

    ReplyDelete
  52. To improve Knowledge about the latest and vital technology would increase one's self esteem to the core at the time of lagging confidence.The content presented here is quite resembling the same. You have done a great job by sharing this in here.
    sap abap online courses

    ReplyDelete
  53. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Blue Prism Certification Exam Training in Chennai | No.1 RPA Blue Prism Course in Tambaram

    ReplyDelete