Skip to content
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

added context-free endSubsegment method to AWSXRay class #229

Merged
merged 2 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static Segment beginSegment(String name, TraceID traceId, String parentId
}

/**
* @deprecated Use {@code AWSXray.getGlobalRecorder().beginNoOpSegment() }.
* @deprecated Use {@code AWSXRay.getGlobalRecorder().beginNoOpSegment() }.
*/
@Deprecated
public static Segment beginDummySegment() {
Expand All @@ -124,6 +124,10 @@ public static void endSubsegment() {
globalRecorder.endSubsegment();
}

public static void endSubsegment(@Nullable Subsegment subsegment) {
globalRecorder.endSubsegment(subsegment);
}

@Nullable
public String currentEntityId() {
return globalRecorder.currentEntityId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,13 @@ public void endSegment() {
}

/**
* Ends the provided subsegment. This method doesn't touch context storage.
* Ends the provided subsegment. This method doesn't touch context storage and should be used when ending custom subsegments
* in asynchronous methods or other threads.
*
* @param subsegment
* the subsegment to close.
*/
public void endSubsegment(Subsegment subsegment) {
public void endSubsegment(@Nullable Subsegment subsegment) {
if (subsegment == null) {
logger.debug("No input subsegment to end. No-op.");
return;
Expand Down