-
Notifications
You must be signed in to change notification settings - Fork 70
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
Function createdAlarms doesn't return alarms created with monitorScope #336
Comments
@PatrykMilewski, I'm finding that when I call |
From my experience they are created but not returned |
Looking into this, it seems to be due to the nature of test("ACM", () => {
// GIVEN
const stack = new Stack();
const facade = createDummyMonitoringFacade(stack);
new acm.Certificate(stack, "DummyCertificate", {
domainName: "www.monitoring.cdk",
});
// WHEN
facade.monitorScope(stack, {
...defaultAspectProps,
acm: {
props: {
addDaysToExpiryAlarm: {
Warning: {
minDaysToExpiry: 14,
},
},
},
},
});
// THEN
expect(Template.fromStack(stack)).toMatchSnapshot();
// If this happens before the previous line that synths it, it fails
expect(facade.createdAlarms()).toHaveLength(1);
}); I'm not actually sure if there's a great way to handle that. @ayush987goyal Not sure if you have any ideas? |
I will say this absence of functionality has been very frustrating. I felt like I was going insane. The AlarmActionStrategy pattern appears to be useless as far as I can tell. My work around is to use the same //Workaround to add Alarm actions generated by .monitorScope(...)
public class AlarmActionAspect : DeputyBase, IAspect
{
public void Visit(IConstruct node)
{
if (node is AlarmBase alarmBase)
{
alarmBase.AddAlarmAction(...); //Your alarm action
}
}
}
//Assuming a nested stack scope
var monitoringNestedStack = ...
//Configure Facade
monitoringNestedStack.monitoringFacade
.monitorScope(this, ....);
//Use aspect to add alarm actions
Aspects.Of(monitoringNestedStack).Add(new AlarmActionAspect()); |
Version
3.0.0
Steps and/or minimal code example to reproduce
monitoring.monitorScope(stack, { lambda: { props: <add some alarms here> }}
monitoring.monitorGlueJob( <config> )
monitoring.createdAlarms()
monitoring.monitorGlueJob( <config> )
Expected behavior
All of created alarms should be returned
Actual behavior
It doesn't return alarms created with
monitorScope
functionOther details
No response
The text was updated successfully, but these errors were encountered: