Quick tip: How to monitor your microservice

Five required components together make your microservice monitored properly: Logging, dashboards, alerts, alert guide, and shift work schedule.

If I’d resume the whole process in one sentence it would be something like this:

“Your application should log relevant information, have key metrics in a dashboard that fire alerts when things go wrong, and a very clear instruction guide on what to do to deal with each alert.”

Confusing? Check the diagram below from left to right and see how the sentence above could be illustrated in one image:

Ideally, your application would have one alert configured for each key application metric, and one page in an instruction guide for each alert. By key application metric, I mean metrics that is crucial for application that should follow a pattern indicating it is working fine. It could be not only infrastructure metric such as CPU, RAM and database connections but also application metrics including latency, dependencies, errors, endpoint response time, etc. One real-life example could be as follows:

Although some of the key metrics like CPU, RAM, or Requests per second are often provided by existing tools and frameworks, sometimes other metrics might be specific for your application. One possible solution is to create logs in your application and then use another tool to read those logs and create a graph in your dashboard.

Conclusion

In conclusion to this post, let’s review the key points:

  • Identify the key metric for your application
  • Have a single dashboard, that may be a Grafana, New Relic, Kibana, Sentry, Azure Application Insights or so on. This dashboard is the overall health of the microservice.
  • Alerts for each of the metrics in the dashboard
  • Have a centralized document or page (Confluent, wiki, etc.) which is a guide on how to deal with each alert.
  • Set with the team (squad) the shift schedule if necessary.

Check out the references below to go further in the subject.

References

Fowler, Susan, ed. (2016) Production-ready microservices. 1st ed. O’Reilly Media, Inc

Newman, Sam, ed. (2015) Building Microservices. 1st ed. O’Reilly Media, Inc

1 thought on “Quick tip: How to monitor your microservice

  1. rafaelmadureira's avatar

    I liked the post, objective as it should be, and highlights the most relevant points, in my opinion.

    Like

Leave a comment

search previous next tag category expand menu location phone mail time cart zoom edit close