Package com.amazonaws.xray.entities
Class SubsegmentImpl
- java.lang.Object
-
- com.amazonaws.xray.entities.EntityImpl
-
- com.amazonaws.xray.entities.SubsegmentImpl
-
- All Implemented Interfaces:
Entity
,Subsegment
,java.lang.AutoCloseable
public class SubsegmentImpl extends EntityImpl implements Subsegment
-
-
Field Summary
-
Fields inherited from class com.amazonaws.xray.entities.EntityImpl
mapper, referenceCount, totalSize
-
-
Constructor Summary
Constructors Constructor Description SubsegmentImpl(AWSXRayRecorder creator, java.lang.String name, Segment parentSegment)
SubsegmentImpl(AWSXRayRecorder creator, java.lang.String name, Segment parentSegment, SamplingStrategyOverride samplingStrategyOverride)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addPrecursorId(java.lang.String precursorId)
void
close()
Implements theAutoCloseable
interface.boolean
end()
Ends the subsegment.@Nullable java.lang.String
getNamespace()
Segment
getParentSegment()
java.util.Set<java.lang.String>
getPrecursorIds()
SamplingStrategyOverride
getSamplingStrategyOverride()
Deprecated.TraceID
getTraceId()
boolean
isRecording()
boolean
isSampled()
java.lang.String
prettyStreamSerialize()
Pretty-serializes the subsegment as a standalone String with enough information for the subsegment to be streamed on its own.void
setNamespace(java.lang.String namespace)
void
setParentSegment(Segment parentSegment)
void
setPrecursorIds(java.util.Set<java.lang.String> precursorIds)
void
setSampledFalse()
boolean
shouldPropagate()
Determines if this subsegment should propagate its trace context downstreamjava.lang.String
streamSerialize()
Serializes the subsegment as a standalone String with enough information for the subsegment to be streamed on its own.-
Methods inherited from class com.amazonaws.xray.entities.EntityImpl
addException, addSubsegment, checkAlreadyEmitted, compareAndSetEmitted, decrementReferenceCount, getAnnotations, getAws, getCause, getCreator, getEndTime, getHttp, getId, getMetadata, getName, getParent, getParentId, getReferenceCount, getSql, getStartTime, getSubsegments, getSubsegmentsCopy, getSubsegmentsLock, getTotalSize, incrementReferenceCount, isEmitted, isError, isFault, isInProgress, isThrottle, prettySerialize, putAllAws, putAllHttp, putAllSql, putAnnotation, putAnnotation, putAnnotation, putAws, putHttp, putMetadata, putMetadata, putSql, removeSubsegment, serialize, setAnnotations, setAws, setCreator, setEmitted, setEndTime, setError, setFault, setHttp, setId, setInProgress, setMetadata, setParent, setParentId, setSql, setStartTime, setSubsegmentsLock, setThrottle, setTraceId, validateNotNull
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.amazonaws.xray.entities.Entity
addException, addSubsegment, compareAndSetEmitted, decrementReferenceCount, getAnnotations, getAws, getCause, getCreator, getEndTime, getHttp, getId, getMetadata, getName, getParent, getParentId, getReferenceCount, getSql, getStartTime, getSubsegments, getSubsegmentsCopy, getSubsegmentsLock, getTotalSize, incrementReferenceCount, isEmitted, isError, isFault, isInProgress, isThrottle, prettySerialize, putAllAws, putAllHttp, putAllSql, putAnnotation, putAnnotation, putAnnotation, putAws, putHttp, putMetadata, putMetadata, putSql, removeSubsegment, run, run, serialize, setAnnotations, setAws, setCreator, setEmitted, setEndTime, setError, setFault, setHttp, setId, setInProgress, setMetadata, setParent, setParentId, setSql, setStartTime, setSubsegmentsLock, setThrottle, setTraceId
-
-
-
-
Constructor Detail
-
SubsegmentImpl
public SubsegmentImpl(AWSXRayRecorder creator, java.lang.String name, Segment parentSegment)
-
SubsegmentImpl
@Deprecated public SubsegmentImpl(AWSXRayRecorder creator, java.lang.String name, Segment parentSegment, SamplingStrategyOverride samplingStrategyOverride)
Deprecated.
-
-
Method Detail
-
end
public boolean end()
Description copied from interface:Subsegment
Ends the subsegment. Sets the end time to the current time. Sets inProgress to false. Decrements its parent segment's segment-reference counter.- Specified by:
end
in interfaceSubsegment
- Returns:
- true if 1) the parent segment now has a ref. count of zero and 2) the parent segment is sampled
-
getTraceId
public TraceID getTraceId()
- Specified by:
getTraceId
in interfaceEntity
- Overrides:
getTraceId
in classEntityImpl
- Returns:
- the traceId
-
getNamespace
public @Nullable java.lang.String getNamespace()
- Specified by:
getNamespace
in interfaceEntity
- Specified by:
getNamespace
in interfaceSubsegment
- Overrides:
getNamespace
in classEntityImpl
- Returns:
- the namespace
-
setNamespace
public void setNamespace(java.lang.String namespace)
- Specified by:
setNamespace
in interfaceEntity
- Specified by:
setNamespace
in interfaceSubsegment
- Overrides:
setNamespace
in classEntityImpl
- Parameters:
namespace
- the namespace to set
-
getParentSegment
public Segment getParentSegment()
- Specified by:
getParentSegment
in interfaceEntity
- Specified by:
getParentSegment
in interfaceSubsegment
- Specified by:
getParentSegment
in classEntityImpl
- Returns:
- the parentSegment
-
setParentSegment
public void setParentSegment(Segment parentSegment)
- Specified by:
setParentSegment
in interfaceSubsegment
- Parameters:
parentSegment
- the parentSegment to set
-
addPrecursorId
public void addPrecursorId(java.lang.String precursorId)
- Specified by:
addPrecursorId
in interfaceSubsegment
- Parameters:
precursorId
- the precursor ID to add to the set
-
getPrecursorIds
public java.util.Set<java.lang.String> getPrecursorIds()
- Specified by:
getPrecursorIds
in interfaceSubsegment
- Returns:
- the precursorIds
-
setPrecursorIds
public void setPrecursorIds(java.util.Set<java.lang.String> precursorIds)
- Specified by:
setPrecursorIds
in interfaceSubsegment
- Parameters:
precursorIds
- the precursorIds to set
-
shouldPropagate
public boolean shouldPropagate()
Description copied from interface:Subsegment
Determines if this subsegment should propagate its trace context downstream- Specified by:
shouldPropagate
in interfaceSubsegment
- Returns:
- true if its trace context should be propagated downstream, false otherwise
-
streamSerialize
public java.lang.String streamSerialize()
Description copied from interface:Subsegment
Serializes the subsegment as a standalone String with enough information for the subsegment to be streamed on its own.- Specified by:
streamSerialize
in interfaceSubsegment
- Returns:
- the string representation of the subsegment with enough information for it to be streamed
-
prettyStreamSerialize
public java.lang.String prettyStreamSerialize()
Description copied from interface:Subsegment
Pretty-serializes the subsegment as a standalone String with enough information for the subsegment to be streamed on its own. Only used for debugging.- Specified by:
prettyStreamSerialize
in interfaceSubsegment
- Returns:
- the pretty string representation of the subsegment with enough information for it to be streamed
-
close
public void close()
Description copied from interface:Subsegment
Implements theAutoCloseable
interface. Warning. This method is intended to be private to the xray library and should not be used externally. Instead, useAWSXRay.endSubsegment(Subsegment)
.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceSubsegment
-
isRecording
public boolean isRecording()
- Specified by:
isRecording
in interfaceSubsegment
-
setSampledFalse
public void setSampledFalse()
- Specified by:
setSampledFalse
in interfaceSubsegment
-
getSamplingStrategyOverride
@Deprecated public SamplingStrategyOverride getSamplingStrategyOverride()
Deprecated.- Specified by:
getSamplingStrategyOverride
in interfaceSubsegment
-
-