Commit b07f361
authored
fix: make anomaly detection alarm work on math expression (#426)
Fixes #425
Fixes #340
### Changes
Changes to the implementation of `AnomalyDetectionMathExpression`:
* Fixed an issue where `thresholdMetricId` was assigned the incorrect expression id when multiple math expressions were present in the generated CFN template.
* Modified `returnData` to be true only for the `ANOMALY_DETECTION_BAND` function and its direct dependency, rather than for all of the metrics in `Metrics`.
I haven't come across any internal or external documentation indicating that two `returnData: true` are necessary for anomaly detection. However, after doing some experiments on CFN, this appears to be true.
### Testing
I copied the fix into my own CDK package, with the fix, I was able to deploy my stacks.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_1 parent 465e388 commit b07f361
File tree
2 files changed
+19
-5
lines changed- lib/common/metric
- test/monitoring/custom/__snapshots__
2 files changed
+19
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
41 | 54 | | |
42 | | - | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
| |||
Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments