Package com.amazonaws.xray.entities
Class NoOpSegment
- java.lang.Object
-
- com.amazonaws.xray.entities.NoOpSegment
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addException(java.lang.Throwable exception)
Adds an exception to the entity's cause and sets fault to true.void
addSubsegment(Subsegment subsegment)
Adds a subsegment.void
close()
boolean
compareAndSetEmitted(boolean current, boolean next)
Checks whether thisEntity
currently has emitted state ofcurrent
and if so, set emitted state tonext
.boolean
decrementReferenceCount()
Decrements the subsegment-reference counter.boolean
end()
Ends the segment.java.util.Map<java.lang.String,java.lang.Object>
getAnnotations()
java.util.Map<java.lang.String,java.lang.Object>
getAws()
Cause
getCause()
AWSXRayRecorder
getCreator()
double
getEndTime()
java.util.Map<java.lang.String,java.lang.Object>
getHttp()
java.lang.String
getId()
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>
getMetadata()
java.lang.String
getName()
java.lang.String
getNamespace()
java.lang.String
getOrigin()
Entity
getParent()
@Nullable java.lang.String
getParentId()
Segment
getParentSegment()
int
getReferenceCount()
Returns the reference count of the segment.java.lang.String
getResourceArn()
java.util.Map<java.lang.String,java.lang.Object>
getService()
java.util.Map<java.lang.String,java.lang.Object>
getSql()
double
getStartTime()
java.util.List<Subsegment>
getSubsegments()
java.util.List<Subsegment>
getSubsegmentsCopy()
Returns a copy of the currently added subsegments.java.util.concurrent.locks.ReentrantLock
getSubsegmentsLock()
java.util.concurrent.atomic.LongAdder
getTotalSize()
TraceID
getTraceId()
java.lang.String
getUser()
void
incrementReferenceCount()
Increments the subsegment-reference counter.boolean
isEmitted()
boolean
isError()
boolean
isFault()
boolean
isInProgress()
boolean
isRecording()
Returns if thisSegment
is recording events and will be emitted.boolean
isSampled()
boolean
isThrottle()
java.lang.String
prettySerialize()
void
putAllAws(java.util.Map<java.lang.String,java.lang.Object> all)
Puts AWS information.void
putAllHttp(java.util.Map<java.lang.String,java.lang.Object> all)
Puts HTTP information.void
putAllService(java.util.Map<java.lang.String,java.lang.Object> all)
Puts information about this service.void
putAllSql(java.util.Map<java.lang.String,java.lang.Object> all)
Puts SQL information.void
putAnnotation(java.lang.String key, java.lang.Boolean value)
Puts a Boolean annotation.void
putAnnotation(java.lang.String key, java.lang.Number value)
Puts a Number annotation.void
putAnnotation(java.lang.String key, java.lang.String value)
Puts a String annotation.void
putAws(java.lang.String key, java.lang.Object value)
Puts AWS information.void
putHttp(java.lang.String key, java.lang.Object value)
Puts HTTP information.void
putMetadata(java.lang.String key, java.lang.Object object)
Puts metadata under the namespace 'default'.void
putMetadata(java.lang.String namespace, java.lang.String key, java.lang.Object object)
Puts metadata.void
putService(java.lang.String key, java.lang.Object object)
Puts information about this service.void
putSql(java.lang.String key, java.lang.Object value)
Puts SQL information.void
removeSubsegment(Subsegment subsegment)
Removes a subsegment from the subsegment list.java.lang.String
serialize()
void
setAnnotations(java.util.Map<java.lang.String,java.lang.Object> annotations)
void
setAws(java.util.Map<java.lang.String,java.lang.Object> aws)
void
setCreator(AWSXRayRecorder creator)
void
setEmitted(boolean emitted)
Sets emitted on the entity.void
setEndTime(double endTime)
void
setError(boolean error)
Sets the error value of the entity.void
setFault(boolean fault)
void
setHttp(java.util.Map<java.lang.String,java.lang.Object> http)
void
setId(java.lang.String id)
void
setInProgress(boolean inProgress)
void
setMetadata(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> metadata)
void
setNamespace(java.lang.String namespace)
void
setOrigin(java.lang.String origin)
void
setParent(Entity parent)
void
setParentId(@Nullable java.lang.String parentId)
void
setResourceArn(java.lang.String resourceArn)
void
setRuleName(java.lang.String name)
void
setSampled(boolean sampled)
void
setService(java.util.Map<java.lang.String,java.lang.Object> service)
void
setSql(java.util.Map<java.lang.String,java.lang.Object> sql)
void
setStartTime(double startTime)
void
setSubsegmentsLock(java.util.concurrent.locks.ReentrantLock subsegmentsLock)
void
setThrottle(boolean throttle)
Sets the throttle value.void
setTraceId(TraceID traceId)
void
setUser(java.lang.String user)
-
-
-
Method Detail
-
end
public boolean end()
Description copied from interface:Segment
Ends the segment. Sets the end time to the current time. Sets inProgress to false.
-
isRecording
public boolean isRecording()
Description copied from interface:Segment
Returns if thisSegment
is recording events and will be emitted. Any operations on aSegment
which is not recording are effectively no-op.- Specified by:
isRecording
in interfaceSegment
-
setSampled
public void setSampled(boolean sampled)
- Specified by:
setSampled
in interfaceSegment
- Parameters:
sampled
- the sampled to set
-
getResourceArn
public java.lang.String getResourceArn()
- Specified by:
getResourceArn
in interfaceSegment
- Returns:
- the resourceArn
-
setResourceArn
public void setResourceArn(java.lang.String resourceArn)
- Specified by:
setResourceArn
in interfaceSegment
- Parameters:
resourceArn
- the resourceArn to set
-
getUser
public java.lang.String getUser()
-
setUser
public void setUser(java.lang.String user)
-
getOrigin
public java.lang.String getOrigin()
-
setOrigin
public void setOrigin(java.lang.String origin)
-
getService
public java.util.Map<java.lang.String,java.lang.Object> getService()
- Specified by:
getService
in interfaceSegment
- Returns:
- the service
-
setService
public void setService(java.util.Map<java.lang.String,java.lang.Object> service)
- Specified by:
setService
in interfaceSegment
- Parameters:
service
- the service to set
-
setId
public void setId(java.lang.String id)
-
getStartTime
public double getStartTime()
- Specified by:
getStartTime
in interfaceEntity
- Returns:
- the startTime
-
setStartTime
public void setStartTime(double startTime)
- Specified by:
setStartTime
in interfaceEntity
- Parameters:
startTime
- the startTime to set
-
getEndTime
public double getEndTime()
- Specified by:
getEndTime
in interfaceEntity
- Returns:
- the endTime
-
setEndTime
public void setEndTime(double endTime)
- Specified by:
setEndTime
in interfaceEntity
- Parameters:
endTime
- the endTime to set
-
setFault
public void setFault(boolean fault)
-
setError
public void setError(boolean error)
Description copied from interface:Entity
Sets the error value of the entity.
-
getNamespace
public java.lang.String getNamespace()
- Specified by:
getNamespace
in interfaceEntity
- Returns:
- the namespace
-
setNamespace
public void setNamespace(java.lang.String namespace)
- Specified by:
setNamespace
in interfaceEntity
- Parameters:
namespace
- the namespace to set
-
getSubsegmentsLock
public java.util.concurrent.locks.ReentrantLock getSubsegmentsLock()
- Specified by:
getSubsegmentsLock
in interfaceEntity
- Returns:
- the subsegmentsLock
-
setSubsegmentsLock
public void setSubsegmentsLock(java.util.concurrent.locks.ReentrantLock subsegmentsLock)
- Specified by:
setSubsegmentsLock
in interfaceEntity
- Parameters:
subsegmentsLock
- the subsegmentsLock to set
-
getHttp
public java.util.Map<java.lang.String,java.lang.Object> getHttp()
-
setHttp
public void setHttp(java.util.Map<java.lang.String,java.lang.Object> http)
-
getAws
public java.util.Map<java.lang.String,java.lang.Object> getAws()
-
setAws
public void setAws(java.util.Map<java.lang.String,java.lang.Object> aws)
-
getSql
public java.util.Map<java.lang.String,java.lang.Object> getSql()
-
setSql
public void setSql(java.util.Map<java.lang.String,java.lang.Object> sql)
-
getMetadata
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getMetadata()
- Specified by:
getMetadata
in interfaceEntity
- Returns:
- the metadata
-
setMetadata
public void setMetadata(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> metadata)
- Specified by:
setMetadata
in interfaceEntity
- Parameters:
metadata
- the metadata to set
-
getAnnotations
public java.util.Map<java.lang.String,java.lang.Object> getAnnotations()
- Specified by:
getAnnotations
in interfaceEntity
- Specified by:
getAnnotations
in interfaceSegment
- Returns:
- the annotations
-
setAnnotations
public void setAnnotations(java.util.Map<java.lang.String,java.lang.Object> annotations)
- Specified by:
setAnnotations
in interfaceEntity
- Parameters:
annotations
- the annotations to set
-
setParent
public void setParent(Entity parent)
-
isThrottle
public boolean isThrottle()
- Specified by:
isThrottle
in interfaceEntity
- Returns:
- the throttle
-
setThrottle
public void setThrottle(boolean throttle)
Description copied from interface:Entity
Sets the throttle value. When setting to true, error is also set to true and fault set to false.- Specified by:
setThrottle
in interfaceEntity
- Parameters:
throttle
- the throttle to set
-
isInProgress
public boolean isInProgress()
- Specified by:
isInProgress
in interfaceEntity
- Returns:
- the inProgress
-
setInProgress
public void setInProgress(boolean inProgress)
- Specified by:
setInProgress
in interfaceEntity
- Parameters:
inProgress
- the inProgress to set
-
getTraceId
public TraceID getTraceId()
- Specified by:
getTraceId
in interfaceEntity
- Returns:
- the traceId
-
setTraceId
public void setTraceId(TraceID traceId)
- Specified by:
setTraceId
in interfaceEntity
- Parameters:
traceId
- the traceId to set
-
getParentId
public @Nullable java.lang.String getParentId()
- Specified by:
getParentId
in interfaceEntity
- Returns:
- the parentId
-
setParentId
public void setParentId(@Nullable java.lang.String parentId)
- Specified by:
setParentId
in interfaceEntity
- Parameters:
parentId
- the parentId to set
-
getCreator
public AWSXRayRecorder getCreator()
- Specified by:
getCreator
in interfaceEntity
- Returns:
- the creator
-
setCreator
public void setCreator(AWSXRayRecorder creator)
- Specified by:
setCreator
in interfaceEntity
- Parameters:
creator
- the creator to set
-
putService
public void putService(java.lang.String key, java.lang.Object object)
Description copied from interface:Segment
Puts information about this service.- Specified by:
putService
in interfaceSegment
- Parameters:
key
- the key under which the service information is storedobject
- the service information
-
putAllService
public void putAllService(java.util.Map<java.lang.String,java.lang.Object> all)
Description copied from interface:Segment
Puts information about this service.- Specified by:
putAllService
in interfaceSegment
- Parameters:
all
- the service information to set.
-
setRuleName
public void setRuleName(java.lang.String name)
- Specified by:
setRuleName
in interfaceSegment
-
getParentSegment
public Segment getParentSegment()
- Specified by:
getParentSegment
in interfaceEntity
- Specified by:
getParentSegment
in interfaceSegment
-
getSubsegments
public java.util.List<Subsegment> getSubsegments()
- Specified by:
getSubsegments
in interfaceEntity
- Returns:
- the subsegments
-
getSubsegmentsCopy
public java.util.List<Subsegment> getSubsegmentsCopy()
Description copied from interface:Entity
Returns a copy of the currently added subsegments. Updates to the returnedList
will not be reflected in theEntity
.- Specified by:
getSubsegmentsCopy
in interfaceEntity
-
addSubsegment
public void addSubsegment(Subsegment subsegment)
Description copied from interface:Entity
Adds a subsegment.- Specified by:
addSubsegment
in interfaceEntity
- Parameters:
subsegment
- the subsegment to add
-
addException
public void addException(java.lang.Throwable exception)
Description copied from interface:Entity
Adds an exception to the entity's cause and sets fault to true.- Specified by:
addException
in interfaceEntity
- Parameters:
exception
- the exception to add
-
getReferenceCount
public int getReferenceCount()
Description copied from interface:Entity
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.- Specified by:
getReferenceCount
in interfaceEntity
- Returns:
- the reference count
-
getTotalSize
public java.util.concurrent.atomic.LongAdder getTotalSize()
- Specified by:
getTotalSize
in interfaceEntity
- Returns:
- the totalSize
-
incrementReferenceCount
public void incrementReferenceCount()
Description copied from interface:Entity
Increments the subsegment-reference counter.- Specified by:
incrementReferenceCount
in interfaceEntity
-
decrementReferenceCount
public boolean decrementReferenceCount()
Description copied from interface:Entity
Decrements the subsegment-reference counter.- Specified by:
decrementReferenceCount
in interfaceEntity
- Returns:
- true if the segment is no longer in progress and the reference count is less than or equal to zero.
-
putHttp
public void putHttp(java.lang.String key, java.lang.Object value)
Description copied from interface:Entity
Puts HTTP information.
-
putAllHttp
public void putAllHttp(java.util.Map<java.lang.String,java.lang.Object> all)
Description copied from interface:Entity
Puts HTTP information.- Specified by:
putAllHttp
in interfaceEntity
- Parameters:
all
- the HTTP information to put
-
putAws
public void putAws(java.lang.String key, java.lang.Object value)
Description copied from interface:Entity
Puts AWS information.
-
putAllAws
public void putAllAws(java.util.Map<java.lang.String,java.lang.Object> all)
Description copied from interface:Entity
Puts AWS information.
-
putSql
public void putSql(java.lang.String key, java.lang.Object value)
Description copied from interface:Entity
Puts SQL information.
-
putAllSql
public void putAllSql(java.util.Map<java.lang.String,java.lang.Object> all)
Description copied from interface:Entity
Puts SQL information.
-
putAnnotation
public void putAnnotation(java.lang.String key, java.lang.String value)
Description copied from interface:Entity
Puts a String annotation.- Specified by:
putAnnotation
in interfaceEntity
- Parameters:
key
- the key under which the annotation is storedvalue
- the String annotation
-
putAnnotation
public void putAnnotation(java.lang.String key, java.lang.Number value)
Description copied from interface:Entity
Puts a Number annotation.- Specified by:
putAnnotation
in interfaceEntity
- Parameters:
key
- the key under which the annotation is storedvalue
- the Number annotation
-
putAnnotation
public void putAnnotation(java.lang.String key, java.lang.Boolean value)
Description copied from interface:Entity
Puts a Boolean annotation.- Specified by:
putAnnotation
in interfaceEntity
- Parameters:
key
- the key under which the annotation is storedvalue
- the Boolean annotation
-
putMetadata
public void putMetadata(java.lang.String key, java.lang.Object object)
Description copied from interface:Entity
Puts metadata under the namespace 'default'.- Specified by:
putMetadata
in interfaceEntity
- Parameters:
key
- the key under which the metadata is storedobject
- the metadata
-
putMetadata
public void putMetadata(java.lang.String namespace, java.lang.String key, java.lang.Object object)
Description copied from interface:Entity
Puts metadata.- Specified by:
putMetadata
in interfaceEntity
- Parameters:
namespace
- the namespace under which the metadata is storedkey
- the key under which the metadata is storedobject
- the metadata
-
removeSubsegment
public void removeSubsegment(Subsegment subsegment)
Description copied from interface:Entity
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.- Specified by:
removeSubsegment
in interfaceEntity
- Parameters:
subsegment
- the subsegment to remove
-
setEmitted
public void setEmitted(boolean emitted)
Description copied from interface:Entity
Sets emitted on the entity.- Specified by:
setEmitted
in interfaceEntity
-
compareAndSetEmitted
public boolean compareAndSetEmitted(boolean current, boolean next)
Description copied from interface:Entity
Checks whether thisEntity
currently has emitted state ofcurrent
and if so, set emitted state tonext
. Returnstrue
if the state was updated, orfalse
otherwise.- Specified by:
compareAndSetEmitted
in interfaceEntity
-
prettySerialize
public java.lang.String prettySerialize()
- Specified by:
prettySerialize
in interfaceEntity
-
-