Interface Entity

All Superinterfaces:
java.lang.AutoCloseable
All Known Subinterfaces:
Segment, Subsegment
All Known Implementing Classes:
DummySegment, DummySubsegment, EntityImpl, FacadeSegment, SegmentImpl, SubsegmentImpl

public interface Entity
extends java.lang.AutoCloseable
  • Method Summary

    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.
    boolean decrementReferenceCount()
    Decrements the subsegment-reference counter.
    static java.lang.String generateId()
    Deprecated.
    Use the ID generator configured on this entity's creator instead
    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()  
    @Nullable java.lang.String getNamespace()  
    Entity getParent()  
    @Nullable java.lang.String getParentId()  
    Segment getParentSegment()  
    int getReferenceCount()
    Returns the reference count of the segment.
    java.util.Map<java.lang.String,​java.lang.Object> getSql()  
    double getStartTime()  
    java.util.List<Subsegment> getSubsegments()  
    java.util.concurrent.locks.ReentrantLock getSubsegmentsLock()
    Deprecated.
    This is for internal use of the SDK and will be made private.
    java.util.concurrent.atomic.LongAdder getTotalSize()  
    TraceID getTraceId()  
    void incrementReferenceCount()
    Increments the subsegment-reference counter.
    boolean isEmitted()  
    boolean isError()  
    boolean isFault()  
    boolean isInProgress()  
    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 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 putSql​(java.lang.String key, java.lang.Object value)
    Puts SQL information.
    void removeSubsegment​(Subsegment subsegment)
    Removes a subsegment from the subsegment list.
    default void run​(java.lang.Runnable runnable)
    Immediately runs the provided Runnable with this Segment as the current entity.
    default void run​(java.lang.Runnable runnable, AWSXRayRecorder recorder)
    Immediately runs the provided Runnable with this Segment as the current entity.
    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)  
    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 setParent​(Entity parent)  
    void setParentId​(@Nullable java.lang.String parentId)  
    void setSql​(java.util.Map<java.lang.String,​java.lang.Object> sql)  
    void setStartTime​(double startTime)  
    void setSubsegmentsLock​(java.util.concurrent.locks.ReentrantLock subsegmentsLock)
    Deprecated.
    This is for internal use of the SDK and will be made private
    void setThrottle​(boolean throttle)
    Sets the throttle value.
    void setTraceId​(TraceID traceId)  

    Methods inherited from interface java.lang.AutoCloseable

    close
  • Method Details

    • generateId

      @Deprecated static java.lang.String generateId()
      Deprecated.
      Use the ID generator configured on this entity's creator instead
    • run

      default void run​(java.lang.Runnable runnable)
      Immediately runs the provided Runnable with this Segment as the current entity.
    • run

      default void run​(java.lang.Runnable runnable, AWSXRayRecorder recorder)
      Immediately runs the provided Runnable with this Segment as 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

      java.util.List<Subsegment> getSubsegments()
      Returns:
      the subsegments
    • 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 stored
      value - 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 stored
      value - 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 stored
      value - 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 stored
      value - 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 stored
      value - 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 stored
      value - 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 stored
      object - 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 stored
      key - the key under which the metadata is stored
      object - 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()
    • setEmitted

      void setEmitted​(boolean emitted)
    • serialize

      java.lang.String serialize()
    • prettySerialize

      java.lang.String prettySerialize()