Skip to content

ListMetrics

Source: src/AWS/CloudWatch/ListMetrics.ts

Runtime binding for cloudwatch:ListMetrics — enumerate the metrics visible in the account/region, optionally filtered by namespace, metric name, or dimensions.

Provide CloudWatch.ListMetricsHttp on the hosting Lambda Function to satisfy the requirement.

// init — grants cloudwatch:ListMetrics
const listMetrics = yield* AWS.CloudWatch.ListMetrics();
// runtime
const result = yield* listMetrics({ Namespace: "MyApp/Payments" });
const names = (result.Metrics ?? []).map((metric) => metric.MetricName);