How Do You Know Which Metrics Are Worth Monitoring?
Nandan Jadhav
When you integrate a cloud platform with an observability or monitoring tool, you suddenly get access to tons of metrics.
And honestly, it can make you feel like you have everything you need at your fingertips.
CPU, memory, disk, network, requests, errors, latency, database connections, queries and many other metrics become available.
It almost feels like you are covered from every angle when it comes to finding a bottleneck, failure or degradation.
But there is one important question that comes after all of this.
Which of these metrics do you actually need?
The answer isn’t the same for every environment.
It depends on your application, infrastructure, architecture and what you are actually trying to monitor.
Start With What You Are Monitoring
Consider a relatively simple application running on a few virtual machines.
You might need to monitor things such as:
- Infrastructure availability
- CPU utilization
- Memory utilization
- Disk space
- Disk utilization
- Network activity
- System processes
- Application availability
For a simple application, this might already give you enough information to understand whether the infrastructure is healthy and whether the application is available.
But now consider a serverless application.
There may not be a traditional server for you to monitor.
The underlying infrastructure is managed by the cloud provider and can scale automatically.
In that scenario, monitoring CPU and memory on a server may not even make sense because you don’t own or manage that infrastructure in the same way.
Your monitoring approach needs to move closer to the application.
You may need to pay more attention to things such as:
- Application latency
- Error rates
- Request volume
- Function execution failures
- Logs
- Traces
- Application performance
- Dependency failures
The monitoring requirements changed because the architecture changed.
Infrastructure Monitoring
Infrastructure monitoring is still an important part of observability when you are managing servers, virtual machines or other infrastructure components.
For example, if you are running an application on VMware or cloud virtual machines, you might want to monitor:
CPU
Is the system consistently running at high CPU utilization?
Memory
Is available memory continuously decreasing? Are you seeing memory pressure or swapping?
Disk
Do you have enough free space? Is disk utilization increasing? Is disk I/O becoming a bottleneck?
Network
Are there unusual changes in network traffic? Are interfaces dropping packets or showing errors?
Availability
Is the host reachable and is the required service running?
But even here, you don’t necessarily need every metric that the monitoring agent or integration makes available.
You need the metrics that help you understand the health and behaviour of the infrastructure supporting your application.
A CPU metric might be important for one workload and almost irrelevant for another.
The same applies to memory, disk and network metrics.
Application Monitoring
Application monitoring is where things start becoming more specific to what your application actually does.
Imagine an API-based application.
Infrastructure metrics might tell you that the server is healthy.
CPU is at 45%.
Memory is at 60%.
Disk has plenty of free space.
Everything looks fine.
But users are complaining that the application is slow.
This is where application monitoring becomes important.
You may need to look at:
- Request rate
- Application latency
- Error rate
- HTTP response codes
- Slow transactions
- Dependency calls
- Application exceptions
- Database calls
- External API calls
For an application, infrastructure health doesn’t necessarily mean application health.
You could have a perfectly healthy server running an application that is returning errors or taking five seconds to respond.
This is where APM and tracing can provide additional context.
For example, an APM trace might show that an API request is spending most of its time waiting for a database query.
Now the investigation can move from:
“The application is slow.”
to:
“The application is slow because this database operation is taking four seconds.”
That is much more useful information.
Database Monitoring
Databases deserve their own monitoring strategy.
A database can look healthy from an infrastructure perspective while still causing serious problems for an application.
For example, CPU on the database server might be perfectly normal, but a particular query could suddenly start taking much longer than usual.
Depending on the database and the monitoring platform you use, you may want visibility into things such as:
- Query performance
- Slow queries
- Query execution time
- Database connections
- Connection pool usage
- Locks
- Deadlocks
- Transactions
- Cache performance
- Replication health
- Storage
- CPU and memory
- Database errors
This is also where having the appropriate database integration becomes important.
A generic infrastructure agent can tell you that a database server is using 70% CPU.
But database monitoring can give you much more useful information about what the database is actually doing.
For example, you might discover that one query is responsible for a significant amount of database load.
You can then correlate that information with APM or traces and see which application request is triggering the query.
This gives you a much better picture of what is actually happening.
You Don’t Always Need Everything
This is probably the most important point.
When you integrate a platform such as AWS, Azure, VMware or a database with your monitoring platform, you may suddenly have access to hundreds or thousands of metrics.
That doesn’t mean you need all of them.
You need to understand what you are trying to monitor and then select the signals that help you answer that question.
For example:
Infrastructure
CPU, memory, disk, network and availability.
Application
Latency, request rate, errors, response codes and application exceptions.
Database
Query performance, connections, locks, transactions and database health.
Serverless
Invocation count, duration, errors, throttling and application-level telemetry.
The exact list will change depending on the architecture.
So, How Many Metrics Are Enough?
There isn’t a magic number.
It depends on what you are monitoring.
A small application running on a couple of virtual machines will have very different monitoring requirements from a large distributed application running across multiple cloud services and databases.
The goal shouldn’t be to collect every metric that your monitoring platform makes available.
Instead, start with your application and infrastructure.
Understand what can fail.
Understand what can degrade.
Know what affects your users.
Then select the metrics and telemetry that help you detect those conditions and investigate them.
You might end up with ten important metrics.
You might end up with a hundred.
The number itself isn’t the important part.
The important part is whether those metrics help you understand what is happening.
Key Takeaways
- Having access to thousands of metrics doesn’t mean you need to monitor all of them.
- Monitoring requirements depend heavily on your application architecture and infrastructure.
- Infrastructure monitoring and application monitoring answer different questions.
- Database monitoring often requires specific integrations to provide useful query and database-level visibility.
- Serverless applications may require more focus on application telemetry because the underlying infrastructure is managed by the cloud provider.
- Metrics should have a purpose and ideally help you make a decision or investigate a problem.
- Correlating multiple signals can provide much more context than looking at individual metrics.
- There is no universal number of metrics that every environment should monitor.