Skip to content

Commit

Permalink
option to not auto resolve events (#29)
Browse files Browse the repository at this point in the history
* option to not auto resolve events

* mechanism to opt out of autoresolved alerts.  firehose opting out
  • Loading branch information
mark-ship-it authored May 11, 2021
1 parent 86c6b2c commit aac01a8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,16 @@ new Watchful(scope: Construct, id: string, props?: WatchfulProps)
### Methods


#### addAlarm(alarm) <a id="myhelix-cdk-watchful-watchful-addalarm"></a>
#### addAlarm(alarm, autoResolveEvents?) <a id="myhelix-cdk-watchful-watchful-addalarm"></a>



```ts
addAlarm(alarm: Alarm): void
addAlarm(alarm: Alarm, autoResolveEvents?: boolean): void
```

* **alarm** (<code>[Alarm](#aws-cdk-aws-cloudwatch-alarm)</code>) *No description*
* **autoResolveEvents** (<code>boolean</code>) *No description*



Expand Down Expand Up @@ -496,15 +497,16 @@ __Implemented by__: [Watchful](#myhelix-cdk-watchful-watchful)
### Methods


#### addAlarm(alarm) <a id="myhelix-cdk-watchful-iwatchful-addalarm"></a>
#### addAlarm(alarm, autoResolveEvents?) <a id="myhelix-cdk-watchful-iwatchful-addalarm"></a>



```ts
addAlarm(alarm: Alarm): void
addAlarm(alarm: Alarm, autoResolveEvents?: boolean): void
```

* **alarm** (<code>[Alarm](#aws-cdk-aws-cloudwatch-alarm)</code>) *No description*
* **autoResolveEvents** (<code>boolean</code>) *No description*



Expand Down
2 changes: 1 addition & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch';

export interface IWatchful {
addSection(title: string, options?: SectionOptions): void;
addAlarm(alarm: cloudwatch.Alarm): void;
addAlarm(alarm: cloudwatch.Alarm, autoResolveEvents?: boolean): void;
addWidgets(...widgets: cloudwatch.IWidget[]): void;
}

Expand Down
2 changes: 1 addition & 1 deletion src/firehose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class WatchFirehoseService extends cdk.Construct {
evaluationPeriods: 1,
treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING,
});
this.watchful.addAlarm(deliveryToRedshiftSuccessAlarm);
this.watchful.addAlarm(deliveryToRedshiftSuccessAlarm, false);
return { deliveryToRedshiftSuccessMetric, deliveryToRedshiftSuccessAlarm };
}
private createDeliveryToRedshiftRecordsMonitor() {
Expand Down
6 changes: 4 additions & 2 deletions src/watchful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ export class Watchful extends Construct implements IWatchful {
this.dash.addWidgets(...widgets);
}

public addAlarm(alarm: cloudwatch.Alarm) {
public addAlarm(alarm: cloudwatch.Alarm, autoResolveEvents=true) {
if (this.alarmTopic) {
alarm.addAlarmAction(new cloudwatch_actions.SnsAction(this.alarmTopic));
alarm.addOkAction(new cloudwatch_actions.SnsAction(this.alarmTopic));
if (autoResolveEvents) {
alarm.addOkAction(new cloudwatch_actions.SnsAction(this.alarmTopic));
}
}
}

Expand Down

0 comments on commit aac01a8

Please sign in to comment.