-
Notifications
You must be signed in to change notification settings - Fork 251
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
[ROAD-756] AWS Lambda support #1334
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will: 1. Pack all relevant Bugsnag packages 2. Install them into any fixtures in `features/fixtures` 3. Build each fixture 4. Tidy up after itself
This stops a ruby backtrace from showing, which can be confusing - the error happened in the 'build-fixtures' script rather than env.rb
Add Maze Runner scaffolding for Lambda tests
This monkey-patches the given client to keep track of the number of in-flight requests and allows waiting until all requests have finished (with a timeout)
This should never cause issues as the ES spec guarantees promises that are resolved/rejected can't be resolved or rejected again, however this is such a small change and is a bit more complete/safe
Create @bugsnag/in-flight internal package
in-flight: track requests when delivery is changed
Our existing plugin-app-duration doesn't report the correct duration for Lambda functions because its 'appStart' is cached between invocations. This means the duration would essentially be the Lambda uptime, rather than the invocation time We now calculate the duration in the wrapped handler, which ensures it's fresh for each invocation
Add new AWS Lambda plugin
Session support for AWS Lambda functions
We can never be 100% sure that a timeout will happen because we need to notify with enough time for the event to be delivered. Therefore this is a best effort with a generous default value (1000ms) that errs on the side of delivering the warning at the cost of possible false positives The default value can be changed by providing "lambdaTimeoutNotifyMs" to createHandler. This is useful in cases where the lambda function is very quick to execute and so can have a very short timeout without necessarily being at risk of timing out If set to "0" we don't bother adding the warning at all. This is largely arbitrary as a value of 0 would never be triggered (because the lambda would timeout at the same time)
Handle promise rejections in AWS Lambda functions
There's no point adding the timeout at all if it's too big as it will never trigger
This is already handled by the 'super' call
Automatically notify when a lambda may timeout
This change prevents multiple sessions from being started if separate plugins both call 'startSession' by making 'resumeSession' do nothing if a session already exists
Avoid starting a session if one already exists
…ests MazeRunner tests for serverless-express
CI doesn't have an up-to-date bundler version, but it's not really worth updating as we have a single pinned dependency (so it's essentially locked even without a lockfile)
Add AWS Lambda tests to CI
|
Minified | Minfied + Gzipped | |
---|---|---|
Before | 40.76 kB |
12.57 kB |
After | 40.85 kB |
12.61 kB |
± | +85 bytes |
+42 bytes |
code coverage diff
Ok | File | Lines | Branches | Functions | Statements |
---|---|---|---|---|---|
✅ | /home/runner/work/bugsnag-js/bugsnag-js/packages/in-flight/src/in-flight.js | 100% (+100%) |
83.33% (+83.33%) |
100% (+100%) |
100% (+100%) |
✅ | /home/runner/work/bugsnag-js/bugsnag-js/packages/plugin-aws-lambda/src/index.js | 94.64% (+94.64%) |
94.29% (+94.29%) |
90.91% (+90.91%) |
94.64% (+94.64%) |
✅ | /home/runner/work/bugsnag-js/bugsnag-js/packages/plugin-aws-lambda/src/lambda-timeout-approaching.js | 100% (+100%) |
100% (+100%) |
100% (+100%) |
100% (+100%) |
🔴 | /home/runner/work/bugsnag-js/bugsnag-js/packages/plugin-browser-session/session.js | 95.24% (-4.76%) |
87.5% (-12.5%) |
100% (+0%) |
95.24% (-4.76%) |
🔴 | /home/runner/work/bugsnag-js/bugsnag-js/packages/plugin-node-unhandled-rejection/unhandled-rejection.js | 92.31% (-7.69%) |
87.5% (-12.5%) |
100% (+0%) |
93.33% (-6.67%) |
🔴 | /home/runner/work/bugsnag-js/bugsnag-js/packages/plugin-server-session/session.js | 75% (-1.09%) |
50% (+0%) |
66.67% (+0%) |
71.15% (-0.85%) |
Total:
Lines | Branches | Functions | Statements |
---|---|---|---|
81.47%(+0.51%) | 70.32%(+0.51%) | 84.01%(+0.47%) | 80.38%(+0.51%) |
This will now strip the version from 'bugsnag-core-7.9.0-alpha.0.tgz' for example
Allow regex to match pre-release version numbers
bengourley
commented
Mar 15, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with UAT. All working as expected 👍
imjoehaines
approved these changes
Mar 15, 2021
Merged
This was referenced Mar 17, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the integration branch for all of the work that has gone into the support for Node.js on AWS Lambda.
I'm creating this PR to cut a prerelease and collect any UAT feedback.