Interface Entity

    • Method Detail

      • 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:
        an unused ReentrantLock
      • 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
      • 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()
      • getSubsegmentsCopy

        java.util.List<Subsegment> getSubsegmentsCopy()
        Returns a copy of the currently added subsegments. Updates to the returned List will not be reflected in the Entity.
      • 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()
      • compareAndSetEmitted

        boolean compareAndSetEmitted​(boolean current,
                                     boolean next)
        Checks whether this Entity currently has emitted state of current and if so, set emitted state to next. Returns true if the state was updated, or false otherwise.
      • serialize

        java.lang.String serialize()
      • prettySerialize

        java.lang.String prettySerialize()