-
Notifications
You must be signed in to change notification settings - Fork 80
feat(alarm): add support for creating nested composite alarms #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* @param props Customization options for the composite alarm | ||
* @returns Newly created composite alarm | ||
*/ | ||
addCompositeAlarmFromAlarmBases( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the new method should also return an AlarmWithAnnotation
like addAlarm
does for better consistency?
Also not a fan of this method name, but nothing better immediately comes to mind. :\
const alarmBases = [ | ||
...alarms.map((alarm) => alarm.alarm), | ||
...compositeAlarms, | ||
] as AlarmBase[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this cast necessary? I thought CompositeAlarm
was already an AlarmBase
.
@@ -178,7 +192,7 @@ export class MonitoringFacade extends MonitoringScope { | |||
| IDashboardSegment | |||
| IDynamicDashboardSegment | |||
)[]; | |||
protected readonly createdComposites: CompositeAlarm[]; | |||
protected readonly createdComposites: CompositeAlarmWithMetadata[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spitballing here, but I wonder if it'd be possible to have a dummy Monitoring
segment that just acts as a composite alarm factory that the facade delegates to?
Things like createdAlarms()
would "just work" by returning everything, although things like createdCompositeAlarms()
would need to filter first. (That said, I wonder if createdAlarms()
should return created composite alarms too? It may be more intuitive to do so.)
Not sure how weird it is to have a segment that doesn't actually do any widget things though.
Fixes #237
Fixes #618
Fixes #640
This commit adds support for creating nested composite alarms (i.e., including composite alarms within another composite alarm when using
createCompositeAlarmUsingTag
).To avoid breaking the existing API or changing the current logic for how alarms are looked up during composite alarm creation, the feature is gated behind a flag, which is disabled by default.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license