ACloudGuru / serverless-plugin-aws-alerts

A Serverless Framework plugin that creates CloudWatch alarms for functions.
MIT License
531 stars 149 forks source link

Add support for step functions alarms #214

Open bhedia opened 2 years ago

bhedia commented 2 years ago

Feature Proposal

Serverless supports deploying AWS Step Functions, but this plugin does not seem to support adding CW alarms for Step Functions.

When I try to use this plugin to configure alarms for step functions, here's what I get:

serverless.yaml:

custom:
  regionAlias: ${opt:regionAlias, 'uw1'}
  alerts:
    topics:
      alarm:
        topic: arn:aws:sns:#{AWS::Region}:#{AWS::AccountId}:alarm-topic-${self:provider.stage}
    definitions:
      executionsTimedOut:
        namespace: 'AWS/States'
        metric: ExecutionsTimedOut
        threshold: 1
        statistic: Sum
        period: 3600
        evaluationPeriods: 1
        datapointsToAlarm: 1
        comparisonOperator: GreaterThanOrEqualToThreshold
        treatMissingData: missing
    alarms:
      - executionsTimedOut

stepFunctions:
  stateMachines:
    helloWorld:
      alarms:
        - executionsTimedOut
      definition:
        StartAt: SayHelloWorld
        States:
          SayHelloWorld:
            Type: Pass
            End: true

Error: State machine [helloWorld] is malformed. Please check the README for more info. ValidationError: child "alarms" fails because ["alarms" must be an object]

hdinizribeiro commented 1 year ago

For the ones that are looking for including alarms for step functions. The step function plugin already provides it built-in: https://www.serverless.com/plugins/serverless-step-functions#cloudwatch-alarms