A SysOps Administrator is managing a microservices application running on a fleet of Amazon EC2 instances. The fleet size fluctuates dynamically based on demand via an Auto Scaling group. Each instance publishes a custom CloudWatch metric named `RequestLatency` in the namespace `CustomApp` using two dimensions: `InstanceId` and `ServiceName`. The administrator needs to configure a single CloudWatch alarm to alert when the average `RequestLatency` for the service named `InventoryService` exceeds milliseconds across the entire fleet. Which two configurations or actions should the administrator perform to achieve this? (Select TWO.)
- Modify the application code to publish the RequestLatency metric a second time using only the ServiceName dimension, and configure the CloudWatch alarm to monitor this new metric.Cevap
- Configure the CloudWatch alarm using a Metric Insights query: SELECT AVG(RequestLatency) FROM SCHEMA("CustomApp", ServiceName) WHERE ServiceName = 'InventoryService'.Cevap
- CConfigure the CloudWatch alarm to monitor RequestLatency in the CustomApp namespace, specifying the ServiceName dimension as InventoryService and leaving the InstanceId dimension blank.
- DConfigure a CloudWatch Metric Math expression using the SUM function to automatically aggregate RequestLatency across all dynamic InstanceId values.
- EEnable detailed monitoring on all EC2 instances in the Auto Scaling group so that CloudWatch automatically aggregates custom namespace metrics at 1-minute intervals.
Cevap
To monitor the aggregate latency of a custom metric across a dynamic fleet of instances, the administrator should either configure the CloudWatch alarm using a Metric Insights query to aggregate the metrics, or modify the application code to publish the metric a second time without the instance ID dimension.
To alarm on the average latency of a service across a dynamic fleet of instances, the SysOps Administrator must overcome the limitation that CloudWatch does not automatically aggregate custom metrics across dimensions. Modifying the application code to publish the metric with only the ServiceName dimension creates an aggregated metric stream that can be directly alarmed on. Alternatively, using a CloudWatch Metric Insights SQL query allows real-time aggregation over the dynamic InstanceId dimension, outputting a single aggregated time series suitable for an alarm.
Adım Adım Çözüm
Anahtar Kavram
CloudWatch Custom Metric Dimensions and Aggregation