GetMetricStatistics
Source:
src/AWS/CloudWatch/GetMetricStatistics.ts
Runtime binding for cloudwatch:GetMetricStatistics — fetch aggregated
datapoints for a single metric (the older single-metric query API;
prefer GetMetricData for metric math or multi-metric queries).
Provide CloudWatch.GetMetricStatisticsHttp on the hosting Lambda
Function to satisfy the requirement.
Querying Metrics
Section titled “Querying Metrics”// init — grants cloudwatch:GetMetricStatisticsconst getMetricStatistics = yield* AWS.CloudWatch.GetMetricStatistics();
// runtimeconst now = yield* Effect.sync(() => Date.now());const result = yield* getMetricStatistics({ Namespace: "MyApp/Payments", MetricName: "PaymentProcessed", StartTime: new Date(now - 3_600_000), EndTime: new Date(now), Period: 60, Statistics: ["Sum"],});const datapoints = result.Datapoints ?? [];