MetricStream
Source:
src/AWS/CloudWatch/MetricStream.ts
A CloudWatch metric stream — continuously exports CloudWatch metrics to a Kinesis Data Firehose delivery stream (and on to S3, Datadog, etc.).
Creating Metric Streams
Section titled “Creating Metric Streams”Firehose Delivery Stream
const stream = yield* MetricStream("MetricsExport", { FirehoseArn: "arn:aws:firehose:us-east-1:123456789012:deliverystream/example", RoleArn: "arn:aws:iam::123456789012:role/example", OutputFormat: "json",});Stream Only Selected Namespaces
const stream = yield* MetricStream("LambdaMetricsExport", { FirehoseArn: firehose.deliveryStreamArn, RoleArn: role.roleArn, OutputFormat: "json", IncludeFilters: [{ Namespace: "AWS/Lambda" }],});Reading Metric Streams at Runtime
Section titled “Reading Metric Streams at Runtime”// init — bind the stream to the function (see GetMetricStream)const getMetricStream = yield* AWS.CloudWatch.GetMetricStream(stream);
// runtimeconst result = yield* getMetricStream();const state = result.State; // "running" | "stopped"