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 external API Gateway in the dashboards #215 #216

Open lucasvieirasilva opened 2 years ago

lucasvieirasilva commented 2 years ago

What did you implement:

Closes #215

This PR adds support for external API Gateway in the dashboards, currently, this plugin uses the stage and service name to build the API gateway name.

When you have an external API Gateway the dashboard widgets for API metrics shows always empty if the API Gateway name is different.

How did you implement it:

To solve this problem I added a new config property named dashboardConfig as a group and a property named apiName and if the value is present use the custom name.

config example:

custom:
  alerts:
    dashboards: true
    dashboardConfig: 
      apiName: 'my-custom-api-gateway-name'

How can we verify it:

I published a version in my personal npm organization with these changes

https://www.npmjs.com/package/@slslv/serverless-plugin-aws-alerts