Package com.amazonaws.xray.entities
Interface Entity
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
Segment,Subsegment
- All Known Implementing Classes:
DummySegment,DummySubsegment,EntityImpl,FacadeSegment,NoOpSegment,SegmentImpl,SubsegmentImpl
public interface Entity extends java.lang.AutoCloseable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidaddException(java.lang.Throwable exception)Adds an exception to the entity's cause and sets fault to true.voidaddSubsegment(Subsegment subsegment)Adds a subsegment.booleancompareAndSetEmitted(boolean current, boolean next)Deprecated.booleandecrementReferenceCount()Decrements the subsegment-reference counter.static java.lang.StringgenerateId()Deprecated.Use theID generatorconfigured on this entity's creator insteadjava.util.Map<java.lang.String,java.lang.Object>getAnnotations()java.util.Map<java.lang.String,java.lang.Object>getAws()CausegetCause()AWSXRayRecordergetCreator()doublegetEndTime()java.util.Map<java.lang.String,java.lang.Object>getHttp()java.lang.StringgetId()java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>getMetadata()java.lang.StringgetName()@Nullable java.lang.StringgetNamespace()EntitygetParent()@Nullable java.lang.StringgetParentId()SegmentgetParentSegment()intgetReferenceCount()Returns the reference count of the segment.java.util.Map<java.lang.String,java.lang.Object>getSql()doublegetStartTime()java.util.List<Subsegment>getSubsegments()Deprecated.UsegetSubsegmentsCopy().java.util.List<Subsegment>getSubsegmentsCopy()Returns a copy of the currently added subsegments.java.util.concurrent.locks.ReentrantLockgetSubsegmentsLock()Deprecated.This is for internal use of the SDK and will be made private.java.util.concurrent.atomic.LongAddergetTotalSize()TraceIDgetTraceId()voidincrementReferenceCount()Increments the subsegment-reference counter.booleanisEmitted()booleanisError()booleanisFault()booleanisInProgress()booleanisSampled()booleanisThrottle()java.lang.StringprettySerialize()voidputAllAws(java.util.Map<java.lang.String,java.lang.Object> all)Puts AWS information.voidputAllHttp(java.util.Map<java.lang.String,java.lang.Object> all)Puts HTTP information.voidputAllSql(java.util.Map<java.lang.String,java.lang.Object> all)Puts SQL information.voidputAnnotation(java.lang.String key, java.lang.Boolean value)Puts a Boolean annotation.voidputAnnotation(java.lang.String key, java.lang.Number value)Puts a Number annotation.voidputAnnotation(java.lang.String key, java.lang.String value)Puts a String annotation.voidputAws(java.lang.String key, java.lang.Object value)Puts AWS information.voidputHttp(java.lang.String key, java.lang.Object value)Puts HTTP information.voidputMetadata(java.lang.String key, java.lang.Object object)Puts metadata under the namespace 'default'.voidputMetadata(java.lang.String namespace, java.lang.String key, java.lang.Object object)Puts metadata.voidputSql(java.lang.String key, java.lang.Object value)Puts SQL information.voidremoveSubsegment(Subsegment subsegment)Removes a subsegment from the subsegment list.default voidrun(java.lang.Runnable runnable)Immediately runs the providedRunnablewith thisSegmentas the current entity.default voidrun(java.lang.Runnable runnable, AWSXRayRecorder recorder)Immediately runs the providedRunnablewith thisSegmentas the current entity.java.lang.Stringserialize()voidsetAnnotations(java.util.Map<java.lang.String,java.lang.Object> annotations)voidsetAws(java.util.Map<java.lang.String,java.lang.Object> aws)voidsetCreator(AWSXRayRecorder creator)voidsetEmitted(boolean emitted)Sets emitted on the entity.voidsetEndTime(double endTime)voidsetError(boolean error)Sets the error value of the entity.voidsetFault(boolean fault)voidsetHttp(java.util.Map<java.lang.String,java.lang.Object> http)voidsetId(java.lang.String id)voidsetInProgress(boolean inProgress)voidsetMetadata(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> metadata)voidsetNamespace(java.lang.String namespace)voidsetParent(Entity parent)voidsetParentId(@Nullable java.lang.String parentId)voidsetSql(java.util.Map<java.lang.String,java.lang.Object> sql)voidsetStartTime(double startTime)voidsetSubsegmentsLock(java.util.concurrent.locks.ReentrantLock subsegmentsLock)Deprecated.This is for internal use of the SDK and will be made privatevoidsetThrottle(boolean throttle)Sets the throttle value.voidsetTraceId(TraceID traceId)
-
-
-
Method Detail
-
generateId
@Deprecated static java.lang.String generateId()
Deprecated.Use theID generatorconfigured on this entity's creator instead
-
run
default void run(java.lang.Runnable runnable)
Immediately runs the providedRunnablewith thisSegmentas the current entity.
-
run
default void run(java.lang.Runnable runnable, AWSXRayRecorder recorder)Immediately runs the providedRunnablewith thisSegmentas the current entity.
-
getName
java.lang.String getName()
-
getId
java.lang.String getId()
- Returns:
- the id
-
setId
void setId(java.lang.String id)
- Parameters:
id- the id to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getStartTime
double getStartTime()
- Returns:
- the startTime
-
setStartTime
void setStartTime(double startTime)
- Parameters:
startTime- the startTime to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getEndTime
double getEndTime()
- Returns:
- the endTime
-
setEndTime
void setEndTime(double endTime)
- Parameters:
endTime- the endTime to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
isFault
boolean isFault()
- Returns:
- the fault
-
setFault
void setFault(boolean fault)
- Parameters:
fault- the fault to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
isError
boolean isError()
- Returns:
- the error
-
setError
void setError(boolean error)
Sets the error value of the entity.- Parameters:
error- the error to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getNamespace
@Nullable java.lang.String getNamespace()
- Returns:
- the namespace
-
setNamespace
void setNamespace(java.lang.String namespace)
- Parameters:
namespace- the namespace to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getSubsegmentsLock
@Deprecated java.util.concurrent.locks.ReentrantLock getSubsegmentsLock()
Deprecated.This is for internal use of the SDK and will be made private.- Returns:
- the subsegmentsLock
-
setSubsegmentsLock
@Deprecated void setSubsegmentsLock(java.util.concurrent.locks.ReentrantLock subsegmentsLock)
Deprecated.This is for internal use of the SDK and will be made private- Parameters:
subsegmentsLock- the subsegmentsLock to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getCause
Cause getCause()
- Returns:
- the cause
-
getHttp
java.util.Map<java.lang.String,java.lang.Object> getHttp()
- Returns:
- the http
-
setHttp
void setHttp(java.util.Map<java.lang.String,java.lang.Object> http)
- Parameters:
http- the http to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getAws
java.util.Map<java.lang.String,java.lang.Object> getAws()
- Returns:
- the aws
-
setAws
void setAws(java.util.Map<java.lang.String,java.lang.Object> aws)
- Parameters:
aws- the aws to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getSql
java.util.Map<java.lang.String,java.lang.Object> getSql()
- Returns:
- the sql
-
setSql
void setSql(java.util.Map<java.lang.String,java.lang.Object> sql)
- Parameters:
sql- the sql to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getMetadata
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getMetadata()
- Returns:
- the metadata
-
setMetadata
void setMetadata(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> metadata)
- Parameters:
metadata- the metadata to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getAnnotations
java.util.Map<java.lang.String,java.lang.Object> getAnnotations()
- Returns:
- the annotations
-
setAnnotations
void setAnnotations(java.util.Map<java.lang.String,java.lang.Object> annotations)
- Parameters:
annotations- the annotations to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getParent
Entity getParent()
- Returns:
- the parent
-
setParent
void setParent(Entity parent)
- Parameters:
parent- the parent to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
isThrottle
boolean isThrottle()
- Returns:
- the throttle
-
setThrottle
void setThrottle(boolean throttle)
Sets the throttle value. When setting to true, error is also set to true and fault set to false.- Parameters:
throttle- the throttle to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
isInProgress
boolean isInProgress()
- Returns:
- the inProgress
-
setInProgress
void setInProgress(boolean inProgress)
- Parameters:
inProgress- the inProgress to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getTraceId
TraceID getTraceId()
- Returns:
- the traceId
-
setTraceId
void setTraceId(TraceID traceId)
- Parameters:
traceId- the traceId to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getParentId
@Nullable java.lang.String getParentId()
- Returns:
- the parentId
-
setParentId
void setParentId(@Nullable java.lang.String parentId)
- Parameters:
parentId- the parentId to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getCreator
AWSXRayRecorder getCreator()
- Returns:
- the creator
-
setCreator
void setCreator(AWSXRayRecorder creator)
- Parameters:
creator- the creator to set- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getParentSegment
Segment getParentSegment()
-
getSubsegments
@Deprecated java.util.List<Subsegment> getSubsegments()
Deprecated.UsegetSubsegmentsCopy().- Returns:
- the subsegments
-
getSubsegmentsCopy
java.util.List<Subsegment> getSubsegmentsCopy()
Returns a copy of the currently added subsegments. Updates to the returnedListwill not be reflected in theEntity.
-
addSubsegment
void addSubsegment(Subsegment subsegment)
Adds a subsegment.- Parameters:
subsegment- the subsegment to add- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
addException
void addException(java.lang.Throwable exception)
Adds an exception to the entity's cause and sets fault to true.- Parameters:
exception- the exception to add- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
getReferenceCount
int getReferenceCount()
Returns the reference count of the segment. This number represents how many open subsegments are children of this segment. The segment is emitted when its reference count reaches 0.- Returns:
- the reference count
-
getTotalSize
java.util.concurrent.atomic.LongAdder getTotalSize()
- Returns:
- the totalSize
-
incrementReferenceCount
void incrementReferenceCount()
Increments the subsegment-reference counter.- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
decrementReferenceCount
boolean decrementReferenceCount()
Decrements the subsegment-reference counter.- Returns:
- true if the segment is no longer in progress and the reference count is less than or equal to zero.
- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putHttp
void putHttp(java.lang.String key, java.lang.Object value)Puts HTTP information.- Parameters:
key- the key under which the HTTP information is storedvalue- the HTTP information- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putAllHttp
void putAllHttp(java.util.Map<java.lang.String,java.lang.Object> all)
Puts HTTP information.- Parameters:
all- the HTTP information to put- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putAws
void putAws(java.lang.String key, java.lang.Object value)Puts AWS information.- Parameters:
key- the key under which the AWS information is storedvalue- the AWS information- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putAllAws
void putAllAws(java.util.Map<java.lang.String,java.lang.Object> all)
Puts AWS information.- Parameters:
all- the AWS information to put- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putSql
void putSql(java.lang.String key, java.lang.Object value)Puts SQL information.- Parameters:
key- the key under which the SQL information is storedvalue- the SQL information- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putAllSql
void putAllSql(java.util.Map<java.lang.String,java.lang.Object> all)
Puts SQL information.- Parameters:
all- the SQL information to put- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putAnnotation
void putAnnotation(java.lang.String key, java.lang.String value)Puts a String annotation.- Parameters:
key- the key under which the annotation is storedvalue- the String annotation- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putAnnotation
void putAnnotation(java.lang.String key, java.lang.Number value)Puts a Number annotation.- Parameters:
key- the key under which the annotation is storedvalue- the Number annotation- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putAnnotation
void putAnnotation(java.lang.String key, java.lang.Boolean value)Puts a Boolean annotation.- Parameters:
key- the key under which the annotation is storedvalue- the Boolean annotation- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putMetadata
void putMetadata(java.lang.String key, java.lang.Object object)Puts metadata under the namespace 'default'.- Parameters:
key- the key under which the metadata is storedobject- the metadata- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
putMetadata
void putMetadata(java.lang.String namespace, java.lang.String key, java.lang.Object object)Puts metadata.- Parameters:
namespace- the namespace under which the metadata is storedkey- the key under which the metadata is storedobject- the metadata- Throws:
AlreadyEmittedException- if the entity has already been emitted to the X-Ray daemon and the ContextMissingStrategy of the AWSXRayRecorder used to create this entity is configured to throw exceptions
-
removeSubsegment
void removeSubsegment(Subsegment subsegment)
Removes a subsegment from the subsegment list. Decrements the total size of the parentSegment. Marks the removed subsegment as emitted future modification on this subsegment may raise an AlreadyEmittedException.- Parameters:
subsegment- the subsegment to remove
-
isEmitted
boolean isEmitted()
-
isSampled
boolean isSampled()
-
setEmitted
void setEmitted(boolean emitted)
Sets emitted on the entity.
-
compareAndSetEmitted
@Deprecated boolean compareAndSetEmitted(boolean current, boolean next)Deprecated.Checks whether thisEntitycurrently has emitted state ofcurrentand if so, set emitted state tonext. Returnstrueif the state was updated, orfalseotherwise.
-
serialize
java.lang.String serialize()
-
prettySerialize
java.lang.String prettySerialize()
-
-