PERF02-BP02 Collect compute-related metrics
Compute metrics show how hard your resources work and where they stall. Collect them continuously to spot bottlenecks and idle capacity before they affect users or budgets. Right-sizing and scaling decisions depend on these metrics.
Desired outcome:
-
You collect compute metrics continuously in a central system, covering both resource utilization and application behavior.
-
Your metric set goes beyond service defaults to include the signals your workload actually depends on, such as memory use or queue depth.
-
Your metrics carry retention policies that match your operational and cost goals.
-
Your alarms notify the right teams when a metric crosses a threshold, so you respond before users are affected.
Common anti-patterns:
-
Teams search log files by hand to reconstruct what happened instead of tracking metrics over time.
-
Teams rely only on the default metrics their monitoring tool records and miss workload-specific signals.
-
Teams look at metrics only when an incident is already underway.
-
Teams collect metrics but set no alarms, so a threshold breach goes unnoticed until users report it.
-
Teams keep every metric at full resolution forever, driving up storage cost without operational value.
Benefits of establishing this best practice:
-
Performance issues surface early because trends are visible before they become incidents.
-
Right-sizing and scaling decisions rest on measured behavior rather than assumptions.
-
Application performance can be tied back to business requirements, confirming the workload meets its goals.
-
Storage cost stays controlled because retention matches the value of each metric.
Level of risk exposed if this best practice is not established: High
Implementation guidance
Collect two groups of metrics: resource and application. Resource metrics show how busy the infrastructure is: CPU utilization, memory utilization, disk I/O, and network throughput. Application metrics show how the workload serves its purpose: response time, request rate, error rate, and throughput. You need both groups, because a service can show low CPU while response times climb, or run at high CPU while users see no impact.
Default metrics are a starting point. Services publish a baseline set automatically, but some useful signals are not visible from outside the instance. Memory utilization and disk-space consumption require an agent that runs inside the guest operating system. Workload-specific signals such as processing-queue depth never appear in a generic metric set at all.
Retention trades storage cost against the long history you need to investigate rare events or reveal seasonal trends. Set retention per metric: keep detailed data for signals that drive capacity planning or long-term trending, and expire or aggregate the metrics you act on in real time. Set alarms on the metrics that require action, and pair static thresholds with anomaly detection to catch both predictable limits and unexpected deviations.
On AWS,
Amazon CloudWatch provides default compute metrics, custom
metrics, dashboards, and alarms in one place. The
CloudWatch agent collects in-guest signals such as memory and disk
that the hypervisor cannot see. For open standards and
multi-source telemetry, use
AWS Distro for OpenTelemetry
Implementation steps
-
Identify the metrics that matter for your workload: List the resource utilization metrics and the application metrics that reflect how your workload performs, such as response time and throughput. Start from the service defaults, then add the signals your workload depends on. Reference the default metrics for your compute type: Amazon EC2, Amazon ECS, Amazon EKS, and AWS Lambda.
-
Choose a monitoring and observability solution: Select a solution that centralizes collection and supports the metric types you identified. Options include AWS native observability
, AWS Distro for OpenTelemetry , and Amazon Managed Service for Prometheus. -
Define filters and aggregation: Set the aggregation windows and dimensions that make each metric meaningful for your workload. Use CloudWatch Logs metric filters
to derive metrics from log data, and apply consistent naming so metrics correlate across services. -
Set retention policies: Configure retention per metric to match operational and cost goals, keeping detailed history only where you need it. Review the defaults for CloudWatch metrics and CloudWatch Logs before overriding them.
-
Create alarms and notifications: Define alarms on the thresholds that require action, and route notifications to the teams that own the affected resources. Add CloudWatch anomaly detection to catch deviations you did not set an explicit threshold for.
-
Automate agent deployment: Deploy metric and log agents through automation so coverage stays consistent as instances launch and retire. Use AWS Systems Manager automation or the OpenTelemetry Collector
to enroll new resources without manual steps.
Resources
Related best practices:
Related documents:
Related examples: