import {GraphWidget, IWidget, Metric} from &q...

5/12/2021  •  99 views
import {GraphWidget, IWidget, Metric} from "monocdk/aws-cloudwatch";
import {Duration} from "monocdk";


enum METRIC_NAMESPACE {
AWS_STATES = "AWS/States"
}

const stepFunctionMetricTitles = [
"ExecutionTime",
"ExecutionsSucceeded",
"ExecutionsFailed",
"ExecutionsTimedOut",
"ExecutionThrottled",
"ExecutionsStarted",
"ExecutionsAborted"
];

export function getStepFunctionDashboardWidgets(region:string, accountId:string): IWidget[] {
let widgets: IWidget[] = [];

const stateMachineArn = "arn:aws:states:"+region+":"+accountId+":stateMachine:AWSAnniversaryBillingWorkflow";

stepFunctionMetricTitles.forEach(stepFunctionMetric => {
widgets.push(new GraphWidget({
left: [new Metric({
namespace: METRIC_NAMESPACE.AWS_STATES,
metricName: stepFunctionMetric,
dimensions: {
StateMachineArn: stateMachineArn,
},
period: Duration.minutes(1),
statistic: "Sum",
})]
}))
});

return widgets;
}


https://paste.ac/61CE4ys