Interface Segment

All Superinterfaces:
java.lang.AutoCloseable, Entity
All Known Implementing Classes:
DummySegment, FacadeSegment, SegmentImpl

public interface Segment
extends Entity
  • Method Details

    • noOp

      static Segment noOp​(TraceID traceId, AWSXRayRecorder recorder)
    • end

      boolean end()
      Ends the segment. Sets the end time to the current time. Sets inProgress to false.
      Returns:
      true if 1) the reference count is less than or equal to zero and 2) sampled is true
    • isRecording

      boolean isRecording()
      Returns if this Segment is recording events and will be emitted. Any operations on a Segment which is not recording are effectively no-op.
    • isSampled

      boolean isSampled()
      Returns:
      the sampled
    • setSampled

      void setSampled​(boolean sampled)
      Parameters:
      sampled - the sampled 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
    • getResourceArn

      java.lang.String getResourceArn()
      Returns:
      the resourceArn
    • setResourceArn

      void setResourceArn​(java.lang.String resourceArn)
      Parameters:
      resourceArn - the resourceArn 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
    • getUser

      java.lang.String getUser()
      Returns:
      the user
    • setUser

      void setUser​(java.lang.String user)
      Parameters:
      user - the user 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
    • getOrigin

      java.lang.String getOrigin()
      Returns:
      the origin
    • setOrigin

      void setOrigin​(java.lang.String origin)
      Parameters:
      origin - the origin 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
    • getService

      java.util.Map<java.lang.String,​java.lang.Object> getService()
      Returns:
      the service
    • setService

      void setService​(java.util.Map<java.lang.String,​java.lang.Object> service)
      Parameters:
      service - the service 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()
      Specified by:
      getAnnotations in interface Entity
      Returns:
      the annotations
    • putService

      void putService​(java.lang.String key, java.lang.Object object)
      Puts information about this service.
      Parameters:
      key - the key under which the service information is stored
      object - the service 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
    • putAllService

      void putAllService​(java.util.Map<java.lang.String,​java.lang.Object> all)
      Puts information about this service.
      Parameters:
      all - the service information 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
    • setRuleName

      void setRuleName​(java.lang.String name)
    • getParentSegment

      Segment getParentSegment()
      Specified by:
      getParentSegment in interface Entity
    • close

      void close()
      Specified by:
      close in interface java.lang.AutoCloseable