Skip to content

Conversation

@flochaz
Copy link
Contributor

@flochaz flochaz commented Dec 4, 2020

Cloudwatch Synthetics recently released new NodeJS runtimes (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html).

This PR is adding them and update doc links

Fixes #11870


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Dec 4, 2020

@mergify
Copy link
Contributor

mergify bot commented Dec 4, 2020

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@flochaz flochaz force-pushed the flochaz/updatedCanaryRuntime branch 2 times, most recently from a086868 to 17a7e1d Compare December 4, 2020 08:31
@flochaz flochaz changed the title feat: Update Cloudwatch Synthetics canaries runtime feat(synthetics): Update Cloudwatch Synthetics canaries runtime Dec 4, 2020
@github-actions github-actions bot added the @aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics label Dec 4, 2020
@flochaz flochaz force-pushed the flochaz/updatedCanaryRuntime branch from 17a7e1d to 7c09f34 Compare December 4, 2020 08:37
NetaNir
NetaNir previously requested changes Dec 4, 2020
Copy link
Contributor

@NetaNir NetaNir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments about the Python runtime additions. The Canary module assume the runtime is always Nodejs, and enforce the below:

  1. The Canary code does include node_moduels folder. See synthetics docs: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html
  2. The handler file is named index.handler

Before we introduce Python as runtime we need to address it. Im happy to accept a PR which adds the new node runtime in the meantime

code: synthetics.Code.fromInline('/* Synthetics handler code */'),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually prefer we leave some of the test using other values, as they are valid configuration.
I don't see a reason to change all tests to use the latest version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was mainly because the linter was asking for unit test update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this comment resolve? The linter rule can be exempt. Lets change it back

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that I didn't know it can be exempt. reverting to 2_0

*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_python_selenium.html#CloudWatch_Synthetics_runtimeversion-syn-python-selenium-1.0
*/
public static readonly SYNTHETICS_PYTHON_1_0 = new Runtime('syn-python-selenium-1.0');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this means that synthetics now support non NodeJs lambda functions? If so we need to change how we handle the assets code, which assumes the code is stored in a node_module folder, per synthetics official docs .

This will require a larger code change, Im not sure what is the right API here, we might need separate class for Python runtimes Canaries and Nodejs Canaries.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts?

Copy link
Contributor Author

@flochaz flochaz Dec 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do another PR for Python one if it's ok. I removed python for now.

@NetaNir NetaNir mentioned this pull request Dec 5, 2020
2 tasks
@flochaz flochaz changed the title feat(synthetics): Update Cloudwatch Synthetics canaries runtime feat(synthetics): Update Cloudwatch Synthetics canaries NodeJS runtimes Dec 7, 2020
@mergify mergify bot dismissed NetaNir’s stale review December 7, 2020 08:25

Pull request has been modified.

handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you use SYNTHETICS_NODEJS_2_1 and not SYNTHETICS_NODEJS_2_2 in all code samples? If the answer is "It does not matter" then it shouldn't be changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. my bad , pushed 2_2 in all examples to guide customer towards latest version.

@mergify mergify bot dismissed NetaNir’s stale review December 29, 2020 09:16

Pull request has been modified.

@flochaz
Copy link
Contributor Author

flochaz commented Jan 4, 2021

@NetaNir anything else I missed ?


The Canary code will be executed in a lambda function created by Synthetics on your behalf. The Lambda function includes a custom [runtime](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html) provided by Synthetics. The provided runtime includes a variety of handy tools such as [Puppeteer](https://www.npmjs.com/package/puppeteer-core) and Chromium. The default runtime is `syn-nodejs-2.0`.
The Canary code will be executed in a lambda function created by Synthetics on your behalf. The Lambda function includes a custom [runtime](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html) provided by Synthetics. The provided runtime includes a variety of handy tools such as [Puppeteer](https://www.npmjs.com/package/puppeteer-core) (for nodejs based one) and Chromium.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been removed when the runtime property was made a required property. Can you remove it (instead of fixing it)

Copy link
Contributor Author

@flochaz flochaz Jan 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it, I just mentioned that pupetter is for nodejs runtime only since python one use selenium. But If you prefer I'll keep that for python PR.

NetaNir
NetaNir previously approved these changes Jan 4, 2021
@NetaNir NetaNir added pr-linter/exempt-readme The PR linter will not require README changes pr-linter/exempt-test The PR linter will not require test changes labels Jan 4, 2021
@mergify mergify bot dismissed NetaNir’s stale review January 4, 2021 19:36

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 1e883ae
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jan 7, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 4f6e377 into aws:master Jan 7, 2021
@flochaz flochaz deleted the flochaz/updatedCanaryRuntime branch January 8, 2021 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics pr-linter/exempt-readme The PR linter will not require README changes pr-linter/exempt-test The PR linter will not require test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(synthetics): Add new runtimes

5 participants