-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add Serverless Framework Support #127
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
haotianw465
reviewed
Feb 9, 2019
chanchiem
force-pushed
the
serverless
branch
from
February 14, 2019 18:48
0411684
to
ba85a75
Compare
chanchiem
added a commit
to chanchiem/aws-xray-sdk-python
that referenced
this pull request
Feb 15, 2019
* Renamed ServerlessContext to ServerlessLambdaContext to be more precise about its purpose. * Instead of explicitly using Context class's put_subsegment/put_segment methods, use LambdaContext's grandparent class to store. LambdaContext's methods are really only used to acquire the FacadeSegment. * Parameters when initializing the mimic segment are now required. * Unit tests added to test these changes.
Revision 2 Added:
|
* Serverless architecture in this case includes one that utilizes Lambda and API Gateway. * A new "Serverless" context is created to give the abstraction of Segments being the toplevel entities but is then converted to a subsegment upon transmission to the data plane. These segments are called MimicSegments. All generated segments have a parent segment that is the FacadeSegment. * Currently supports Flask and Django as middlewares; this has been confirmed to be natively working with Zappa if the application is running under Flask/Django.
* Renamed ServerlessContext to ServerlessLambdaContext to be more precise about its purpose. * Instead of explicitly using Context class's put_subsegment/put_segment methods, use LambdaContext's grandparent class to store. LambdaContext's methods are really only used to acquire the FacadeSegment. * Parameters when initializing the mimic segment are now required. * Unit tests added to test these changes.
chanchiem
force-pushed
the
serverless
branch
from
February 20, 2019 20:35
f2a8e19
to
88bf381
Compare
chrisradek
reviewed
Feb 20, 2019
yogiraj07
reviewed
Feb 20, 2019
* Mimic Segments now perform no-op on segment-only methods. * Added comments to address this contract. * Unit tests to ensure segment-only methods don't add data to the mimic segment. Serialization methods are also tested to ensure this.
Revision 3 added
|
* Revised design; no more serverless context. * Subsegment generated when the middleware adds request * Unit tests to ensure that these subsegments are added on top of the facade segment
Revision 4 Added:
|
chanchiem
commented
Feb 25, 2019
yogiraj07
reviewed
Feb 25, 2019
chrisradek
approved these changes
Feb 25, 2019
* Comment change added for save_origin_trace_header
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.
Added support for the Serverless Framework. This is often used by applications that utilize AWS Lambda as the compute and API Gateway as the endpoint which invokes AWS Lambda. Specifically, works for Flask and Django deployments as well as through the tool Zappa.
Removes the "FacadeSegments cannot be mutated" exception error and generates a subsegment whenever segments are created.
Issue #, if available:
#2
Description of changes:
A new "Serverless" context is created to give the abstraction of Segments being the top level entities but is then converted to a subsegment upon transmission to the data plane. These segments are called MimicSegments and their only purposes is to be treated as a Segment all the way until transmission via the Recorder. All MimicSegments are parented by FacadeSegments.
Currently supports Flask and Django as middlewares; this has been confirmed to be natively working with Zappa if the application is running under Flask/Django.
The middlewares Flask and Django automatically use the ServerlessContext when it is present in a Lambda environment.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.