Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 68d481d

Browse files
authoredNov 15, 2018
feat(aws-elasticloadbalancingv2): add metrics (#1173)
Add `metricsXxx()` methods to construct Metric objects for the metrics exposed by Application and Network Load Balancers. Fixes #853.
1 parent e799699 commit 68d481d

File tree

10 files changed

+841
-15
lines changed

10 files changed

+841
-15
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ coverage
1111
.nyc_output
1212
.LAST_BUILD
1313
*.swp
14+
tsconfig.json

‎CONTRIBUTING.md

+88-14
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ your contributions. Please read it carefully and let us know if it's not up-to-d
1919
into a single commit, so you can use that to frame your scope.
2020
1. Create a commit with the proposed change changes:
2121
* Commit title and message (and PR title and description) must adhere to [conventionalcommits].
22-
* The title must begin with `feat(module): title`, `fix(module): title`,
22+
* The title must begin with `feat(module): title`, `fix(module): title`,
2323
`reactor(module): title` or `chore(module): title`.
2424
* Title should be lowercase.
2525
* No period at the end of the title.
26-
* Commit message should describe _motivation_. Think about your code reviewers and what
27-
information they need in order to understand what you did. If it's a big commit (hopefully not),
26+
* Commit message should describe _motivation_. Think about your code reviewers and what
27+
information they need in order to understand what you did. If it's a big commit (hopefully not),
2828
try to provide some good entry points so it will be easier to follow.
2929
* Commit message should indicate which issues are fixed: `fixes #<issue>` or `closes #<issue>`.
3030
* Shout out to collaborators.
3131
* If not obvious (i.e. from unit tests), describe how you verified that your
3232
change works.
3333
* If this commit includes a breaking change, the commit message must end with a
34-
a single pragraph
34+
a single pragraph
3535
`BREAKING CHANGE: description of what broke and how to achieve this beahvior now`.
3636
2. Push to a fork or to a branch (naming convention: `<user>/<feature-bug-name>`)
3737
3. Submit a Pull Requests on GitHub and assign the PR for a review to the "awslabs/aws-cdk" team.
@@ -50,32 +50,38 @@ your contributions. Please read it carefully and let us know if it's not up-to-d
5050
## Tools
5151

5252
The CDK is a big project, and, at the moment, all of the CDK modules are mastered in a single monolithic
53-
repository (uses [lerna](https://github.com/lerna/lerna)). There are pros and cons to this approach,
53+
repository (uses [lerna](https://github.com/lerna/lerna)). There are pros and cons to this approach,
5454
and it's especially valuable to maintain integrity in the early stage of thr project where things constantly change across the stack. In the future we believe many of these modules will be extracted to their own repositories.
5555

5656
Another complexity is that the CDK is packaged using [jsii](https://github.com/awslabs/jsii) to multiple
5757
programming languages. This means that when a full build is complete, there will be a version of each
5858
module for each supported language.
5959

6060
However, in many cases, you can probably get away with just building a portion of the
61-
project, based on areas that you want to work on.
61+
project, based on areas that you want to work on.
62+
63+
We recommend that you use [Visual Studio Code](https://code.visualstudio.com/) to work on the CDK.
64+
Be sure to install the [tslint extension](https://marketplace.visualstudio.com/items?itemName=eg2.tslint)
65+
for it as well, since we have strict linting rules that will prevent your code from compiling,
66+
but with VSCode and this extension can be automatically fixed for you by hitting `Ctrl-.` when
67+
your cursor is on a red underline.
6268

6369
### Main build scripts
6470

6571
The build process is divided into stages, so you can invoke them as needed:
6672

6773
- __`install.sh`__: installs all external dependencies and symlinks internal dependencies (using `lerna link`).
6874
- __`build.sh`__: runs `npm build` and `npm test` in all modules (in topological order).
69-
- __`pack.sh`__: packages all modules to all supported languages and produces a `dist/` directory
70-
with all the outputs (running this script requires that you installed the [toolchains](#Toolchains)
75+
- __`pack.sh`__: packages all modules to all supported languages and produces a `dist/` directory
76+
with all the outputs (running this script requires that you installed the [toolchains](#Toolchains)
7177
for all target languages on your system).
7278

7379
### Partial build tools
7480

7581
There are also two useful scripts in the `scripts` directory that can help you build part of the repo:
7682

77-
- __`scripts/buildup`__: builds the current module and all of it's dependencies (in topological order).
78-
- __`scripts/builddown`__: builds the current module and all of it's consumers (in topological order).
83+
- __`scripts/buildup`__: builds the current module and all of its dependencies (in topological order).
84+
- __`scripts/builddown`__: builds the current module and all of its consumers (in topological order).
7985

8086
### Useful aliases
8187

@@ -95,7 +101,7 @@ alias lw='lr watch'
95101

96102
### pkglint
97103

98-
The `pkglint` tool "lints" package.json files across the repo according
104+
The `pkglint` tool "lints" package.json files across the repo according
99105
to [rules.ts](tools/pkglint/lib/rules.ts).
100106

101107
To evaluate (and attempt to fix) all package linting issues in the repo, run the following command from the root
@@ -131,7 +137,7 @@ $ ./install.sh
131137
$ ./build.sh
132138
```
133139

134-
If you also wish to package to all languages, make sure you have all the [toolchains](#Toolchains]
140+
If you also wish to package to all languages, make sure you have all the [toolchains](#Toolchains]
135141
and now run:
136142

137143
```
@@ -140,7 +146,7 @@ $ ./pack.sh
140146

141147
### Partial build
142148

143-
In many cases, you don't really need to build the entire project. Say you want to work
149+
In many cases, you don't really need to build the entire project. Say you want to work
144150
on the `@aws-cdk/aws-ec2` module:
145151

146152
```console
@@ -175,7 +181,7 @@ $ nodeunit test/test.*.js
175181

176182
### Build Documentation Only
177183

178-
The CDK documentation source is hosted under [`./docs/src`](./docs/src).
184+
The CDK documentation source is hosted under [`./docs/src`](./docs/src).
179185
Module reference documentation is gathered after build from the `dist/sphinx` directory (generated by jsii from source via the `./pack.sh` script).
180186

181187
To build the docs even if reference docs are not present:
@@ -239,6 +245,74 @@ We use `npm update` to
239245
5. Now, run `./build.sh` again to verify all tests pass.
240246
6. Submit a Pull Request.
241247

248+
### Troubleshooting common issues
249+
250+
Most build issues can be solved by doing a full clean rebuild:
251+
252+
```shell
253+
$ git clean -fqdx .
254+
$ ./build.sh
255+
```
256+
257+
However, this will be time consuming. In this section we'll describe some common issues you may encounter and some more
258+
targeted commands you can run to resolve your issue.
259+
260+
* The compiler is throwing errors on files that I renamed/it's running old tests that I meant to remove/code coverage is
261+
low and I didn't change anything.
262+
263+
If you switch to a branch in which `.ts` files got renamed or deleted, the generated `.js` and `.d.ts` files from the
264+
previous compilation run are still around and may in some cases still be picked up by the compiler or test runners.
265+
266+
Run the following to clear out stale build artifacts:
267+
268+
```shell
269+
$ scripts/clean-stale-files.sh
270+
```
271+
272+
* I added a dependency but it's not being picked up by the build
273+
274+
You need to tell Lerna to update all dependencies:
275+
276+
```shell
277+
$ node_modules/.bin/lerna bootstrap
278+
```
279+
280+
* I added a dependency but it's not being picked up by a `watch` background compilation run.
281+
282+
No it's not. After re-bootstrapping you need to restart the watch command.
283+
284+
* I added a dependency but it's not being picked up by Visual Studio Code (I still get red underlines).
285+
286+
The TypeScript compiler that's running has cached your dependency tree. After re-bootstrapping,
287+
restart the TypeScript compiler.
288+
289+
Hit F1, type `> TypeScript: Restart TS Server`.
290+
291+
* I'm doing refactorings between packages and compile times are killing me/I need to switch between
292+
differently-verionsed branches a lot and rebuilds because of version errors are taking too long.
293+
294+
Our build steps for each package do a couple of things, such as generating code and generating
295+
JSII assemblies. If you've done a full build at least once to generate all source files, you can
296+
do a quicker TypeScript-only rebuild of the entire source tree by doing the following:
297+
298+
```shell
299+
# Only works after at least one full build to generate source files
300+
$ scripts/build-typescript.sh
301+
302+
# Also works to start a project-wide watch compile
303+
$ scripts/build-typescript.sh -w
304+
```
305+
306+
This does not do code generation and it does not do JSII checks and JSII assembly generation. Instead of doing a
307+
package-by-package ordered build, it compiles all `.ts` files in the repository all at once. This takes about the same
308+
time as it does to compile the biggest package all by itself, and on my machine is the difference between a 15
309+
CPU-minute build and a 20 CPU-second build. If you use this methods of recompiling and you want to run the test, you
310+
have to disable the built-in rebuild functionality of `lerna run test`:
311+
312+
```shell
313+
$ CDK_TEST_BUILD=false lr test
314+
```
315+
242316
## Toolchains
243317

244318
If you wish to use `pack.sh` to package the project to all supported languages, you will need the
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.