@rio-cloud/cdk-v2-constructs 1.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/.gitattributes +15 -0
  2. package/.jsii +7832 -0
  3. package/.versionrc.json +14 -0
  4. package/API.md +8136 -0
  5. package/CHANGELOG.md +5 -0
  6. package/LICENSE +202 -0
  7. package/README.md +56 -0
  8. package/lib/datadog/datadogLogIndexMonitoring.d.ts +49 -0
  9. package/lib/datadog/datadogLogIndexMonitoring.js +116 -0
  10. package/lib/datadog/datadogMonitor.d.ts +13 -0
  11. package/lib/datadog/datadogMonitor.js +19 -0
  12. package/lib/datadog/index.d.ts +1 -0
  13. package/lib/datadog/index.js +19 -0
  14. package/lib/fargate/datadog.d.ts +18 -0
  15. package/lib/fargate/datadog.js +225 -0
  16. package/lib/fargate/rio-fargate-service.d.ts +276 -0
  17. package/lib/fargate/rio-fargate-service.js +147 -0
  18. package/lib/fargate/spring.d.ts +6 -0
  19. package/lib/fargate/spring.js +39 -0
  20. package/lib/index.d.ts +21 -0
  21. package/lib/index.js +34 -0
  22. package/lib/kafka/index.d.ts +2 -0
  23. package/lib/kafka/index.js +15 -0
  24. package/lib/kafka/kafka-event-spec.d.ts +43 -0
  25. package/lib/kafka/kafka-event-spec.js +106 -0
  26. package/lib/kafka/kafka-topic.d.ts +102 -0
  27. package/lib/kafka/kafka-topic.js +70 -0
  28. package/lib/pipeline/rio-backup-secrets-restore-stage.d.ts +40 -0
  29. package/lib/pipeline/rio-backup-secrets-restore-stage.js +104 -0
  30. package/lib/pipeline/rio-bitbucket-source-action.d.ts +25 -0
  31. package/lib/pipeline/rio-bitbucket-source-action.js +36 -0
  32. package/lib/rio-claidometer.d.ts +21 -0
  33. package/lib/rio-claidometer.js +39 -0
  34. package/lib/rio-landing-zone.d.ts +16 -0
  35. package/lib/rio-landing-zone.js +57 -0
  36. package/lib/rio-load-balancer.d.ts +26 -0
  37. package/lib/rio-load-balancer.js +42 -0
  38. package/lib/toggle.d.ts +21 -0
  39. package/lib/toggle.js +44 -0
  40. package/lib/watchful/alb.d.ts +47 -0
  41. package/lib/watchful/alb.js +52 -0
  42. package/lib/watchful/aspect.d.ts +16 -0
  43. package/lib/watchful/aspect.js +55 -0
  44. package/lib/watchful/cloudfront.d.ts +50 -0
  45. package/lib/watchful/cloudfront.js +65 -0
  46. package/lib/watchful/datadog-log-alarm.d.ts +37 -0
  47. package/lib/watchful/datadog-log-alarm.js +88 -0
  48. package/lib/watchful/datadog-metric-alarm.d.ts +32 -0
  49. package/lib/watchful/datadog-metric-alarm.js +158 -0
  50. package/lib/watchful/docdb.d.ts +62 -0
  51. package/lib/watchful/docdb.js +102 -0
  52. package/lib/watchful/dynamodb.d.ts +69 -0
  53. package/lib/watchful/dynamodb.js +87 -0
  54. package/lib/watchful/ecs.d.ts +50 -0
  55. package/lib/watchful/ecs.js +69 -0
  56. package/lib/watchful/lambda.d.ts +59 -0
  57. package/lib/watchful/lambda.js +65 -0
  58. package/lib/watchful/metric-alarm.d.ts +34 -0
  59. package/lib/watchful/metric-alarm.js +3 -0
  60. package/lib/watchful/rds.d.ts +47 -0
  61. package/lib/watchful/rds.js +47 -0
  62. package/lib/watchful/targetgroup.d.ts +47 -0
  63. package/lib/watchful/targetgroup.js +54 -0
  64. package/lib/watchful/upperToLower.d.ts +7 -0
  65. package/lib/watchful/upperToLower.js +35 -0
  66. package/lib/watchful/watchful.d.ts +119 -0
  67. package/lib/watchful/watchful.js +182 -0
  68. package/node_modules/argparse/CHANGELOG.md +216 -0
  69. package/node_modules/argparse/LICENSE +254 -0
  70. package/node_modules/argparse/README.md +84 -0
  71. package/node_modules/argparse/argparse.js +3707 -0
  72. package/node_modules/argparse/lib/sub.js +67 -0
  73. package/node_modules/argparse/lib/textwrap.js +440 -0
  74. package/node_modules/argparse/package.json +31 -0
  75. package/node_modules/js-yaml/CHANGELOG.md +616 -0
  76. package/node_modules/js-yaml/LICENSE +21 -0
  77. package/node_modules/js-yaml/README.md +246 -0
  78. package/node_modules/js-yaml/bin/js-yaml.js +126 -0
  79. package/node_modules/js-yaml/dist/js-yaml.js +3874 -0
  80. package/node_modules/js-yaml/dist/js-yaml.min.js +2 -0
  81. package/node_modules/js-yaml/dist/js-yaml.mjs +3851 -0
  82. package/node_modules/js-yaml/index.js +47 -0
  83. package/node_modules/js-yaml/lib/common.js +59 -0
  84. package/node_modules/js-yaml/lib/dumper.js +965 -0
  85. package/node_modules/js-yaml/lib/exception.js +55 -0
  86. package/node_modules/js-yaml/lib/loader.js +1727 -0
  87. package/node_modules/js-yaml/lib/schema/core.js +11 -0
  88. package/node_modules/js-yaml/lib/schema/default.js +22 -0
  89. package/node_modules/js-yaml/lib/schema/failsafe.js +17 -0
  90. package/node_modules/js-yaml/lib/schema/json.js +19 -0
  91. package/node_modules/js-yaml/lib/schema.js +121 -0
  92. package/node_modules/js-yaml/lib/snippet.js +101 -0
  93. package/node_modules/js-yaml/lib/type/binary.js +125 -0
  94. package/node_modules/js-yaml/lib/type/bool.js +35 -0
  95. package/node_modules/js-yaml/lib/type/float.js +97 -0
  96. package/node_modules/js-yaml/lib/type/int.js +156 -0
  97. package/node_modules/js-yaml/lib/type/map.js +8 -0
  98. package/node_modules/js-yaml/lib/type/merge.js +12 -0
  99. package/node_modules/js-yaml/lib/type/null.js +35 -0
  100. package/node_modules/js-yaml/lib/type/omap.js +44 -0
  101. package/node_modules/js-yaml/lib/type/pairs.js +53 -0
  102. package/node_modules/js-yaml/lib/type/seq.js +8 -0
  103. package/node_modules/js-yaml/lib/type/set.js +29 -0
  104. package/node_modules/js-yaml/lib/type/str.js +8 -0
  105. package/node_modules/js-yaml/lib/type/timestamp.js +88 -0
  106. package/node_modules/js-yaml/lib/type.js +66 -0
  107. package/node_modules/js-yaml/package.json +66 -0
  108. package/package.json +126 -0
  109. package/release-commit-check.js +6 -0
  110. package/version.json +3 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### [1.0.1-alpha.0](https://collaboration.msi.audi.com/stash/projects/RIODEV/repos/cdk-v2-constructs/compare/commits?targetBranch=refs%2Ftags%2Fv0.10.63&sourceBranch=refs%2Ftags%2Fv1.0.1-alpha.0) (2022-04-06)
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # RIO CDK Constructs
2
+
3
+ This package contains CDK constructs RIO teams.
4
+
5
+ > NPM: `@rio-cloud/cdk-v2-constructs`
6
+
7
+ ## CDK Bootstrapping
8
+
9
+ ```
10
+ $ cdk init --language typescript
11
+ ```
12
+
13
+ ## Installing
14
+
15
+ ```
16
+ $ npm install --save @rio-cloud/cdk-v2-constructs
17
+ ```
18
+
19
+ ## Constructs
20
+
21
+ See [./API.md](API.md) for a list of constructs
22
+
23
+ ## Open issues
24
+
25
+ - DataDog: Use DataDog.jar inside Docker image for profiling (using AWS Artifacts?)
26
+ - Add vulnerability and license-check actions
27
+ - Get self-signed certificate for LB<->Service communication
28
+
29
+ - DataDog: Provide aspect to use lambda extensions to send logs to DataDog
30
+ - Introduce immutable tags to RioEcrRepo (waits for https://github.com/aws/aws-cdk/pull/10557))
31
+ - Replace custom synth action with standard one, once [CDK #12061](https://github.com/aws/aws-cdk/issues/12061) is fixed
32
+
33
+ - Have custom resource to create BitBucket repo and webhook automatically
34
+ - Send container image scan results to OpsGenie
35
+ - Check for security requirements (s3 buckets, ...) - maybe automated as aspect?
36
+ - RDS: Provide RIO-style Aurora
37
+ - Backup: Provide aspect to add automatically backup tags
38
+ - Send build status back to BitBucket (see cdk-codepipeline-bitbucket-build-result-reporter)
39
+ - Support PR builds (using StepFunctions?)
40
+ - Move this library to AWS CodeArtifact
41
+
42
+ ## Developing CDK libraries
43
+
44
+ Provide commit messages according to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). This library uses [standard-version](https://github.com/conventional-changelog/standard-version) to generate the changelog and publish a new version.
45
+ Example commit message:
46
+ ```shell
47
+ fix(watchful): :bug: removing toggle rioclaid-1857-datadog-threshold; removed threshold
48
+ rioclaid-1857
49
+ ```
50
+
51
+ ## Releasing a new version
52
+
53
+ Make sure that the parameter store `/config/npm/token` having the npm token to publish is added before releasing.
54
+
55
+ 1. Create locally a new release by running `npm run release`. (e.g. `npm run release -- --release-as minor`)
56
+ 2. Check the generated `CHANGELOG.md` file and adjust thing when necessary
@@ -0,0 +1,49 @@
1
+ import { Construct } from 'constructs';
2
+ import { DatadogAlertType } from './datadogMonitor';
3
+ export interface DatadogLogIndexMonitoringProps {
4
+ /**
5
+ * The name of your service in Datadog. Can be used to query the monitors.
6
+ */
7
+ readonly serviceName: string;
8
+ /**
9
+ * The name of the Datadog index.
10
+ */
11
+ readonly indexName: string;
12
+ /**
13
+ * The integration to use for alerting.
14
+ * For OpsGenie, you need to install and configure the 'opsgenie-integration' account module.
15
+ */
16
+ readonly alertType: DatadogAlertType;
17
+ /**
18
+ * The daily log quota settings.
19
+ */
20
+ readonly dailyLogQuota: DatadogLogQuotaProps;
21
+ }
22
+ export interface DatadogLogQuotaProps {
23
+ /**
24
+ * The daily log quota for the team-specific index in million events.
25
+ */
26
+ readonly valueInMillionEvents: number;
27
+ /**
28
+ * The warning threshold for the daily log quota monitor in percent.
29
+ */
30
+ readonly warningThresholdInPercent: number;
31
+ /**
32
+ * The alarm threshold for the daily log quota monitor in percent.
33
+ * The value must be between 0 and 100 and greater than or equal to the warning threshold.
34
+ */
35
+ readonly alertThresholdInPercent: number;
36
+ }
37
+ /**
38
+ * Basic monitoring and alerting for a Datadog logs index.
39
+ * It follows the Datadog guide at https://docs.datadoghq.com/logs/guide/logs-monitors-on-volumes/
40
+ * and consists of the following three monitors.
41
+ * 1. A metric alert that fires when you reach a certain threshold of your daily log quota.
42
+ * 2. An anomaly monitor that detects log amount spikes.
43
+ * 3. An event alert that fires when you hit the daily log quota.
44
+ *
45
+ * A datadog log index is team specific and thus the monitor needs to be deployed just once per index/team.
46
+ */
47
+ export declare class DatadogLogIndexMonitoring extends Construct {
48
+ constructor(scope: Construct, id: string, props: DatadogLogIndexMonitoringProps);
49
+ }
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DatadogLogIndexMonitoring = void 0;
5
+ const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
6
+ const constructs_1 = require("constructs");
7
+ const datadogMonitor_1 = require("./datadogMonitor");
8
+ /**
9
+ * Basic monitoring and alerting for a Datadog logs index.
10
+ * It follows the Datadog guide at https://docs.datadoghq.com/logs/guide/logs-monitors-on-volumes/
11
+ * and consists of the following three monitors.
12
+ * 1. A metric alert that fires when you reach a certain threshold of your daily log quota.
13
+ * 2. An anomaly monitor that detects log amount spikes.
14
+ * 3. An event alert that fires when you hit the daily log quota.
15
+ *
16
+ * A datadog log index is team specific and thus the monitor needs to be deployed just once per index/team.
17
+ */
18
+ class DatadogLogIndexMonitoring extends constructs_1.Construct {
19
+ constructor(scope, id, props) {
20
+ super(scope, id);
21
+ new DatadogLogDailyQuotaMonitor(this, 'DatadogLogDailyQuotaMonitor', props);
22
+ new DatadogLogsAnomalyMonitor(this, 'DatadogLogAlertAnomalyMonitor', props);
23
+ new DatadogLogDailyQuotaReachedMonitor(this, 'DatadogLogDailyQuotaReachedMonitor', props);
24
+ this.node.addValidation({
25
+ validate: () => {
26
+ const result = [];
27
+ if (props.dailyLogQuota.warningThresholdInPercent < 0 || props.dailyLogQuota.warningThresholdInPercent > 100) {
28
+ result.push('Invalid [warningThresholdInPercent]: expecting a number between 0 and 100');
29
+ }
30
+ if (props.dailyLogQuota.alertThresholdInPercent < 0 || props.dailyLogQuota.alertThresholdInPercent > 100) {
31
+ result.push('Invalid [alertThresholdInPercent]: expecting a number between 0 and 100');
32
+ }
33
+ if (props.dailyLogQuota.alertThresholdInPercent < props.dailyLogQuota.warningThresholdInPercent) {
34
+ result.push('Invalid [alertThresholdInPercent]: must be greater than or equal to [warningThresholdInPercent]');
35
+ }
36
+ return result;
37
+ },
38
+ });
39
+ }
40
+ }
41
+ exports.DatadogLogIndexMonitoring = DatadogLogIndexMonitoring;
42
+ _a = JSII_RTTI_SYMBOL_1;
43
+ DatadogLogIndexMonitoring[_a] = { fqn: "@rio-cloud/cdk-v2-constructs.DatadogLogIndexMonitoring", version: "0.0.0" };
44
+ class DatadogLogDailyQuotaMonitor extends datadogMonitor_1.DatadogMonitor {
45
+ constructor(scope, id, props) {
46
+ const logQuotaInEvents = Math.floor(props.dailyLogQuota.valueInMillionEvents * 1000000);
47
+ const warningThreshold = Math.floor(logQuotaInEvents * (props.dailyLogQuota.warningThresholdInPercent / 100));
48
+ const alertThreshold = Math.floor(logQuotaInEvents * (props.dailyLogQuota.alertThresholdInPercent / 100));
49
+ super(scope, id, {
50
+ serviceName: props.serviceName,
51
+ alertTypes: [props.alertType],
52
+ monitor: {
53
+ name: 'Log quota almost reached',
54
+ type: 'metric alert',
55
+ query: `sum(last_5m):sum:datadog.estimated_usage.logs.ingested_events{datadog_is_excluded:false,datadog_index:${props.indexName}}.as_count().rollup(sum, 86400) >= ${alertThreshold}`,
56
+ message: `[P3] Inspect your log volume at ${datadogLogsSearchWithIndexFilterDeepLink(props.indexName)} or adapt the log quota at ${datadogLogsIndexesConfigurationDeepLink}`,
57
+ options: {
58
+ thresholds: {
59
+ critical: alertThreshold,
60
+ warning: warningThreshold,
61
+ },
62
+ include_tags: false,
63
+ notify_no_data: true,
64
+ no_data_timeframe: 24 * 60,
65
+ },
66
+ },
67
+ });
68
+ }
69
+ }
70
+ class DatadogLogsAnomalyMonitor extends datadogMonitor_1.DatadogMonitor {
71
+ constructor(scope, id, props) {
72
+ super(scope, id, {
73
+ serviceName: props.serviceName,
74
+ alertTypes: [props.alertType],
75
+ monitor: {
76
+ name: 'Log amount is rising to unexpected levels',
77
+ type: 'metric alert',
78
+ query: `avg(last_4h):anomalies(sum:datadog.estimated_usage.logs.ingested_events{datadog_is_excluded:false,datadog_index:${props.indexName}}.as_count(), 'robust', 2, direction='above', alert_window='last_15m', interval=60, count_default_zero='true', seasonality='weekly', timezone='europe/berlin') >= 1`,
79
+ message: `[P4] Logs are getting out of control: ${datadogLogsSearchWithIndexFilterDeepLink(props.indexName)}`,
80
+ options: {
81
+ include_tags: false,
82
+ notify_no_data: true,
83
+ threshold_windows: {
84
+ trigger_window: 'last_15m',
85
+ recovery_window: 'last_15m',
86
+ },
87
+ },
88
+ },
89
+ });
90
+ }
91
+ }
92
+ class DatadogLogDailyQuotaReachedMonitor extends datadogMonitor_1.DatadogMonitor {
93
+ constructor(scope, id, props) {
94
+ super(scope, id, {
95
+ serviceName: props.serviceName,
96
+ alertTypes: [props.alertType],
97
+ monitor: {
98
+ name: 'Log quota reached',
99
+ type: 'event alert',
100
+ query: `events('tags:datadog_index:${props.indexName} priority:all Daily quota reached sources:datadog').rollup('count').last('5m') > 0`,
101
+ message: `[P2] The log quote for the index has been reached. If you do not increase the quota at ${datadogLogsIndexesConfigurationDeepLink}, no new logs will be indexed until the quota is reset at 2:00pm UTC.`,
102
+ options: {
103
+ timeout_h: 24,
104
+ thresholds: {
105
+ critical: 0,
106
+ },
107
+ },
108
+ },
109
+ });
110
+ }
111
+ }
112
+ function datadogLogsSearchWithIndexFilterDeepLink(indexName) {
113
+ return `https://app.datadoghq.eu/logs?index=${indexName}`;
114
+ }
115
+ const datadogLogsIndexesConfigurationDeepLink = 'https://app.datadoghq.eu/logs/pipelines/indexes';
116
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YWRvZ0xvZ0luZGV4TW9uaXRvcmluZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3N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pbHkgcXVvdGEgcmVhY2hlZCBzb3VyY2VzOmRhdGFkb2cnKS5yb2xsdXAoJ2NvdW50JykubGFzdCgnNW0nKSA+IDBgLFxuICAgICAgICBtZXNzYWdlOiBgW1AyXSBUaGUgbG9nIHF1b3RlIGZvciB0aGUgaW5kZXggaGFzIGJlZW4gcmVhY2hlZC4gSWYgeW91IGRvIG5vdCBpbmNyZWFzZSB0aGUgcXVvdGEgYXQgJHtkYXRhZG9nTG9nc0luZGV4ZXNDb25maWd1cmF0aW9uRGVlcExpbmt9LCBubyBuZXcgbG9ncyB3aWxsIGJlIGluZGV4ZWQgdW50aWwgdGhlIHF1b3RhIGlzIHJlc2V0IGF0IDI6MDBwbSBVVEMuYCxcbiAgICAgICAgb3B0aW9uczoge1xuICAgICAgICAgIHRpbWVvdXRfaDogMjQsXG4gICAgICAgICAgdGhyZXNob2xkczoge1xuICAgICAgICAgICAgY3JpdGljYWw6IDAsXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgfSk7XG4gIH1cbn1cblxuZnVuY3Rpb24gZGF0YWRvZ0xvZ3NTZWFyY2hXaXRoSW5kZXhGaWx0ZXJEZWVwTGluayhpbmRleE5hbWU6IHN0cmluZykge1xuICByZXR1cm4gYGh0dHBzOi8vYXBwLmRhdGFkb2docS5ldS9sb2dzP2luZGV4PSR7aW5kZXhOYW1lfWA7XG59XG5cbmNvbnN0IGRhdGFkb2dMb2dzSW5kZXhlc0NvbmZpZ3VyYXRpb25EZWVwTGluayA9ICdodHRwczovL2FwcC5kYXRhZG9naHEuZXUvbG9ncy9waXBlbGluZXMvaW5kZXhlcyc7XG4iXX0=
@@ -0,0 +1,13 @@
1
+ import { Construct } from 'constructs';
2
+ export declare type DatadogAlertType = 'opsgenie' | 'slack';
3
+ export interface DatadogMonitorProps {
4
+ serviceName: string;
5
+ alertTypes?: DatadogAlertType[];
6
+ autoCloseOpsGenieAlerts?: boolean;
7
+ monitor: {
8
+ [key: string]: any;
9
+ };
10
+ }
11
+ export declare class DatadogMonitor {
12
+ constructor(stack: Construct, id: string, props: DatadogMonitorProps);
13
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DatadogMonitor = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ class DatadogMonitor {
6
+ constructor(stack, id, props) {
7
+ const monitor = new aws_cdk_lib_1.aws_cloudformation.CfnCustomResource(stack, id, {
8
+ serviceToken: aws_cdk_lib_1.Fn.importValue('custom-resource-datadog-monitor-function-arn'),
9
+ });
10
+ monitor.addPropertyOverride('ServiceName', props.serviceName);
11
+ monitor.addPropertyOverride('AlertTypes', props.alertTypes);
12
+ if (props.autoCloseOpsGenieAlerts !== undefined) {
13
+ monitor.addPropertyOverride('AutoCloseOpsGenieAlerts', props.autoCloseOpsGenieAlerts);
14
+ }
15
+ monitor.addPropertyOverride('Monitor', props.monitor);
16
+ }
17
+ }
18
+ exports.DatadogMonitor = DatadogMonitor;
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YWRvZ01vbml0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGF0YWRvZy9kYXRhZG9nTW9uaXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2Q0FBcUQ7QUFZckQsTUFBYSxjQUFjO0lBQ3pCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBMEI7UUFDbEUsTUFBTSxPQUFPLEdBQUcsSUFBSSxnQ0FBa0IsQ0FBQyxpQkFBaUIsQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFO1lBQ2xFLFlBQVksRUFBRSxnQkFBRSxDQUFDLFdBQVcsQ0FBQyw4Q0FBOEMsQ0FBQztTQUM3RSxDQUFDLENBQUM7UUFDSCxPQUFPLENBQUMsbUJBQW1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ybWF0aW9uLkNmbkN1c3RvbVJlc291cmNlKHN0YWNrLCBpZCwge1xuICAgICAgc2VydmljZVRva2VuOiBGbi5pbXBvcnRWYWx1ZSgnY3VzdG9tLXJlc291cmNlLWRhdGFkb2ctbW9uaXRvci1mdW5jdGlvbi1hcm4nKSxcbiAgICB9KTtcbiAgICBtb25pdG9yLmFkZFByb3BlcnR5T3ZlcnJpZGUoJ1NlcnZpY2VOYW1lJywgcHJvcHMuc2VydmljZU5hbWUpO1xuICAgIG1vbml0b3IuYWRkUHJvcGVydHlPdmVycmlkZSgnQWxlcnRUeXBlcycsIHByb3BzLmFsZXJ0VHlwZXMpO1xuICAgIGlmIChwcm9wcy5hdXRvQ2xvc2VPcHNHZW5pZUFsZXJ0cyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICBtb25pdG9yLmFkZFByb3BlcnR5T3ZlcnJpZGUoJ0F1dG9DbG9zZU9wc0dlbmllQWxlcnRzJywgcHJvcHMuYXV0b0Nsb3NlT3BzR2VuaWVBbGVydHMpO1xuICAgIH1cbiAgICBtb25pdG9yLmFkZFByb3BlcnR5T3ZlcnJpZGUoJ01vbml0b3InLCBwcm9wcy5tb25pdG9yKTtcbiAgfVxufVxuIl19
@@ -0,0 +1 @@
1
+ export * from './datadogLogIndexMonitoring';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // We do not want to export anything from `./datadogMonitor` for the following reasons.
3
+ // - There are already similar abstraction available, e.g., in `datadog-log-alarm.ts` and `datadog-metric-alarm.ts`.
4
+ // - We should discuss a suitable abstraction first before making the API publicly available. At the moment, it is a
5
+ // simple wrapper around the CloudFormation Custom Resource. We usually strive for higher-level constructs or
6
+ // directly use the low-level construct.
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./datadogLogIndexMonitoring"), exports);
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGF0YWRvZy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsdUZBQXVGO0FBQ3ZGLHNIQUFzSDtBQUN0SCxzSEFBc0g7QUFDdEgsaUhBQWlIO0FBQ2pILDRDQUE0Qzs7Ozs7Ozs7Ozs7O0FBRTVDLDhEQUE0QyIsInNvdXJjZXNDb250ZW50IjpbIi8vIFdlIGRvIG5vdCB3YW50IHRvIGV4cG9ydCBhbnl0aGluZyBmcm9tIGAuL2RhdGFkb2dNb25pdG9yYCBmb3IgdGhlIGZvbGxvd2luZyByZWFzb25zLlxuLy8gICAtIFRoZXJlIGFyZSBhbHJlYWR5IHNpbWlsYXIgYWJzdHJhY3Rpb24gYXZhaWxhYmxlLCBlLmcuLCBpbiBgZGF0YWRvZy1sb2ctYWxhcm0udHNgIGFuZCBgZGF0YWRvZy1tZXRyaWMtYWxhcm0udHNgLlxuLy8gICAtIFdlIHNob3VsZCBkaXNjdXNzIGEgc3VpdGFibGUgYWJzdHJhY3Rpb24gZmlyc3QgYmVmb3JlIG1ha2luZyB0aGUgQVBJIHB1YmxpY2x5IGF2YWlsYWJsZS4gQXQgdGhlIG1vbWVudCwgaXQgaXMgYVxuLy8gICAgIHNpbXBsZSB3cmFwcGVyIGFyb3VuZCB0aGUgQ2xvdWRGb3JtYXRpb24gQ3VzdG9tIFJlc291cmNlLiBXZSB1c3VhbGx5IHN0cml2ZSBmb3IgaGlnaGVyLWxldmVsIGNvbnN0cnVjdHMgb3Jcbi8vICAgICBkaXJlY3RseSB1c2UgdGhlIGxvdy1sZXZlbCBjb25zdHJ1Y3QuXG5cbmV4cG9ydCAqIGZyb20gJy4vZGF0YWRvZ0xvZ0luZGV4TW9uaXRvcmluZyc7XG4iXX0=
@@ -0,0 +1,18 @@
1
+ import * as ecs from 'aws-cdk-lib/aws-ecs';
2
+ import * as ssm from 'aws-cdk-lib/aws-ssm';
3
+ import { Construct } from 'constructs';
4
+ import { DataDogLoggingMode, RioFargateService } from './rio-fargate-service';
5
+ export declare class DataDog {
6
+ static getFargateContainerEnvironmentVariables(scope: Construct, stage: string, serviceName: string, version: string, accountName: string, teamName: string): {
7
+ [key: string]: string;
8
+ };
9
+ static getApmServiceMappingEnvironmentVariableValue(serviceName: string): string;
10
+ static getFargateDockerLabels(stage: string, serviceName: string, version: string): {
11
+ [key: string]: string;
12
+ };
13
+ static addDatadogSidecar(scope: Construct, taskDefinition: ecs.TaskDefinition, accountName: string, teamName: string, stage: string, serviceName: string, version: string, datadogApiKeyParameter: ssm.IStringParameter, datadogSite: string, datadogLoggingMode: DataDogLoggingMode, apmGetResourcesToIgnore: string[], cpu: number, memoryLimitMiB: number, essential: boolean, containerTag: string): ecs.ContainerDefinition;
14
+ static getTagsEnvironmentVariableValue(accountId: string, accountName: string, region: string, teamName: string, stage: string, serviceName: string, version: string, containerType: 'service' | 'datadog-sidecar' | 'fluent-bit'): string;
15
+ static addFireLensLogRouter(taskDefinition: ecs.TaskDefinition, cpu: number, memoryLimitMiB: number): ecs.ContainerDefinition;
16
+ static setupLogging(scope: Construct, accountName: string, teamName: string, stage: string, serviceName: string, version: string, datadogApiKeyParameter: ssm.IStringParameter, datadogLoggingMode: DataDogLoggingMode, datadogSite: string, containerType: 'service' | 'datadog-sidecar'): ecs.LogDriver;
17
+ static ensureLoggingAndMonitoringAreReadyBeforeServiceStarts(rioFargateService: RioFargateService): void;
18
+ }