-
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 ability to enable/disable the SDK (#26) #119
Conversation
* Disabling the SDK does the following: + Ext module patch methods no longer patch. + Any call to BeginSegment() automatically generates a DummySegment instead and will not be sent to the Daemon, and consequently, since DummySegments are generated, any generated subsegments automatically become DummySubsegments. + For Lambda, when Subsegments are created, they automatically are converted to DummySubsegments * Disabling/Enabling is done through the configure() method of the recorder. It may also be set through an environment variable "AWS_XRAY_ENABLED".
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.
Default sampler code also need to be changed so it becomes no-op if the SDK is disabled. Right now the middleware code still trigger sampling decisions which creates extra pollers.
Revision 2 Changes: - SDKConfig now built on top of recorder. SDK-level configuration should all be done through SDKConfig. - Renamed the SDK Enable environment variable to AWS_XRAY_SDK_ENABLED - Disabling the SDK now causes LambdaContext to set sampling decision of facade segment to False. Previously, it would force all subsegments to be generated as dummy subsegments. - SDKConfig.set_sdk_enabled(value) method defaults to True and throws an exception if value is not of type boolean.
Second revision added. Changes: |
Third revision added: Changes:
|
Revision 3 Changes: - Removed enable flag from recorder. Now it checks the global SDK configuration to determine if the SDK is disabled. Global SDK configuration no longer modifies the recorder. - Tests modified to reflect change.
Revision 4 Changes: - Refactored multiple modules; instead of import aws_xray_sdk to get the global_sdk_config, direct import using from... import. - Removed unused XRAY_ENABLED_KEY variable from recorder. It wasn't being used. - Added debug log entry to the patcher to inform the customer that patching is disabled when the SDK is disabled.
Fourth Revision Added: Changes:
|
Revision 5 Changes: - Refactored sampler to use "from ... import ..." for the global sdk config module. - global sdk config logs and defaults to true instead of throwing an exception when an invalid parameter is passed into the method.
Fifth revision added: Changes:
|
Added the ability to enable/disable the SDK upon configuration. This prevents application unit tests that originally relied on segments to be generated to no longer throw SegmentNotFound exceptions if a unit test tests a method that relies on a previously generated Segment.
Issue #, if available:
#26
Description of changes:
Testing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.