-
Notifications
You must be signed in to change notification settings - Fork 100
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
Oversampling mitigation #354
Conversation
Codecov Report
@@ Coverage Diff @@
## master #354 +/- ##
============================================
+ Coverage 58.30% 58.54% +0.23%
- Complexity 1209 1234 +25
============================================
Files 131 133 +2
Lines 4948 4986 +38
Branches 590 595 +5
============================================
+ Hits 2885 2919 +34
- Misses 1788 1793 +5
+ Partials 275 274 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Sample code in Lambda
Test 1 - This is the JSON sent to lambda
Test 2 - Note the different Sampled value
|
|
||
import com.amazonaws.services.lambda.runtime.events.SQSEvent; | ||
|
||
public final class SQSMessageHelper { |
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.
XRayLambdaSQSMessageHelper? it might be a horrible name.
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.
I think it makes sense to change the package/module name from SQS to lambda. But let's keep the class name concise. This is what they did in the Lambda library where SQSMessage lives.
|
||
tasks.jar { | ||
manifest { | ||
attributes("Automatic-Module-Name" to "com.amazonaws.xray_sqs") |
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.
Module name could be lambda helper since it is help Lambda user, not for sqs instrumentation
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
package com.amazonaws.xray.internal; | ||
|
||
public enum SamplingStrategyOverride { | ||
DISABLED, // Does not override the SamplingStrategy. |
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.
Not quite get why have to use DISABLED.
Can we use existing API, then update the sampled flag in SegmentImpl?
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.
If we are changing the parent's flag (the Lambda Frontend Segment), then will that not cause an issue in multithreading?
|
||
boolean isRecording = (parentSegment.isRecording() && | ||
samplingStrategyOverride == SamplingStrategyOverride.DISABLED) || | ||
samplingStrategyOverride == SamplingStrategyOverride.TRUE; |
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.
When parentSegment.isRecording() == false and samplingStrategyOverride == SamplingStrategyOverride.TRUE, should we create a new subsegment?
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.
Yes. The override to true will ignore any other indicators.
I guess this creates a problem of an orphaned subsegment?
Issue #, if available:
Description of changes:
Oversampling Mitigation and SQS Helper
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.