For this pattern, we have the following problem, solution, and solution requirements.
Problem
If observed response times and/or the usage of hardware resources become unacceptably high, it can be very hard to discover the root cause of the problem. For example, we need to be able to analyze hardware resource consumption per microservice.
Solution
To curb this, we add a new component, a monitor service, to the system landscape, which is capable of collecting metrics about hardware resource usage for each microservice instance level.
Solution requirements
The solution requirements are as follows:
It must be able to collect metrics from all the servers that are used by the system landscape, which includes autoscaling servers
It must be able to detect new microservice instances as they are launched on the available servers and start to collect metrics from them
It must be able to provide APIs and graphical tools for querying and analyzing the collected metrics
It must be possible to define alerts that are triggered when a specified metric exceeds a specified threshold value
The following screenshot shows Grafana, which visualizes metrics from Prometheus, a monitoring tool that we will look at in Chapter 20, Monitoring Microservices:
Figure 1.16: Monitoring with Grafana
That was an extensive list! I am sure these design patterns helped you to understand the challenges with microservices better. Next, we will move on to learning about software enablers.