-
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
Respect setParent calls for noop subsegments. #215
Respect setParent calls for noop subsegments. #215
Conversation
public void testLeakedSubsegmentsAreCleanedBetweenInvocations() { | ||
|
||
@SetEnvironmentVariable(key = "_X_AMZN_TRACE_ID", value = TRACE_HEADER_2) | ||
void testNotSampledSetsParentToSubsegment() { |
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.
This is the new test, the rest are refactoring to replace powermock with junit5 extension
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.
Definitely a "side-by-side" instead of inline type of review :)
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.
Just noticed your branch name and 🤣
public void testLeakedSubsegmentsAreCleanedBetweenInvocations() { | ||
|
||
@SetEnvironmentVariable(key = "_X_AMZN_TRACE_ID", value = TRACE_HEADER_2) | ||
void testNotSampledSetsParentToSubsegment() { |
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.
Definitely a "side-by-side" instead of inline type of review :)
@@ -59,55 +58,71 @@ public void setupAWSXRay() { | |||
} | |||
|
|||
@Test | |||
public void testBeginSubsegmentWithNullTraceHeaderEnvironmentVariableResultsInADummySegmentParent() { | |||
testMockContext(TraceHeader.fromString(null), FacadeSegment.class); | |||
void testBeginSubsegmentWithNullTraceHeaderEnvironmentVariableResultsInADummySegmentParent() { |
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 know this is mostly out of scope for the PR, but the name of this test isn't right. The name says we expect a Dummy (no-op) segment whereas what we test for/actually get is a facade segment.
I'm pretty sure contrary to the name of the test always using a facade segment is the behavior we want, and we can have a larger discussion if anyone on team disagrees, but for now renaming the test to avoid future confusion would be nice.
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.
Thanks - yeah good cleanup
public void testBeginSubsegmentWithIncompleteTraceHeaderEnvironmentVariableResultsInADummySegmentParent() { | ||
testMockContext(TraceHeader.fromString("a"), FacadeSegment.class); | ||
@SetEnvironmentVariable(key = "_X_AMZN_TRACE_ID", value = "a") | ||
void testBeginSubsegmentWithIncompleteTraceHeaderEnvironmentVariableResultsInADummySegmentParent() { |
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.
Ditto on renaming
Fixes #213
I mistook that the parent and parent segment are the same. The API is crufty in setting the parent after construction, even though it's a constant, that could be another improvement for a major version.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.